diff options
Diffstat (limited to 'include/input_state.h')
-rw-r--r-- | include/input_state.h | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/include/input_state.h b/include/input_state.h index 04fde42d..3a246e0c 100644 --- a/include/input_state.h +++ b/include/input_state.h | |||
@@ -17,6 +17,7 @@ void press_key(keycode key); | |||
17 | // unsets a key as pressed | 17 | // unsets a key as pressed |
18 | void release_key(keycode key); | 18 | void release_key(keycode key); |
19 | 19 | ||
20 | |||
20 | /* Pointer state */ | 21 | /* Pointer state */ |
21 | 22 | ||
22 | enum pointer_values { | 23 | enum pointer_values { |
@@ -27,9 +28,40 @@ enum pointer_values { | |||
27 | M_SCROLL_DOWN = 276, | 28 | M_SCROLL_DOWN = 276, |
28 | }; | 29 | }; |
29 | 30 | ||
31 | enum pointer_mode { | ||
32 | // Target | ||
33 | M_FLOATING = 1 << 0, | ||
34 | M_TILING = 1 << 1, | ||
35 | // Action | ||
36 | M_DRAGGING = 1 << 2, | ||
37 | M_RESIZING = 1 << 3, | ||
38 | }; | ||
39 | |||
30 | extern struct pointer_state { | 40 | extern struct pointer_state { |
31 | bool l_held; | 41 | // mouse clicks |
32 | bool r_held; | 42 | bool l_held : 1; |
43 | bool r_held : 1; | ||
44 | |||
45 | // scroll wheel | ||
46 | bool s_held : 1; | ||
47 | bool s_up : 1; | ||
48 | bool s_down :1; | ||
49 | |||
50 | // pointer position | ||
51 | struct mouse_origin{ | ||
52 | int x, y; | ||
53 | } origin; | ||
54 | struct { | ||
55 | int x, y; | ||
56 | } delta; | ||
57 | |||
58 | // view pointer is over | ||
59 | swayc_t *view; | ||
60 | |||
61 | // Pointer mode | ||
62 | int mode; | ||
63 | |||
64 | // OLD | ||
33 | struct pointer_floating { | 65 | struct pointer_floating { |
34 | bool drag; | 66 | bool drag; |
35 | bool resize; | 67 | bool resize; |
@@ -53,6 +85,16 @@ extern struct pointer_state { | |||
53 | } lock; | 85 | } lock; |
54 | } pointer_state; | 86 | } pointer_state; |
55 | 87 | ||
88 | // on button release unset mode depending on the button. | ||
89 | // on button press set mode conditionally depending on the button | ||
90 | void pointer_mode_set(uint32_t button, bool condition); | ||
91 | |||
92 | // Update mode in mouse motion | ||
93 | void pointer_mode_update(void); | ||
94 | |||
95 | // Reset mode on any keypress; | ||
96 | void pointer_mode_reset(void); | ||
97 | |||
56 | void start_floating(swayc_t *view); | 98 | void start_floating(swayc_t *view); |
57 | void reset_floating(swayc_t *view); | 99 | void reset_floating(swayc_t *view); |
58 | void input_init(void); | 100 | void input_init(void); |