summaryrefslogtreecommitdiffstats
path: root/include
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
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')
-rw-r--r--include/input_state.h46
-rw-r--r--include/layout.h2
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
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);
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);
19swayc_t *add_sibling(swayc_t *sibling, swayc_t *child); 19swayc_t *add_sibling(swayc_t *sibling, swayc_t *child);
20swayc_t *replace_child(swayc_t *child, swayc_t *new_child); 20swayc_t *replace_child(swayc_t *child, swayc_t *new_child);
21swayc_t *remove_child(swayc_t *child); 21swayc_t *remove_child(swayc_t *child);
22void swap_container(swayc_t *a, swayc_t *b);
22 23
23void move_container(swayc_t* container,swayc_t* root,enum movement_direction direction); 24void move_container(swayc_t* container,swayc_t* root,enum movement_direction direction);
24 25
25// Layout 26// Layout
27void update_geometry(swayc_t *view);
26void arrange_windows(swayc_t *container, double width, double height); 28void arrange_windows(swayc_t *container, double width, double height);
27 29
28swayc_t *get_focused_container(swayc_t *parent); 30swayc_t *get_focused_container(swayc_t *parent);