aboutsummaryrefslogtreecommitdiff
path: root/include/input_state.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/input_state.h')
-rw-r--r--include/input_state.h46
1 files changed, 44 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);
// unsets a key as pressed
void release_key(keycode key);
+
/* Pointer state */
enum pointer_values {
@@ -27,9 +28,40 @@ enum pointer_values {
M_SCROLL_DOWN = 276,
};
+enum pointer_mode {
+ // Target
+ M_FLOATING = 1 << 0,
+ M_TILING = 1 << 1,
+ // Action
+ M_DRAGGING = 1 << 2,
+ M_RESIZING = 1 << 3,
+};
+
extern struct pointer_state {
- bool l_held;
- bool r_held;
+ // mouse clicks
+ bool l_held : 1;
+ bool r_held : 1;
+
+ // scroll wheel
+ bool s_held : 1;
+ bool s_up : 1;
+ bool s_down :1;
+
+ // pointer position
+ struct mouse_origin{
+ int x, y;
+ } origin;
+ struct {
+ int x, y;
+ } delta;
+
+ // view pointer is over
+ swayc_t *view;
+
+ // Pointer mode
+ int mode;
+
+ // OLD
struct pointer_floating {
bool drag;
bool resize;
@@ -53,6 +85,16 @@ extern struct pointer_state {
} lock;
} pointer_state;
+// on button release unset mode depending on the button.
+// on button press set mode conditionally depending on the button
+void pointer_mode_set(uint32_t button, bool condition);
+
+// Update mode in mouse motion
+void pointer_mode_update(void);
+
+// Reset mode on any keypress;
+void pointer_mode_reset(void);
+
void start_floating(swayc_t *view);
void reset_floating(swayc_t *view);
void input_init(void);