summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sway/commands.h1
-rw-r--r--include/sway/criteria.h9
-rw-r--r--include/sway/debug.h23
-rw-r--r--include/sway/desktop.h5
-rw-r--r--include/sway/input/seat.h23
-rw-r--r--include/sway/output.h14
-rw-r--r--include/sway/server.h3
-rw-r--r--include/sway/tree/container.h33
-rw-r--r--include/sway/tree/layout.h12
-rw-r--r--include/sway/tree/root.h15
-rw-r--r--include/sway/tree/view.h11
-rw-r--r--include/sway/tree/workspace.h18
-rw-r--r--include/swaynag/swaynag.h2
13 files changed, 112 insertions, 57 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 545b21e6..8e91c158 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -136,6 +136,7 @@ sway_cmd cmd_mark;
136sway_cmd cmd_mode; 136sway_cmd cmd_mode;
137sway_cmd cmd_mouse_warping; 137sway_cmd cmd_mouse_warping;
138sway_cmd cmd_move; 138sway_cmd cmd_move;
139sway_cmd cmd_nop;
139sway_cmd cmd_opacity; 140sway_cmd cmd_opacity;
140sway_cmd cmd_new_float; 141sway_cmd cmd_new_float;
141sway_cmd cmd_new_window; 142sway_cmd cmd_new_window;
diff --git a/include/sway/criteria.h b/include/sway/criteria.h
index b4ff7d49..7a1e547b 100644
--- a/include/sway/criteria.h
+++ b/include/sway/criteria.h
@@ -7,10 +7,11 @@
7#include "tree/view.h" 7#include "tree/view.h"
8 8
9enum criteria_type { 9enum criteria_type {
10 CT_COMMAND = 1 << 0, 10 CT_COMMAND = 1 << 0,
11 CT_ASSIGN_OUTPUT = 1 << 1, 11 CT_ASSIGN_OUTPUT = 1 << 1,
12 CT_ASSIGN_WORKSPACE = 1 << 2, 12 CT_ASSIGN_WORKSPACE = 1 << 2,
13 CT_NO_FOCUS = 1 << 3, 13 CT_ASSIGN_WORKSPACE_NUMBER = 1 << 3,
14 CT_NO_FOCUS = 1 << 4,
14}; 15};
15 16
16struct criteria { 17struct criteria {
diff --git a/include/sway/debug.h b/include/sway/debug.h
index 38d4eccd..bf3a5f6d 100644
--- a/include/sway/debug.h
+++ b/include/sway/debug.h
@@ -1,15 +1,22 @@
1#ifndef SWAY_DEBUG_H 1#ifndef SWAY_DEBUG_H
2#define SWAY_DEBUG_H 2#define SWAY_DEBUG_H
3#include <stdbool.h>
3 4
4// Tree 5struct sway_debug {
5extern bool enable_debug_tree; 6 bool noatomic; // Ignore atomic layout updates
6void update_debug_tree(); 7 bool render_tree; // Render the tree overlay
8 bool txn_timings; // Log verbose messages about transactions
9 bool txn_wait; // Always wait for the timeout before applying
10
11 enum {
12 DAMAGE_DEFAULT, // Default behaviour
13 DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged
14 DAMAGE_RERENDER, // Render the full output when any damage occurs
15 } damage;
16};
7 17
8// Damage 18extern struct sway_debug debug;
9extern const char *damage_debug;
10 19
11// Transactions 20void update_debug_tree();
12extern int txn_timeout_ms;
13extern bool txn_debug;
14 21
15#endif 22#endif
diff --git a/include/sway/desktop.h b/include/sway/desktop.h
index 348fb187..c969a76b 100644
--- a/include/sway/desktop.h
+++ b/include/sway/desktop.h
@@ -1,8 +1,13 @@
1#include <wlr/types/wlr_surface.h> 1#include <wlr/types/wlr_surface.h>
2 2
3struct sway_container; 3struct sway_container;
4struct sway_view;
4 5
5void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, 6void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
6 bool whole); 7 bool whole);
7 8
8void desktop_damage_whole_container(struct sway_container *con); 9void desktop_damage_whole_container(struct sway_container *con);
10
11void desktop_damage_box(struct wlr_box *box);
12
13void desktop_damage_view(struct sway_view *view);
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index eb4202f3..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
@@ -166,6 +172,9 @@ void seat_begin_resize_floating(struct sway_seat *seat,
166void seat_begin_resize_tiling(struct sway_seat *seat, 172void seat_begin_resize_tiling(struct sway_seat *seat,
167 struct sway_container *con, uint32_t button, enum wlr_edges edge); 173 struct sway_container *con, uint32_t button, enum wlr_edges edge);
168 174
175struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
176 struct sway_container *container);
177
169void seat_end_mouse_operation(struct sway_seat *seat); 178void seat_end_mouse_operation(struct sway_seat *seat);
170 179
171void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, 180void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
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/server.h b/include/sway/server.h
index b93584b6..1e20f2c8 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -54,8 +54,7 @@ struct sway_server {
54 struct wl_listener server_decoration; 54 struct wl_listener server_decoration;
55 struct wl_list decorations; // sway_server_decoration::link 55 struct wl_list decorations; // sway_server_decoration::link
56 56
57 bool debug_txn_timings; 57 size_t txn_timeout_ms;
58
59 list_t *transactions; 58 list_t *transactions;
60 list_t *dirty_containers; 59 list_t *dirty_containers;
61}; 60};
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index b64a2e63..cd886cd0 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -40,7 +40,6 @@ enum sway_container_layout {
40 L_VERT, 40 L_VERT,
41 L_STACKED, 41 L_STACKED,
42 L_TABBED, 42 L_TABBED,
43 L_FLOATING,
44}; 43};
45 44
46enum sway_container_border { 45enum sway_container_border {
@@ -83,10 +82,11 @@ struct sway_container_state {
83 bool border_bottom; 82 bool border_bottom;
84 bool border_left; 83 bool border_left;
85 bool border_right; 84 bool border_right;
85 bool using_csd;
86 86
87 // Workspace properties 87 // Workspace properties
88 struct sway_container *ws_fullscreen; 88 struct sway_container *ws_fullscreen;
89 struct sway_container *ws_floating; 89 list_t *ws_floating;
90}; 90};
91 91
92struct sway_container { 92struct sway_container {
@@ -138,6 +138,9 @@ struct sway_container {
138 138
139 struct sway_container *parent; 139 struct sway_container *parent;
140 140
141 // Outputs currently being intersected
142 list_t *outputs; // struct sway_output
143
141 // Indicates that the container is a scratchpad container. 144 // Indicates that the container is a scratchpad container.
142 // Both hidden and visible scratchpad containers have scratchpad=true. 145 // Both hidden and visible scratchpad containers have scratchpad=true.
143 // Hidden scratchpad containers have a NULL parent. 146 // Hidden scratchpad containers have a NULL parent.
@@ -166,12 +169,7 @@ struct sway_container {
166 169
167 struct { 170 struct {
168 struct wl_signal destroy; 171 struct wl_signal destroy;
169 // Raised after the tree updates, but before arrange_windows
170 // Passed the previous parent
171 struct wl_signal reparent;
172 } events; 172 } events;
173
174 struct wl_listener reparent;
175}; 173};
176 174
177struct sway_container *container_create(enum sway_container_type type); 175struct sway_container *container_create(enum sway_container_type type);
@@ -213,15 +211,11 @@ struct sway_container *container_destroy(struct sway_container *container);
213 211
214struct sway_container *container_close(struct sway_container *container); 212struct sway_container *container_close(struct sway_container *container);
215 213
216void container_descendants(struct sway_container *root,
217 enum sway_container_type type,
218 void (*func)(struct sway_container *item, void *data), void *data);
219
220/** 214/**
221 * Search a container's descendants a container based on test criteria. Returns 215 * Search a container's descendants a container based on test criteria. Returns
222 * the first container that passes the test. 216 * the first container that passes the test.
223 */ 217 */
224struct sway_container *container_find(struct sway_container *container, 218struct sway_container *container_find_child(struct sway_container *container,
225 bool (*test)(struct sway_container *view, void *data), void *data); 219 bool (*test)(struct sway_container *view, void *data), void *data);
226 220
227/** 221/**
@@ -243,10 +237,7 @@ struct sway_container *tiling_container_at(
243 struct sway_container *con, double lx, double ly, 237 struct sway_container *con, double lx, double ly,
244 struct wlr_surface **surface, double *sx, double *sy); 238 struct wlr_surface **surface, double *sx, double *sy);
245 239
246/** 240void container_for_each_child(struct sway_container *container,
247 * Apply the function for each child of the container depth first.
248 */
249void container_for_each_descendant(struct sway_container *container,
250 void (*f)(struct sway_container *container, void *data), void *data); 241 void (*f)(struct sway_container *container, void *data), void *data);
251 242
252/** 243/**
@@ -361,11 +352,11 @@ bool container_is_floating_or_child(struct sway_container *container);
361bool container_is_fullscreen_or_child(struct sway_container *container); 352bool container_is_fullscreen_or_child(struct sway_container *container);
362 353
363/** 354/**
364 * Wrap the children of parent in a new container. The new container will be the 355 * Return the output which will be used for scale purposes.
365 * only child of parent. 356 * This is the most recently entered output.
366 *
367 * The new container is returned.
368 */ 357 */
369struct sway_container *container_wrap_children(struct sway_container *parent); 358struct sway_output *container_get_effective_output(struct sway_container *con);
359
360void container_discover_outputs(struct sway_container *con);
370 361
371#endif 362#endif
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h
index 77cd954b..519189d9 100644
--- a/include/sway/tree/layout.h
+++ b/include/sway/tree/layout.h
@@ -15,13 +15,7 @@ enum movement_direction {
15 MOVE_CHILD, 15 MOVE_CHILD,
16}; 16};
17 17
18enum resize_edge { 18enum wlr_edges;
19 RESIZE_EDGE_NONE = 0,
20 RESIZE_EDGE_LEFT = 1,
21 RESIZE_EDGE_RIGHT = 2,
22 RESIZE_EDGE_TOP = 4,
23 RESIZE_EDGE_BOTTOM = 8,
24};
25 19
26struct sway_container; 20struct sway_container;
27 21
@@ -45,8 +39,6 @@ void container_move(struct sway_container *container,
45enum sway_container_layout container_get_default_layout( 39enum sway_container_layout container_get_default_layout(
46 struct sway_container *con); 40 struct sway_container *con);
47 41
48void container_sort_workspaces(struct sway_container *output);
49
50struct sway_container *container_get_in_direction(struct sway_container 42struct sway_container *container_get_in_direction(struct sway_container
51 *container, struct sway_seat *seat, enum movement_direction dir); 43 *container, struct sway_seat *seat, enum movement_direction dir);
52 44
@@ -54,7 +46,7 @@ struct sway_container *container_split(struct sway_container *child,
54 enum sway_container_layout layout); 46 enum sway_container_layout layout);
55 47
56void container_recursive_resize(struct sway_container *container, 48void container_recursive_resize(struct sway_container *container,
57 double amount, enum resize_edge edge); 49 double amount, enum wlr_edges edge);
58 50
59void container_swap(struct sway_container *con1, struct sway_container *con2); 51void container_swap(struct sway_container *con1, struct sway_container *con2);
60 52
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/view.h b/include/sway/tree/view.h
index c2225bcb..5fdecc2b 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -88,6 +88,14 @@ struct sway_view {
88 struct wlr_buffer *saved_buffer; 88 struct wlr_buffer *saved_buffer;
89 int saved_buffer_width, saved_buffer_height; 89 int saved_buffer_width, saved_buffer_height;
90 90
91 // The geometry for whatever the client is committing, regardless of
92 // transaction state. Updated on every commit.
93 struct wlr_box geometry;
94
95 // The "old" geometry during a transaction. Used to damage the old location
96 // when a transaction is applied.
97 struct wlr_box saved_geometry;
98
91 bool destroying; 99 bool destroying;
92 100
93 list_t *executed_criteria; // struct criteria * 101 list_t *executed_criteria; // struct criteria *
@@ -112,7 +120,6 @@ struct sway_view {
112 } events; 120 } events;
113 121
114 struct wl_listener surface_new_subsurface; 122 struct wl_listener surface_new_subsurface;
115 struct wl_listener container_reparent;
116}; 123};
117 124
118struct sway_xdg_shell_v6_view { 125struct sway_xdg_shell_v6_view {
@@ -285,8 +292,6 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface);
285 292
286void view_unmap(struct sway_view *view); 293void view_unmap(struct sway_view *view);
287 294
288void view_update_position(struct sway_view *view, double lx, double ly);
289
290void view_update_size(struct sway_view *view, int width, int height); 295void view_update_size(struct sway_view *view, int width, int height);
291 296
292void view_child_init(struct sway_view_child *child, 297void view_child_init(struct sway_view_child *child,
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h
index 056f2329..35c91017 100644
--- a/include/sway/tree/workspace.h
+++ b/include/sway/tree/workspace.h
@@ -9,7 +9,7 @@ struct sway_view;
9struct sway_workspace { 9struct sway_workspace {
10 struct sway_container *swayc; 10 struct sway_container *swayc;
11 struct sway_container *fullscreen; 11 struct sway_container *fullscreen;
12 struct sway_container *floating; 12 list_t *floating; // struct sway_container
13 list_t *output_priority; 13 list_t *output_priority;
14 bool urgent; 14 bool urgent;
15}; 15};
@@ -50,4 +50,20 @@ 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
66void workspace_add_floating(struct sway_container *workspace,
67 struct sway_container *con);
68
53#endif 69#endif
diff --git a/include/swaynag/swaynag.h b/include/swaynag/swaynag.h
index 1bf8b640..a32d1503 100644
--- a/include/swaynag/swaynag.h
+++ b/include/swaynag/swaynag.h
@@ -58,7 +58,7 @@ struct swaynag_details {
58 int offset; 58 int offset;
59 int visible_lines; 59 int visible_lines;
60 int total_lines; 60 int total_lines;
61 struct swaynag_button button_details; 61 struct swaynag_button *button_details;
62 struct swaynag_button button_up; 62 struct swaynag_button button_up;
63 struct swaynag_button button_down; 63 struct swaynag_button button_down;
64}; 64};