summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-08-23 15:38:51 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-08-23 15:38:51 -0400
commit9a7f48f87272dea8cb1e678673b2fe95dc993d68 (patch)
tree1a9e633ead0ff50f55987310621dab39531d2305 /include
parentRefactor keyboard to consider modified keysyms (diff)
parentmerge (diff)
downloadsway-9a7f48f87272dea8cb1e678673b2fe95dc993d68.tar.gz
sway-9a7f48f87272dea8cb1e678673b2fe95dc993d68.tar.zst
sway-9a7f48f87272dea8cb1e678673b2fe95dc993d68.zip
Merge pull request #121 from taiyu-len/pointer_mod
Pointer mode clean and fix.
Diffstat (limited to 'include')
-rw-r--r--include/input_state.h72
-rw-r--r--include/layout.h2
-rw-r--r--include/resize.h3
3 files changed, 50 insertions, 27 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
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);
diff --git a/include/resize.h b/include/resize.h
index 4ace1815..8d205d3b 100644
--- a/include/resize.h
+++ b/include/resize.h
@@ -1,8 +1,7 @@
1#ifndef _SWAY_RESIZE_H 1#ifndef _SWAY_RESIZE_H
2#define _SWAY_RESIZE_H 2#define _SWAY_RESIZE_H
3#include <stdbool.h>
3 4
4bool mouse_resize_tiled(struct wlc_origin prev_pos);
5bool resize_floating(struct wlc_origin prev_pos);
6bool resize_tiled(int amount, bool use_width); 5bool resize_tiled(int amount, bool use_width);
7 6
8#endif 7#endif