aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
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);
// unsets a key as pressed
void release_key(uint32_t key_sym, uint32_t key_code);
+
/* Pointer state */
enum pointer_values {
@@ -25,34 +26,55 @@ enum pointer_values {
M_SCROLL_DOWN = 276,
};
+enum pointer_mode {
+ // Target
+ M_FLOATING = 1,
+ M_TILING = 2,
+ // Action
+ M_DRAGGING = 4,
+ M_RESIZING = 8,
+};
+
+struct pointer_button_state {
+ bool held;
+ // state at the point it was pressed
+ int x, y;
+ swayc_t *view;
+};
+
extern struct pointer_state {
- bool l_held;
- bool r_held;
- struct pointer_floating {
- bool drag;
- bool resize;
- } floating;
- struct pointer_tiling {
- bool resize;
- swayc_t *init_view;
- struct wlc_origin lock_pos;
- } tiling;
- struct pointer_lock {
- // Lock movement for certain edges
- bool left;
- bool right;
- bool top;
- bool bottom;
- // Lock movement in certain directions
- bool temp_left;
- bool temp_right;
- bool temp_up;
- bool temp_down;
- } lock;
+ // mouse clicks
+ struct pointer_button_state left;
+ struct pointer_button_state right;
+ struct pointer_button_state scroll;
+
+ // pointer position
+ struct mouse_origin{
+ int x, y;
+ } origin;
+
+ // change in pointer position
+ struct {
+ int x, y;
+ } delta;
+
+ // view pointer is currently over
+ swayc_t *view;
+
+ // Pointer mode
+ int mode;
} pointer_state;
-void start_floating(swayc_t *view);
-void reset_floating(swayc_t *view);
+// 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 input_init(void);
#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);
swayc_t *add_sibling(swayc_t *sibling, swayc_t *child);
swayc_t *replace_child(swayc_t *child, swayc_t *new_child);
swayc_t *remove_child(swayc_t *child);
+void swap_container(swayc_t *a, swayc_t *b);
void move_container(swayc_t* container,swayc_t* root,enum movement_direction direction);
// Layout
+void update_geometry(swayc_t *view);
void arrange_windows(swayc_t *container, double width, double height);
swayc_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 @@
#ifndef _SWAY_RESIZE_H
#define _SWAY_RESIZE_H
+#include <stdbool.h>
-bool mouse_resize_tiled(struct wlc_origin prev_pos);
-bool resize_floating(struct wlc_origin prev_pos);
bool resize_tiled(int amount, bool use_width);
#endif