summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sway/input/seat.h20
-rw-r--r--include/sway/output.h14
-rw-r--r--include/sway/tree/container.h19
-rw-r--r--include/sway/tree/layout.h2
-rw-r--r--include/sway/tree/root.h15
-rw-r--r--include/sway/tree/workspace.h13
6 files changed, 57 insertions, 26 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index 9dfb0714..5c404ecd 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -35,6 +35,14 @@ struct sway_drag_icon {
35 struct wl_listener destroy; 35 struct wl_listener destroy;
36}; 36};
37 37
38enum sway_seat_operation {
39 OP_NONE,
40 OP_DOWN,
41 OP_MOVE,
42 OP_RESIZE_FLOATING,
43 OP_RESIZE_TILING,
44};
45
38struct sway_seat { 46struct sway_seat {
39 struct wlr_seat *wlr_seat; 47 struct wlr_seat *wlr_seat;
40 struct sway_cursor *cursor; 48 struct sway_cursor *cursor;
@@ -54,13 +62,7 @@ struct sway_seat {
54 double touch_x, touch_y; 62 double touch_x, touch_y;
55 63
56 // Operations (drag and resize) 64 // Operations (drag and resize)
57 enum { 65 enum sway_seat_operation operation;
58 OP_NONE,
59 OP_MOVE,
60 OP_RESIZE_FLOATING,
61 OP_RESIZE_TILING,
62 } operation;
63
64 struct sway_container *op_container; 66 struct sway_container *op_container;
65 enum wlr_edges op_resize_edge; 67 enum wlr_edges op_resize_edge;
66 uint32_t op_button; 68 uint32_t op_button;
@@ -68,6 +70,7 @@ struct sway_seat {
68 double op_ref_lx, op_ref_ly; // cursor's x/y at start of op 70 double op_ref_lx, op_ref_ly; // cursor's x/y at start of op
69 double op_ref_width, op_ref_height; // container's size at start of op 71 double op_ref_width, op_ref_height; // container's size at start of op
70 double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op 72 double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op
73 bool op_moved; // if the mouse moved during a down op
71 74
72 uint32_t last_button; 75 uint32_t last_button;
73 uint32_t last_button_serial; 76 uint32_t last_button_serial;
@@ -157,6 +160,9 @@ bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
157 160
158void drag_icon_update_position(struct sway_drag_icon *icon); 161void drag_icon_update_position(struct sway_drag_icon *icon);
159 162
163void seat_begin_down(struct sway_seat *seat, struct sway_container *con,
164 uint32_t button, double sx, double sy);
165
160void seat_begin_move(struct sway_seat *seat, struct sway_container *con, 166void seat_begin_move(struct sway_seat *seat, struct sway_container *con,
161 uint32_t button); 167 uint32_t button);
162 168
diff --git a/include/sway/output.h b/include/sway/output.h
index 80dcd37b..d0d034b3 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -58,6 +58,8 @@ void output_damage_whole_container(struct sway_output *output,
58 58
59struct sway_container *output_by_name(const char *name); 59struct sway_container *output_by_name(const char *name);
60 60
61void output_sort_workspaces(struct sway_container *output);
62
61void output_enable(struct sway_output *output); 63void output_enable(struct sway_output *output);
62 64
63bool output_has_opaque_overlay_layer_surface(struct sway_output *output); 65bool output_has_opaque_overlay_layer_surface(struct sway_output *output);
@@ -93,4 +95,16 @@ void output_drag_icons_for_each_surface(struct sway_output *output,
93 struct wl_list *drag_icons, sway_surface_iterator_func_t iterator, 95 struct wl_list *drag_icons, sway_surface_iterator_func_t iterator,
94 void *user_data); 96 void *user_data);
95 97
98void output_for_each_workspace(struct sway_container *output,
99 void (*f)(struct sway_container *con, void *data), void *data);
100
101void output_for_each_container(struct sway_container *output,
102 void (*f)(struct sway_container *con, void *data), void *data);
103
104struct sway_container *output_find_workspace(struct sway_container *output,
105 bool (*test)(struct sway_container *con, void *data), void *data);
106
107struct sway_container *output_find_container(struct sway_container *output,
108 bool (*test)(struct sway_container *con, void *data), void *data);
109
96#endif 110#endif
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index fdcc31ec..c8410801 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -214,15 +214,11 @@ struct sway_container *container_destroy(struct sway_container *container);
214 214
215struct sway_container *container_close(struct sway_container *container); 215struct sway_container *container_close(struct sway_container *container);
216 216
217void container_descendants(struct sway_container *root,
218 enum sway_container_type type,
219 void (*func)(struct sway_container *item, void *data), void *data);
220
221/** 217/**
222 * Search a container's descendants a container based on test criteria. Returns 218 * Search a container's descendants a container based on test criteria. Returns
223 * the first container that passes the test. 219 * the first container that passes the test.
224 */ 220 */
225struct sway_container *container_find(struct sway_container *container, 221struct sway_container *container_find_child(struct sway_container *container,
226 bool (*test)(struct sway_container *view, void *data), void *data); 222 bool (*test)(struct sway_container *view, void *data), void *data);
227 223
228/** 224/**
@@ -244,10 +240,7 @@ struct sway_container *tiling_container_at(
244 struct sway_container *con, double lx, double ly, 240 struct sway_container *con, double lx, double ly,
245 struct wlr_surface **surface, double *sx, double *sy); 241 struct wlr_surface **surface, double *sx, double *sy);
246 242
247/** 243void container_for_each_child(struct sway_container *container,
248 * Apply the function for each child of the container depth first.
249 */
250void container_for_each_descendant(struct sway_container *container,
251 void (*f)(struct sway_container *container, void *data), void *data); 244 void (*f)(struct sway_container *container, void *data), void *data);
252 245
253/** 246/**
@@ -361,12 +354,4 @@ bool container_is_floating_or_child(struct sway_container *container);
361 */ 354 */
362bool container_is_fullscreen_or_child(struct sway_container *container); 355bool container_is_fullscreen_or_child(struct sway_container *container);
363 356
364/**
365 * Wrap the children of parent in a new container. The new container will be the
366 * only child of parent.
367 *
368 * The new container is returned.
369 */
370struct sway_container *container_wrap_children(struct sway_container *parent);
371
372#endif 357#endif
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h
index 77cd954b..5b803dfe 100644
--- a/include/sway/tree/layout.h
+++ b/include/sway/tree/layout.h
@@ -45,8 +45,6 @@ void container_move(struct sway_container *container,
45enum sway_container_layout container_get_default_layout( 45enum sway_container_layout container_get_default_layout(
46 struct sway_container *con); 46 struct sway_container *con);
47 47
48void container_sort_workspaces(struct sway_container *output);
49
50struct sway_container *container_get_in_direction(struct sway_container 48struct sway_container *container_get_in_direction(struct sway_container
51 *container, struct sway_seat *seat, enum movement_direction dir); 49 *container, struct sway_seat *seat, enum movement_direction dir);
52 50
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h
index edb7c817..d1f04a96 100644
--- a/include/sway/tree/root.h
+++ b/include/sway/tree/root.h
@@ -58,4 +58,19 @@ struct sway_container *root_workspace_for_pid(pid_t pid);
58 58
59void root_record_workspace_pid(pid_t pid); 59void root_record_workspace_pid(pid_t pid);
60 60
61void root_for_each_workspace(void (*f)(struct sway_container *con, void *data),
62 void *data);
63
64void root_for_each_container(void (*f)(struct sway_container *con, void *data),
65 void *data);
66
67struct sway_container *root_find_output(
68 bool (*test)(struct sway_container *con, void *data), void *data);
69
70struct sway_container *root_find_workspace(
71 bool (*test)(struct sway_container *con, void *data), void *data);
72
73struct sway_container *root_find_container(
74 bool (*test)(struct sway_container *con, void *data), void *data);
75
61#endif 76#endif
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h
index 056f2329..c9dbb538 100644
--- a/include/sway/tree/workspace.h
+++ b/include/sway/tree/workspace.h
@@ -50,4 +50,17 @@ struct sway_container *workspace_output_get_highest_available(
50 50
51void workspace_detect_urgent(struct sway_container *workspace); 51void workspace_detect_urgent(struct sway_container *workspace);
52 52
53void workspace_for_each_container(struct sway_container *ws,
54 void (*f)(struct sway_container *con, void *data), void *data);
55
56struct sway_container *workspace_find_container(struct sway_container *ws,
57 bool (*test)(struct sway_container *con, void *data), void *data);
58
59/**
60 * Wrap the workspace's tiling children in a new container.
61 * The new container will be the only direct tiling child of the workspace.
62 * The new container is returned.
63 */
64struct sway_container *workspace_wrap_children(struct sway_container *ws);
65
53#endif 66#endif