summaryrefslogtreecommitdiffstats
path: root/include/input_state.h
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-22 18:01:38 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-22 18:01:38 -0700
commite139de0857a1ba015fa324dcc662a39eca88761b (patch)
tree1b3406300ed364e2d0449c2e08ab4c39a654ac6c /include/input_state.h
parentWhoops (diff)
downloadsway-e139de0857a1ba015fa324dcc662a39eca88761b.tar.gz
sway-e139de0857a1ba015fa324dcc662a39eca88761b.tar.zst
sway-e139de0857a1ba015fa324dcc662a39eca88761b.zip
floating/tiling move + floating resize cleaned and fixed
Diffstat (limited to 'include/input_state.h')
-rw-r--r--include/input_state.h46
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
18void release_key(keycode key); 18void release_key(keycode key);
19 19
20
20/* Pointer state */ 21/* Pointer state */
21 22
22enum pointer_values { 23enum pointer_values {
@@ -27,9 +28,40 @@ enum pointer_values {
27 M_SCROLL_DOWN = 276, 28 M_SCROLL_DOWN = 276,
28}; 29};
29 30
31enum 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
30extern struct pointer_state { 40extern 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
90void pointer_mode_set(uint32_t button, bool condition);
91
92// Update mode in mouse motion
93void pointer_mode_update(void);
94
95// Reset mode on any keypress;
96void pointer_mode_reset(void);
97
56void start_floating(swayc_t *view); 98void start_floating(swayc_t *view);
57void reset_floating(swayc_t *view); 99void reset_floating(swayc_t *view);
58void input_init(void); 100void input_init(void);