aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/input_state.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/input_state.h')
-rw-r--r--include/sway/input_state.h102
1 files changed, 0 insertions, 102 deletions
diff --git a/include/sway/input_state.h b/include/sway/input_state.h
deleted file mode 100644
index fd5a3a25..00000000
--- a/include/sway/input_state.h
+++ /dev/null
@@ -1,102 +0,0 @@
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// returns true if key has been pressed, otherwise false
10bool check_key(uint32_t key_sym, uint32_t key_code);
11
12// returns true if key_sym matches latest released key.
13bool check_released_key(uint32_t key_sym);
14
15// sets a key as pressed
16void press_key(uint32_t key_sym, uint32_t key_code);
17
18// unsets a key as pressed
19void release_key(uint32_t key_sym, uint32_t key_code);
20
21
22/* Pointer state */
23
24enum pointer_values {
25 M_LEFT_CLICK = 272,
26 M_RIGHT_CLICK = 273,
27 M_SCROLL_CLICK = 274,
28 M_SCROLL_UP = 275,
29 M_SCROLL_DOWN = 276,
30};
31
32enum pointer_mode {
33 // Target
34 M_FLOATING = 1,
35 M_TILING = 2,
36 // Action
37 M_DRAGGING = 4,
38 M_RESIZING = 8,
39};
40
41struct pointer_button_state {
42 bool held;
43 // state at the point it was pressed
44 int x, y;
45 swayc_t *view;
46};
47
48extern struct pointer_state {
49 // mouse clicks
50 struct pointer_button_state left;
51 struct pointer_button_state right;
52 struct pointer_button_state scroll;
53
54 // change in pointer position
55 struct {
56 int x, y;
57 } delta;
58
59 // view pointer is currently over
60 swayc_t *view;
61
62 // Pointer mode
63 int mode;
64} pointer_state;
65
66enum modifier_state {
67 MOD_STATE_UNCHANGED = 0,
68 MOD_STATE_PRESSED = 1,
69 MOD_STATE_RELEASED = 2
70};
71
72void pointer_position_set(double new_x, double new_y, bool force_focus);
73void center_pointer_on(swayc_t *view);
74
75// on button release unset mode depending on the button.
76// on button press set mode conditionally depending on the button
77void pointer_mode_set(uint32_t button, bool condition);
78
79// Update mode in mouse motion
80void pointer_mode_update(void);
81
82// Reset mode on any keypress;
83void pointer_mode_reset(void);
84
85void input_init(void);
86
87/**
88 * Check if state of mod changed from current state to new_state.
89 *
90 * Returns MOD_STATE_UNCHANGED if the state didn't change, MOD_STATE_PRESSED if
91 * the state changed to pressed and MOD_STATE_RELEASED if the state changed to
92 * released.
93 */
94uint32_t modifier_state_changed(uint32_t new_state, uint32_t mod);
95
96/**
97 * Update the current modifiers state to new_state.
98 */
99void modifiers_state_update(uint32_t new_state);
100
101#endif
102