summaryrefslogtreecommitdiffstats
path: root/include/input_state.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/input_state.h')
-rw-r--r--include/input_state.h72
1 files changed, 47 insertions, 25 deletions
diff --git a/include/input_state.h b/include/input_state.h
index 29064fd0..d87ae18c 100644
--- a/include/input_state.h
+++ b/include/input_state.h
@@ -15,6 +15,7 @@ void press_key(uint32_t key_sym, uint32_t key_code);
15// unsets a key as pressed 15// unsets a key as pressed
16void release_key(uint32_t key_sym, uint32_t key_code); 16void release_key(uint32_t key_sym, uint32_t key_code);
17 17
18
18/* Pointer state */ 19/* Pointer state */
19 20
20enum pointer_values { 21enum pointer_values {
@@ -25,34 +26,55 @@ enum pointer_values {
25 M_SCROLL_DOWN = 276, 26 M_SCROLL_DOWN = 276,
26}; 27};
27 28
29enum pointer_mode {
30 // Target
31 M_FLOATING = 1,
32 M_TILING = 2,
33 // Action
34 M_DRAGGING = 4,
35 M_RESIZING = 8,
36};
37
38struct pointer_button_state {
39 bool held;
40 // state at the point it was pressed
41 int x, y;
42 swayc_t *view;
43};
44
28extern struct pointer_state { 45extern struct pointer_state {
29 bool l_held; 46 // mouse clicks
30 bool r_held; 47 struct pointer_button_state left;
31 struct pointer_floating { 48 struct pointer_button_state right;
32 bool drag; 49 struct pointer_button_state scroll;
33 bool resize; 50
34 } floating; 51 // pointer position
35 struct pointer_tiling { 52 struct mouse_origin{
36 bool resize; 53 int x, y;
37 swayc_t *init_view; 54 } origin;
38 struct wlc_origin lock_pos; 55
39 } tiling; 56 // change in pointer position
40 struct pointer_lock { 57 struct {
41 // Lock movement for certain edges 58 int x, y;
42 bool left; 59 } delta;
43 bool right; 60
44 bool top; 61 // view pointer is currently over
45 bool bottom; 62 swayc_t *view;
46 // Lock movement in certain directions 63
47 bool temp_left; 64 // Pointer mode
48 bool temp_right; 65 int mode;
49 bool temp_up;
50 bool temp_down;
51 } lock;
52} pointer_state; 66} pointer_state;
53 67
54void start_floating(swayc_t *view); 68// on button release unset mode depending on the button.
55void reset_floating(swayc_t *view); 69// on button press set mode conditionally depending on the button
70void pointer_mode_set(uint32_t button, bool condition);
71
72// Update mode in mouse motion
73void pointer_mode_update(void);
74
75// Reset mode on any keypress;
76void pointer_mode_reset(void);
77
56void input_init(void); 78void input_init(void);
57 79
58#endif 80#endif