summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-19 20:22:15 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-19 20:22:15 -0700
commit5ff0619ca1cab044004df044c253c9170b8316c3 (patch)
tree7872a66e494acb90dd08ffc76665557b0e0ca874 /include
parentkey_state.ch, and command conflicts resolved (diff)
downloadsway-5ff0619ca1cab044004df044c253c9170b8316c3.tar.gz
sway-5ff0619ca1cab044004df044c253c9170b8316c3.tar.zst
sway-5ff0619ca1cab044004df044c253c9170b8316c3.zip
input state, find_container_in_direction
Diffstat (limited to 'include')
-rw-r--r--include/focus.h4
-rw-r--r--include/input_state.h49
-rw-r--r--include/key_state.h18
-rw-r--r--include/layout.h2
4 files changed, 53 insertions, 20 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
5enum movement_direction { 3enum 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
9typedef uint32_t keycode;
10
11// returns true if key has been pressed, otherwise false
12bool check_key(keycode key);
13
14// sets a key as pressed
15void press_key(keycode key);
16
17// unsets a key as pressed
18void release_key(keycode key);
19
20/* Pointer state */
21
22enum 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
30extern 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
45void start_floating(swayc_t *view);
46void reset_floating(swayc_t *view);
47
48#endif
49
diff --git a/include/key_state.h b/include/key_state.h
deleted file mode 100644
index a8fa8d5e..00000000
--- a/include/key_state.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _SWAY_KEY_STATE_H
2#define _SWAY_KEY_STATE_H
3#include <stdbool.h>
4#include <stdint.h>
5
6typedef uint32_t keycode;
7
8// returns true if key has been pressed, otherwise false
9bool check_key(keycode key);
10
11// sets a key as pressed
12void press_key(keycode key);
13
14// unsets a key as pressed
15void release_key(keycode key);
16
17#endif
18
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
8extern swayc_t root_container; 9extern swayc_t root_container;
9 10
@@ -26,5 +27,6 @@ void focus_view_for(swayc_t *ancestor, swayc_t *container);
26 27
27swayc_t *get_focused_container(swayc_t *parent); 28swayc_t *get_focused_container(swayc_t *parent);
28swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent); 29swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent);
30swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir);
29 31
30#endif 32#endif