diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/input/seat.h | 20 | ||||
-rw-r--r-- | include/sway/output.h | 14 | ||||
-rw-r--r-- | include/sway/tree/container.h | 19 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 2 | ||||
-rw-r--r-- | include/sway/tree/root.h | 15 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 13 |
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 | ||
38 | enum sway_seat_operation { | ||
39 | OP_NONE, | ||
40 | OP_DOWN, | ||
41 | OP_MOVE, | ||
42 | OP_RESIZE_FLOATING, | ||
43 | OP_RESIZE_TILING, | ||
44 | }; | ||
45 | |||
38 | struct sway_seat { | 46 | struct 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 | ||
158 | void drag_icon_update_position(struct sway_drag_icon *icon); | 161 | void drag_icon_update_position(struct sway_drag_icon *icon); |
159 | 162 | ||
163 | void seat_begin_down(struct sway_seat *seat, struct sway_container *con, | ||
164 | uint32_t button, double sx, double sy); | ||
165 | |||
160 | void seat_begin_move(struct sway_seat *seat, struct sway_container *con, | 166 | void 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 | ||
59 | struct sway_container *output_by_name(const char *name); | 59 | struct sway_container *output_by_name(const char *name); |
60 | 60 | ||
61 | void output_sort_workspaces(struct sway_container *output); | ||
62 | |||
61 | void output_enable(struct sway_output *output); | 63 | void output_enable(struct sway_output *output); |
62 | 64 | ||
63 | bool output_has_opaque_overlay_layer_surface(struct sway_output *output); | 65 | bool 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 | ||
98 | void output_for_each_workspace(struct sway_container *output, | ||
99 | void (*f)(struct sway_container *con, void *data), void *data); | ||
100 | |||
101 | void output_for_each_container(struct sway_container *output, | ||
102 | void (*f)(struct sway_container *con, void *data), void *data); | ||
103 | |||
104 | struct sway_container *output_find_workspace(struct sway_container *output, | ||
105 | bool (*test)(struct sway_container *con, void *data), void *data); | ||
106 | |||
107 | struct 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 | ||
215 | struct sway_container *container_close(struct sway_container *container); | 215 | struct sway_container *container_close(struct sway_container *container); |
216 | 216 | ||
217 | void 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 | */ |
225 | struct sway_container *container_find(struct sway_container *container, | 221 | struct 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 | /** | 243 | void container_for_each_child(struct sway_container *container, |
248 | * Apply the function for each child of the container depth first. | ||
249 | */ | ||
250 | void 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 | */ |
362 | bool container_is_fullscreen_or_child(struct sway_container *container); | 355 | bool 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 | */ | ||
370 | struct 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, | |||
45 | enum sway_container_layout container_get_default_layout( | 45 | enum sway_container_layout container_get_default_layout( |
46 | struct sway_container *con); | 46 | struct sway_container *con); |
47 | 47 | ||
48 | void container_sort_workspaces(struct sway_container *output); | ||
49 | |||
50 | struct sway_container *container_get_in_direction(struct sway_container | 48 | struct 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 | ||
59 | void root_record_workspace_pid(pid_t pid); | 59 | void root_record_workspace_pid(pid_t pid); |
60 | 60 | ||
61 | void root_for_each_workspace(void (*f)(struct sway_container *con, void *data), | ||
62 | void *data); | ||
63 | |||
64 | void root_for_each_container(void (*f)(struct sway_container *con, void *data), | ||
65 | void *data); | ||
66 | |||
67 | struct sway_container *root_find_output( | ||
68 | bool (*test)(struct sway_container *con, void *data), void *data); | ||
69 | |||
70 | struct sway_container *root_find_workspace( | ||
71 | bool (*test)(struct sway_container *con, void *data), void *data); | ||
72 | |||
73 | struct 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 | ||
51 | void workspace_detect_urgent(struct sway_container *workspace); | 51 | void workspace_detect_urgent(struct sway_container *workspace); |
52 | 52 | ||
53 | void workspace_for_each_container(struct sway_container *ws, | ||
54 | void (*f)(struct sway_container *con, void *data), void *data); | ||
55 | |||
56 | struct 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 | */ | ||
64 | struct sway_container *workspace_wrap_children(struct sway_container *ws); | ||
65 | |||
53 | #endif | 66 | #endif |