diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-20 07:38:04 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-20 07:38:04 -0400 |
commit | 14947c92aad2ff72d20fbf875957571cd8f69168 (patch) | |
tree | bba3293f642a0d60e48b11574c18b6d03990a5d5 /include/input_state.h | |
parent | 616d630fb028e44359bc6f14d16f94564341c092 (diff) | |
parent | ba6034e8c8cd2bbe15f318e511817e0904633bb3 (diff) |
Merge pull request #94 from taiyu-len/master
input_state.ch, and command conflicts resolved
Diffstat (limited to 'include/input_state.h')
-rw-r--r-- | include/input_state.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/input_state.h b/include/input_state.h new file mode 100644 index 00000000..782b4b19 --- /dev/null +++ b/include/input_state.h @@ -0,0 +1,49 @@ +#ifndef _SWAY_KEY_STATE_H +#define _SWAY_KEY_STATE_H +#include <stdbool.h> +#include <stdint.h> +#include "container.h" + +/* Keyboard state */ + +typedef uint32_t keycode; + +// returns true if key has been pressed, otherwise false +bool check_key(keycode key); + +// sets a key as pressed +void press_key(keycode key); + +// unsets a key as pressed +void release_key(keycode key); + +/* Pointer state */ + +enum pointer_values { + M_LEFT_CLICK = 272, + M_RIGHT_CLICK = 273, + M_SCROLL_CLICK = 274, + M_SCROLL_UP = 275, + M_SCROLL_DOWN = 276, +}; + +extern struct pointer_state { + bool l_held; + bool r_held; + struct pointer_floating { + bool drag; + bool resize; + } floating; + struct pointer_lock { + bool left; + bool right; + bool top; + bool bottom; + } lock; +} pointer_state; + +void start_floating(swayc_t *view); +void reset_floating(swayc_t *view); + +#endif + |