diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/focus.h | 4 | ||||
-rw-r--r-- | include/input_state.h | 49 | ||||
-rw-r--r-- | include/layout.h | 2 |
3 files changed, 53 insertions, 2 deletions
diff --git a/include/focus.h b/include/focus.h index 410ed134..383993fa 100644 --- a/include/focus.h +++ b/include/focus.h | |||
@@ -1,7 +1,5 @@ | |||
1 | #ifndef _SWAY_FOCUS_H | 1 | #ifndef _SWAY_FOCUS_H |
2 | #define _SWAY_FOCUS_H | 2 | #define _SWAY_FOCUS_H |
3 | #include "container.h" | ||
4 | |||
5 | enum movement_direction { | 3 | enum movement_direction { |
6 | MOVE_LEFT, | 4 | MOVE_LEFT, |
7 | MOVE_RIGHT, | 5 | MOVE_RIGHT, |
@@ -10,6 +8,8 @@ enum movement_direction { | |||
10 | MOVE_PARENT | 8 | MOVE_PARENT |
11 | }; | 9 | }; |
12 | 10 | ||
11 | #include "container.h" | ||
12 | |||
13 | // focused_container - the container found by following the `focused` pointer | 13 | // focused_container - the container found by following the `focused` pointer |
14 | // from a given container to a container with `is_focused` boolean set | 14 | // from a given container to a container with `is_focused` boolean set |
15 | // --- | 15 | // --- |
diff --git a/include/input_state.h b/include/input_state.h new file mode 100644 index 00000000..782b4b19 --- /dev/null +++ b/include/input_state.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _SWAY_KEY_STATE_H | ||
2 | #define _SWAY_KEY_STATE_H | ||
3 | #include <stdbool.h> | ||
4 | #include <stdint.h> | ||
5 | #include "container.h" | ||
6 | |||
7 | /* Keyboard state */ | ||
8 | |||
9 | typedef uint32_t keycode; | ||
10 | |||
11 | // returns true if key has been pressed, otherwise false | ||
12 | bool check_key(keycode key); | ||
13 | |||
14 | // sets a key as pressed | ||
15 | void press_key(keycode key); | ||
16 | |||
17 | // unsets a key as pressed | ||
18 | void release_key(keycode key); | ||
19 | |||
20 | /* Pointer state */ | ||
21 | |||
22 | enum pointer_values { | ||
23 | M_LEFT_CLICK = 272, | ||
24 | M_RIGHT_CLICK = 273, | ||
25 | M_SCROLL_CLICK = 274, | ||
26 | M_SCROLL_UP = 275, | ||
27 | M_SCROLL_DOWN = 276, | ||
28 | }; | ||
29 | |||
30 | extern struct pointer_state { | ||
31 | bool l_held; | ||
32 | bool r_held; | ||
33 | struct pointer_floating { | ||
34 | bool drag; | ||
35 | bool resize; | ||
36 | } floating; | ||
37 | struct pointer_lock { | ||
38 | bool left; | ||
39 | bool right; | ||
40 | bool top; | ||
41 | bool bottom; | ||
42 | } lock; | ||
43 | } pointer_state; | ||
44 | |||
45 | void start_floating(swayc_t *view); | ||
46 | void reset_floating(swayc_t *view); | ||
47 | |||
48 | #endif | ||
49 | |||
diff --git a/include/layout.h b/include/layout.h index 98fdb531..75e72d2f 100644 --- a/include/layout.h +++ b/include/layout.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <wlc/wlc.h> | 4 | #include <wlc/wlc.h> |
5 | #include "list.h" | 5 | #include "list.h" |
6 | #include "container.h" | 6 | #include "container.h" |
7 | #include "focus.h" | ||
7 | 8 | ||
8 | extern swayc_t root_container; | 9 | extern swayc_t root_container; |
9 | 10 | ||
@@ -26,5 +27,6 @@ void focus_view_for(swayc_t *ancestor, swayc_t *container); | |||
26 | 27 | ||
27 | swayc_t *get_focused_container(swayc_t *parent); | 28 | swayc_t *get_focused_container(swayc_t *parent); |
28 | swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent); | 29 | swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent); |
30 | swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir); | ||
29 | 31 | ||
30 | #endif | 32 | #endif |