diff options
author | taiyu <taiyu.len@gmail.com> | 2015-08-22 18:01:38 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-08-22 18:01:38 -0700 |
commit | e139de0857a1ba015fa324dcc662a39eca88761b (patch) | |
tree | 1b3406300ed364e2d0449c2e08ab4c39a654ac6c /include | |
parent | Whoops (diff) | |
download | sway-e139de0857a1ba015fa324dcc662a39eca88761b.tar.gz sway-e139de0857a1ba015fa324dcc662a39eca88761b.tar.zst sway-e139de0857a1ba015fa324dcc662a39eca88761b.zip |
floating/tiling move + floating resize cleaned and fixed
Diffstat (limited to 'include')
-rw-r--r-- | include/input_state.h | 46 | ||||
-rw-r--r-- | include/layout.h | 2 |
2 files changed, 46 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); |
diff --git a/include/layout.h b/include/layout.h index f8aebe0a..8f269607 100644 --- a/include/layout.h +++ b/include/layout.h | |||
@@ -19,10 +19,12 @@ void add_floating(swayc_t *ws, swayc_t *child); | |||
19 | swayc_t *add_sibling(swayc_t *sibling, swayc_t *child); | 19 | swayc_t *add_sibling(swayc_t *sibling, swayc_t *child); |
20 | swayc_t *replace_child(swayc_t *child, swayc_t *new_child); | 20 | swayc_t *replace_child(swayc_t *child, swayc_t *new_child); |
21 | swayc_t *remove_child(swayc_t *child); | 21 | swayc_t *remove_child(swayc_t *child); |
22 | void swap_container(swayc_t *a, swayc_t *b); | ||
22 | 23 | ||
23 | void move_container(swayc_t* container,swayc_t* root,enum movement_direction direction); | 24 | void move_container(swayc_t* container,swayc_t* root,enum movement_direction direction); |
24 | 25 | ||
25 | // Layout | 26 | // Layout |
27 | void update_geometry(swayc_t *view); | ||
26 | void arrange_windows(swayc_t *container, double width, double height); | 28 | void arrange_windows(swayc_t *container, double width, double height); |
27 | 29 | ||
28 | swayc_t *get_focused_container(swayc_t *parent); | 30 | swayc_t *get_focused_container(swayc_t *parent); |