aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-02-12 23:22:51 +0100
committerLibravatar Tudor Brindus <me@tbrindus.ca>2021-02-16 22:05:00 -0500
commita047b5ee4a2a67d30d93641ff86531d54b8e0879 (patch)
tree271666c6254e4fabf943c1153224059411a5ce56
parentAdd missing transaction commits to seatop_default (diff)
downloadsway-a047b5ee4.tar.gz
sway-a047b5ee4.tar.zst
sway-a047b5ee4.zip
container: Move pending state to state struct
Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
-rw-r--r--include/sway/tree/container.h39
-rw-r--r--sway/commands.c2
-rw-r--r--sway/commands/border.c8
-rw-r--r--sway/commands/floating.c8
-rw-r--r--sway/commands/focus.c26
-rw-r--r--sway/commands/fullscreen.c10
-rw-r--r--sway/commands/layout.c12
-rw-r--r--sway/commands/move.c148
-rw-r--r--sway/commands/resize.c112
-rw-r--r--sway/commands/scratchpad.c12
-rw-r--r--sway/commands/split.c2
-rw-r--r--sway/commands/sticky.c6
-rw-r--r--sway/commands/swap.c56
-rw-r--r--sway/criteria.c4
-rw-r--r--sway/desktop/render.c2
-rw-r--r--sway/desktop/transaction.c39
-rw-r--r--sway/desktop/xdg_shell.c6
-rw-r--r--sway/desktop/xwayland.c8
-rw-r--r--sway/input/cursor.c16
-rw-r--r--sway/input/seat.c20
-rw-r--r--sway/input/seatop_default.c32
-rw-r--r--sway/input/seatop_move_floating.c6
-rw-r--r--sway/input/seatop_move_tiling.c38
-rw-r--r--sway/input/seatop_resize_floating.c32
-rw-r--r--sway/input/seatop_resize_tiling.c24
-rw-r--r--sway/ipc-json.c44
-rw-r--r--sway/tree/arrange.c70
-rw-r--r--sway/tree/container.c408
-rw-r--r--sway/tree/node.c18
-rw-r--r--sway/tree/output.c14
-rw-r--r--sway/tree/root.c22
-rw-r--r--sway/tree/view.c208
-rw-r--r--sway/tree/workspace.c30
33 files changed, 724 insertions, 758 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 7e9df59f..ff3f9599 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -46,9 +46,9 @@ struct sway_container_state {
46 46
47 enum sway_fullscreen_mode fullscreen_mode; 47 enum sway_fullscreen_mode fullscreen_mode;
48 48
49 struct sway_workspace *workspace; 49 struct sway_workspace *workspace; // NULL when hidden in the scratchpad
50 struct sway_container *parent; 50 struct sway_container *parent; // NULL if container in root of workspace
51 list_t *children; 51 list_t *children; // struct sway_container
52 52
53 struct sway_container *focused_inactive_child; 53 struct sway_container *focused_inactive_child;
54 bool focused; 54 bool focused;
@@ -60,6 +60,7 @@ struct sway_container_state {
60 bool border_left; 60 bool border_left;
61 bool border_right; 61 bool border_right;
62 62
63 // These are in layout coordinates.
63 double content_x, content_y; 64 double content_x, content_y;
64 double content_width, content_height; 65 double content_width, content_height;
65}; 66};
@@ -68,14 +69,12 @@ struct sway_container {
68 struct sway_node node; 69 struct sway_node node;
69 struct sway_view *view; 70 struct sway_view *view;
70 71
71 // The pending state is the main container properties, and the current state is in the below struct.
72 // This means most places of the code can refer to the main variables (pending state) and it'll just work.
73 struct sway_container_state current; 72 struct sway_container_state current;
73 struct sway_container_state pending;
74 74
75 char *title; // The view's title (unformatted) 75 char *title; // The view's title (unformatted)
76 char *formatted_title; // The title displayed in the title bar 76 char *formatted_title; // The title displayed in the title bar
77 77
78 enum sway_container_layout layout;
79 enum sway_container_layout prev_split_layout; 78 enum sway_container_layout prev_split_layout;
80 79
81 // Whether stickiness has been enabled on this container. Use 80 // Whether stickiness has been enabled on this container. Use
@@ -86,11 +85,13 @@ struct sway_container {
86 // For C_ROOT, this has no meaning 85 // For C_ROOT, this has no meaning
87 // For other types, this is the position in layout coordinates 86 // For other types, this is the position in layout coordinates
88 // Includes borders 87 // Includes borders
89 double x, y;
90 double width, height;
91 double saved_x, saved_y; 88 double saved_x, saved_y;
92 double saved_width, saved_height; 89 double saved_width, saved_height;
93 90
91 // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD
92 // border which we use to restore when the view returns to SSD.
93 enum sway_container_border saved_border;
94
94 // The share of the space of parent container this container occupies 95 // The share of the space of parent container this container occupies
95 double width_fraction; 96 double width_fraction;
96 double height_fraction; 97 double height_fraction;
@@ -100,33 +101,11 @@ struct sway_container {
100 double child_total_width; 101 double child_total_width;
101 double child_total_height; 102 double child_total_height;
102 103
103 // These are in layout coordinates.
104 double content_x, content_y;
105 int content_width, content_height;
106
107 // In most cases this is the same as the content x and y, but if the view 104 // In most cases this is the same as the content x and y, but if the view
108 // refuses to resize to the content dimensions then it can be smaller. 105 // refuses to resize to the content dimensions then it can be smaller.
109 // These are in layout coordinates. 106 // These are in layout coordinates.
110 double surface_x, surface_y; 107 double surface_x, surface_y;
111 108
112 enum sway_fullscreen_mode fullscreen_mode;
113
114 enum sway_container_border border;
115
116 // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD
117 // border which we use to restore when the view returns to SSD.
118 enum sway_container_border saved_border;
119
120 int border_thickness;
121 bool border_top;
122 bool border_bottom;
123 bool border_left;
124 bool border_right;
125
126 struct sway_workspace *workspace; // NULL when hidden in the scratchpad
127 struct sway_container *parent; // NULL if container in root of workspace
128 list_t *children; // struct sway_container
129
130 // Outputs currently being intersected 109 // Outputs currently being intersected
131 list_t *outputs; // struct sway_output 110 list_t *outputs; // struct sway_output
132 111
diff --git a/sway/commands.c b/sway/commands.c
index 966b1fe3..ede6c60c 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -186,7 +186,7 @@ static void set_config_node(struct sway_node *node) {
186 switch (node->type) { 186 switch (node->type) {
187 case N_CONTAINER: 187 case N_CONTAINER:
188 config->handler_context.container = node->sway_container; 188 config->handler_context.container = node->sway_container;
189 config->handler_context.workspace = node->sway_container->workspace; 189 config->handler_context.workspace = node->sway_container->pending.workspace;
190 break; 190 break;
191 case N_WORKSPACE: 191 case N_WORKSPACE:
192 config->handler_context.workspace = node->sway_workspace; 192 config->handler_context.workspace = node->sway_workspace;
diff --git a/sway/commands/border.c b/sway/commands/border.c
index 647663ac..7818fc96 100644
--- a/sway/commands/border.c
+++ b/sway/commands/border.c
@@ -19,11 +19,11 @@ static void set_border(struct sway_container *con,
19 view_set_csd_from_server(con->view, false); 19 view_set_csd_from_server(con->view, false);
20 } else if (!con->view->using_csd && new_border == B_CSD) { 20 } else if (!con->view->using_csd && new_border == B_CSD) {
21 view_set_csd_from_server(con->view, true); 21 view_set_csd_from_server(con->view, true);
22 con->saved_border = con->border; 22 con->saved_border = con->pending.border;
23 } 23 }
24 } 24 }
25 if (new_border != B_CSD || container_is_floating(con)) { 25 if (new_border != B_CSD || container_is_floating(con)) {
26 con->border = new_border; 26 con->pending.border = new_border;
27 } 27 }
28 if (con->view) { 28 if (con->view) {
29 con->view->using_csd = new_border == B_CSD; 29 con->view->using_csd = new_border == B_CSD;
@@ -35,7 +35,7 @@ static void border_toggle(struct sway_container *con) {
35 set_border(con, B_NONE); 35 set_border(con, B_NONE);
36 return; 36 return;
37 } 37 }
38 switch (con->border) { 38 switch (con->pending.border) {
39 case B_NONE: 39 case B_NONE:
40 set_border(con, B_PIXEL); 40 set_border(con, B_PIXEL);
41 break; 41 break;
@@ -88,7 +88,7 @@ struct cmd_results *cmd_border(int argc, char **argv) {
88 "or 'border pixel <px>'"); 88 "or 'border pixel <px>'");
89 } 89 }
90 if (argc == 2) { 90 if (argc == 2) {
91 container->border_thickness = atoi(argv[1]); 91 container->pending.border_thickness = atoi(argv[1]);
92 } 92 }
93 93
94 if (container_is_floating(container)) { 94 if (container_is_floating(container)) {
diff --git a/sway/commands/floating.c b/sway/commands/floating.c
index ce123345..74f6522c 100644
--- a/sway/commands/floating.c
+++ b/sway/commands/floating.c
@@ -40,8 +40,8 @@ struct cmd_results *cmd_floating(int argc, char **argv) {
40 // If the container is in a floating split container, 40 // If the container is in a floating split container,
41 // operate on the split container instead of the child. 41 // operate on the split container instead of the child.
42 if (container_is_floating_or_child(container)) { 42 if (container_is_floating_or_child(container)) {
43 while (container->parent) { 43 while (container->pending.parent) {
44 container = container->parent; 44 container = container->pending.parent;
45 } 45 }
46 } 46 }
47 47
@@ -51,8 +51,8 @@ struct cmd_results *cmd_floating(int argc, char **argv) {
51 container_set_floating(container, wants_floating); 51 container_set_floating(container, wants_floating);
52 52
53 // Floating containers in the scratchpad should be ignored 53 // Floating containers in the scratchpad should be ignored
54 if (container->workspace) { 54 if (container->pending.workspace) {
55 arrange_workspace(container->workspace); 55 arrange_workspace(container->pending.workspace);
56 } 56 }
57 57
58 return cmd_results_new(CMD_SUCCESS, NULL); 58 return cmd_results_new(CMD_SUCCESS, NULL);
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 79b7aed5..6b4f57c1 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -141,9 +141,9 @@ static struct sway_node *node_get_in_direction_tiling(
141 struct sway_container *wrap_candidate = NULL; 141 struct sway_container *wrap_candidate = NULL;
142 struct sway_container *current = container; 142 struct sway_container *current = container;
143 while (current) { 143 while (current) {
144 if (current->fullscreen_mode == FULLSCREEN_WORKSPACE) { 144 if (current->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
145 // Fullscreen container with a direction - go straight to outputs 145 // Fullscreen container with a direction - go straight to outputs
146 struct sway_output *output = current->workspace->output; 146 struct sway_output *output = current->pending.workspace->output;
147 struct sway_output *new_output = 147 struct sway_output *new_output =
148 output_get_in_direction(output, dir); 148 output_get_in_direction(output, dir);
149 if (!new_output) { 149 if (!new_output) {
@@ -151,7 +151,7 @@ static struct sway_node *node_get_in_direction_tiling(
151 } 151 }
152 return get_node_in_output_direction(new_output, dir); 152 return get_node_in_output_direction(new_output, dir);
153 } 153 }
154 if (current->fullscreen_mode == FULLSCREEN_GLOBAL) { 154 if (current->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
155 return NULL; 155 return NULL;
156 } 156 }
157 157
@@ -202,11 +202,11 @@ static struct sway_node *node_get_in_direction_tiling(
202 } 202 }
203 } 203 }
204 204
205 current = current->parent; 205 current = current->pending.parent;
206 } 206 }
207 207
208 // Check a different output 208 // Check a different output
209 struct sway_output *output = container->workspace->output; 209 struct sway_output *output = container->pending.workspace->output;
210 struct sway_output *new_output = output_get_in_direction(output, dir); 210 struct sway_output *new_output = output_get_in_direction(output, dir);
211 if ((config->focus_wrapping != WRAP_WORKSPACE || 211 if ((config->focus_wrapping != WRAP_WORKSPACE ||
212 container->node.type == N_WORKSPACE) && new_output) { 212 container->node.type == N_WORKSPACE) && new_output) {
@@ -226,23 +226,23 @@ static struct sway_node *node_get_in_direction_tiling(
226static struct sway_node *node_get_in_direction_floating( 226static struct sway_node *node_get_in_direction_floating(
227 struct sway_container *con, struct sway_seat *seat, 227 struct sway_container *con, struct sway_seat *seat,
228 enum wlr_direction dir) { 228 enum wlr_direction dir) {
229 double ref_lx = con->x + con->width / 2; 229 double ref_lx = con->pending.x + con->pending.width / 2;
230 double ref_ly = con->y + con->height / 2; 230 double ref_ly = con->pending.y + con->pending.height / 2;
231 double closest_distance = DBL_MAX; 231 double closest_distance = DBL_MAX;
232 struct sway_container *closest_con = NULL; 232 struct sway_container *closest_con = NULL;
233 233
234 if (!con->workspace) { 234 if (!con->pending.workspace) {
235 return NULL; 235 return NULL;
236 } 236 }
237 237
238 for (int i = 0; i < con->workspace->floating->length; i++) { 238 for (int i = 0; i < con->pending.workspace->floating->length; i++) {
239 struct sway_container *floater = con->workspace->floating->items[i]; 239 struct sway_container *floater = con->pending.workspace->floating->items[i];
240 if (floater == con) { 240 if (floater == con) {
241 continue; 241 continue;
242 } 242 }
243 float distance = dir == WLR_DIRECTION_LEFT || dir == WLR_DIRECTION_RIGHT 243 float distance = dir == WLR_DIRECTION_LEFT || dir == WLR_DIRECTION_RIGHT
244 ? (floater->x + floater->width / 2) - ref_lx 244 ? (floater->pending.x + floater->pending.width / 2) - ref_lx
245 : (floater->y + floater->height / 2) - ref_ly; 245 : (floater->pending.y + floater->pending.height / 2) - ref_ly;
246 if (dir == WLR_DIRECTION_LEFT || dir == WLR_DIRECTION_UP) { 246 if (dir == WLR_DIRECTION_LEFT || dir == WLR_DIRECTION_UP) {
247 distance = -distance; 247 distance = -distance;
248 } 248 }
@@ -334,7 +334,7 @@ static struct cmd_results *focus_output(struct sway_seat *seat,
334static struct cmd_results *focus_parent(void) { 334static struct cmd_results *focus_parent(void) {
335 struct sway_seat *seat = config->handler_context.seat; 335 struct sway_seat *seat = config->handler_context.seat;
336 struct sway_container *con = config->handler_context.container; 336 struct sway_container *con = config->handler_context.container;
337 if (!con || con->fullscreen_mode) { 337 if (!con || con->pending.fullscreen_mode) {
338 return cmd_results_new(CMD_SUCCESS, NULL); 338 return cmd_results_new(CMD_SUCCESS, NULL);
339 } 339 }
340 struct sway_node *parent = node_get_parent(&con->node); 340 struct sway_node *parent = node_get_parent(&con->node);
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c
index 3392a7f7..a5d30d0e 100644
--- a/sway/commands/fullscreen.c
+++ b/sway/commands/fullscreen.c
@@ -27,15 +27,15 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) {
27 } 27 }
28 28
29 // If in the scratchpad, operate on the highest container 29 // If in the scratchpad, operate on the highest container
30 if (container && !container->workspace) { 30 if (container && !container->pending.workspace) {
31 while (container->parent) { 31 while (container->pending.parent) {
32 container = container->parent; 32 container = container->pending.parent;
33 } 33 }
34 } 34 }
35 35
36 bool is_fullscreen = false; 36 bool is_fullscreen = false;
37 for (struct sway_container *curr = container; curr; curr = curr->parent) { 37 for (struct sway_container *curr = container; curr; curr = curr->pending.parent) {
38 if (curr->fullscreen_mode != FULLSCREEN_NONE) { 38 if (curr->pending.fullscreen_mode != FULLSCREEN_NONE) {
39 container = curr; 39 container = curr;
40 is_fullscreen = true; 40 is_fullscreen = true;
41 break; 41 break;
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
index f2af183b..2ba61b38 100644
--- a/sway/commands/layout.c
+++ b/sway/commands/layout.c
@@ -133,7 +133,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
133 133
134 // Operate on parent container, like i3. 134 // Operate on parent container, like i3.
135 if (container) { 135 if (container) {
136 container = container->parent; 136 container = container->pending.parent;
137 } 137 }
138 138
139 // We could be working with a container OR a workspace. These are different 139 // We could be working with a container OR a workspace. These are different
@@ -142,10 +142,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
142 enum sway_container_layout new_layout = L_NONE; 142 enum sway_container_layout new_layout = L_NONE;
143 enum sway_container_layout old_layout = L_NONE; 143 enum sway_container_layout old_layout = L_NONE;
144 if (container) { 144 if (container) {
145 old_layout = container->layout; 145 old_layout = container->pending.layout;
146 new_layout = get_layout(argc, argv, 146 new_layout = get_layout(argc, argv,
147 container->layout, container->prev_split_layout, 147 container->pending.layout, container->prev_split_layout,
148 container->workspace->output); 148 container->pending.workspace->output);
149 } else { 149 } else {
150 old_layout = workspace->layout; 150 old_layout = workspace->layout;
151 new_layout = get_layout(argc, argv, 151 new_layout = get_layout(argc, argv,
@@ -160,13 +160,13 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
160 if (old_layout != L_TABBED && old_layout != L_STACKED) { 160 if (old_layout != L_TABBED && old_layout != L_STACKED) {
161 container->prev_split_layout = old_layout; 161 container->prev_split_layout = old_layout;
162 } 162 }
163 container->layout = new_layout; 163 container->pending.layout = new_layout;
164 container_update_representation(container); 164 container_update_representation(container);
165 } else if (config->handler_context.container) { 165 } else if (config->handler_context.container) {
166 // i3 avoids changing workspace layouts with a new container 166 // i3 avoids changing workspace layouts with a new container
167 // https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/con.c#L1817 167 // https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/con.c#L1817
168 container = workspace_wrap_children(workspace); 168 container = workspace_wrap_children(workspace);
169 container->layout = new_layout; 169 container->pending.layout = new_layout;
170 container_update_representation(container); 170 container_update_representation(container);
171 } else { 171 } else {
172 if (old_layout != L_TABBED && old_layout != L_STACKED) { 172 if (old_layout != L_TABBED && old_layout != L_STACKED) {
diff --git a/sway/commands/move.c b/sway/commands/move.c
index f8f89f18..f2702fa1 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -113,8 +113,8 @@ static void container_move_to_container_from_direction(
113 struct sway_container *container, struct sway_container *destination, 113 struct sway_container *container, struct sway_container *destination,
114 enum wlr_direction move_dir) { 114 enum wlr_direction move_dir) {
115 if (destination->view) { 115 if (destination->view) {
116 if (destination->parent == container->parent && 116 if (destination->pending.parent == container->pending.parent &&
117 destination->workspace == container->workspace) { 117 destination->pending.workspace == container->pending.workspace) {
118 sway_log(SWAY_DEBUG, "Swapping siblings"); 118 sway_log(SWAY_DEBUG, "Swapping siblings");
119 list_t *siblings = container_get_siblings(container); 119 list_t *siblings = container_get_siblings(container);
120 int container_index = list_find(siblings, container); 120 int container_index = list_find(siblings, container);
@@ -126,28 +126,28 @@ static void container_move_to_container_from_direction(
126 int offset = 126 int offset =
127 move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP; 127 move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP;
128 int index = container_sibling_index(destination) + offset; 128 int index = container_sibling_index(destination) + offset;
129 if (destination->parent) { 129 if (destination->pending.parent) {
130 container_insert_child(destination->parent, container, index); 130 container_insert_child(destination->pending.parent, container, index);
131 } else { 131 } else {
132 workspace_insert_tiling(destination->workspace, 132 workspace_insert_tiling(destination->pending.workspace,
133 container, index); 133 container, index);
134 } 134 }
135 container->width = container->height = 0; 135 container->pending.width = container->pending.height = 0;
136 container->width_fraction = container->height_fraction = 0; 136 container->width_fraction = container->height_fraction = 0;
137 workspace_squash(destination->workspace); 137 workspace_squash(destination->pending.workspace);
138 } 138 }
139 return; 139 return;
140 } 140 }
141 141
142 if (is_parallel(destination->layout, move_dir)) { 142 if (is_parallel(destination->pending.layout, move_dir)) {
143 sway_log(SWAY_DEBUG, "Reparenting container (parallel)"); 143 sway_log(SWAY_DEBUG, "Reparenting container (parallel)");
144 int index = 144 int index =
145 move_dir == WLR_DIRECTION_RIGHT || move_dir == WLR_DIRECTION_DOWN ? 145 move_dir == WLR_DIRECTION_RIGHT || move_dir == WLR_DIRECTION_DOWN ?
146 0 : destination->children->length; 146 0 : destination->pending.children->length;
147 container_insert_child(destination, container, index); 147 container_insert_child(destination, container, index);
148 container->width = container->height = 0; 148 container->pending.width = container->pending.height = 0;
149 container->width_fraction = container->height_fraction = 0; 149 container->width_fraction = container->height_fraction = 0;
150 workspace_squash(destination->workspace); 150 workspace_squash(destination->pending.workspace);
151 return; 151 return;
152 } 152 }
153 153
@@ -168,7 +168,7 @@ static void container_move_to_container_from_direction(
168static void container_move_to_workspace_from_direction( 168static void container_move_to_workspace_from_direction(
169 struct sway_container *container, struct sway_workspace *workspace, 169 struct sway_container *container, struct sway_workspace *workspace,
170 enum wlr_direction move_dir) { 170 enum wlr_direction move_dir) {
171 container->width = container->height = 0; 171 container->pending.width = container->pending.height = 0;
172 container->width_fraction = container->height_fraction = 0; 172 container->width_fraction = container->height_fraction = 0;
173 173
174 if (is_parallel(workspace->layout, move_dir)) { 174 if (is_parallel(workspace->layout, move_dir)) {
@@ -188,8 +188,8 @@ static void container_move_to_workspace_from_direction(
188 workspace_add_tiling(workspace, container); 188 workspace_add_tiling(workspace, container);
189 return; 189 return;
190 } 190 }
191 while (focus_inactive->parent) { 191 while (focus_inactive->pending.parent) {
192 focus_inactive = focus_inactive->parent; 192 focus_inactive = focus_inactive->pending.parent;
193 } 193 }
194 container_move_to_container_from_direction(container, focus_inactive, 194 container_move_to_container_from_direction(container, focus_inactive,
195 move_dir); 195 move_dir);
@@ -197,25 +197,25 @@ static void container_move_to_workspace_from_direction(
197 197
198static void container_move_to_workspace(struct sway_container *container, 198static void container_move_to_workspace(struct sway_container *container,
199 struct sway_workspace *workspace) { 199 struct sway_workspace *workspace) {
200 if (container->workspace == workspace) { 200 if (container->pending.workspace == workspace) {
201 return; 201 return;
202 } 202 }
203 struct sway_workspace *old_workspace = container->workspace; 203 struct sway_workspace *old_workspace = container->pending.workspace;
204 if (container_is_floating(container)) { 204 if (container_is_floating(container)) {
205 struct sway_output *old_output = container->workspace->output; 205 struct sway_output *old_output = container->pending.workspace->output;
206 container_detach(container); 206 container_detach(container);
207 workspace_add_floating(workspace, container); 207 workspace_add_floating(workspace, container);
208 container_handle_fullscreen_reparent(container); 208 container_handle_fullscreen_reparent(container);
209 // If changing output, center it within the workspace 209 // If changing output, center it within the workspace
210 if (old_output != workspace->output && !container->fullscreen_mode) { 210 if (old_output != workspace->output && !container->pending.fullscreen_mode) {
211 container_floating_move_to_center(container); 211 container_floating_move_to_center(container);
212 } 212 }
213 } else { 213 } else {
214 container_detach(container); 214 container_detach(container);
215 if (workspace_is_empty(workspace) && container->children) { 215 if (workspace_is_empty(workspace) && container->pending.children) {
216 workspace_unwrap_children(workspace, container); 216 workspace_unwrap_children(workspace, container);
217 } else { 217 } else {
218 container->width = container->height = 0; 218 container->pending.width = container->pending.height = 0;
219 container->width_fraction = container->height_fraction = 0; 219 container->width_fraction = container->height_fraction = 0;
220 workspace_add_tiling(workspace, container); 220 workspace_add_tiling(workspace, container);
221 } 221 }
@@ -237,13 +237,13 @@ static void container_move_to_container(struct sway_container *container,
237 return; 237 return;
238 } 238 }
239 if (container_is_floating(container)) { 239 if (container_is_floating(container)) {
240 container_move_to_workspace(container, destination->workspace); 240 container_move_to_workspace(container, destination->pending.workspace);
241 return; 241 return;
242 } 242 }
243 struct sway_workspace *old_workspace = container->workspace; 243 struct sway_workspace *old_workspace = container->pending.workspace;
244 244
245 container_detach(container); 245 container_detach(container);
246 container->width = container->height = 0; 246 container->pending.width = container->pending.height = 0;
247 container->width_fraction = container->height_fraction = 0; 247 container->width_fraction = container->height_fraction = 0;
248 248
249 if (destination->view) { 249 if (destination->view) {
@@ -256,12 +256,12 @@ static void container_move_to_container(struct sway_container *container,
256 ipc_event_window(container, "move"); 256 ipc_event_window(container, "move");
257 } 257 }
258 258
259 if (destination->workspace) { 259 if (destination->pending.workspace) {
260 workspace_focus_fullscreen(destination->workspace); 260 workspace_focus_fullscreen(destination->pending.workspace);
261 workspace_detect_urgent(destination->workspace); 261 workspace_detect_urgent(destination->pending.workspace);
262 } 262 }
263 263
264 if (old_workspace && old_workspace != destination->workspace) { 264 if (old_workspace && old_workspace != destination->pending.workspace) {
265 workspace_detect_urgent(old_workspace); 265 workspace_detect_urgent(old_workspace);
266 } 266 }
267} 267}
@@ -275,7 +275,7 @@ static bool container_move_to_next_output(struct sway_container *container,
275 if (!sway_assert(ws, "Expected output to have a workspace")) { 275 if (!sway_assert(ws, "Expected output to have a workspace")) {
276 return false; 276 return false;
277 } 277 }
278 switch (container->fullscreen_mode) { 278 switch (container->pending.fullscreen_mode) {
279 case FULLSCREEN_NONE: 279 case FULLSCREEN_NONE:
280 container_move_to_workspace_from_direction(container, ws, move_dir); 280 container_move_to_workspace_from_direction(container, ws, move_dir);
281 return true; 281 return true;
@@ -293,12 +293,12 @@ static bool container_move_to_next_output(struct sway_container *container,
293static bool container_move_in_direction(struct sway_container *container, 293static bool container_move_in_direction(struct sway_container *container,
294 enum wlr_direction move_dir) { 294 enum wlr_direction move_dir) {
295 // If moving a fullscreen view, only consider outputs 295 // If moving a fullscreen view, only consider outputs
296 switch (container->fullscreen_mode) { 296 switch (container->pending.fullscreen_mode) {
297 case FULLSCREEN_NONE: 297 case FULLSCREEN_NONE:
298 break; 298 break;
299 case FULLSCREEN_WORKSPACE: 299 case FULLSCREEN_WORKSPACE:
300 return container_move_to_next_output(container, 300 return container_move_to_next_output(container,
301 container->workspace->output, move_dir); 301 container->pending.workspace->output, move_dir);
302 case FULLSCREEN_GLOBAL: 302 case FULLSCREEN_GLOBAL:
303 return false; 303 return false;
304 } 304 }
@@ -317,26 +317,26 @@ static bool container_move_in_direction(struct sway_container *container,
317 while (!ancestor) { 317 while (!ancestor) {
318 // Don't allow containers to move out of their 318 // Don't allow containers to move out of their
319 // fullscreen or floating parent 319 // fullscreen or floating parent
320 if (current->fullscreen_mode || container_is_floating(current)) { 320 if (current->pending.fullscreen_mode || container_is_floating(current)) {
321 return false; 321 return false;
322 } 322 }
323 323
324 enum sway_container_layout parent_layout = container_parent_layout(current); 324 enum sway_container_layout parent_layout = container_parent_layout(current);
325 if (!is_parallel(parent_layout, move_dir)) { 325 if (!is_parallel(parent_layout, move_dir)) {
326 if (!current->parent) { 326 if (!current->pending.parent) {
327 // No parallel parent, so we reorient the workspace 327 // No parallel parent, so we reorient the workspace
328 current = workspace_wrap_children(current->workspace); 328 current = workspace_wrap_children(current->pending.workspace);
329 current->workspace->layout = 329 current->pending.workspace->layout =
330 move_dir == WLR_DIRECTION_LEFT || 330 move_dir == WLR_DIRECTION_LEFT ||
331 move_dir == WLR_DIRECTION_RIGHT ? 331 move_dir == WLR_DIRECTION_RIGHT ?
332 L_HORIZ : L_VERT; 332 L_HORIZ : L_VERT;
333 container->height = container->width = 0; 333 container->pending.height = container->pending.width = 0;
334 container->height_fraction = container->width_fraction = 0; 334 container->height_fraction = container->width_fraction = 0;
335 workspace_update_representation(current->workspace); 335 workspace_update_representation(current->pending.workspace);
336 wrapped = true; 336 wrapped = true;
337 } else { 337 } else {
338 // Keep looking for a parallel parent 338 // Keep looking for a parallel parent
339 current = current->parent; 339 current = current->pending.parent;
340 } 340 }
341 continue; 341 continue;
342 } 342 }
@@ -356,14 +356,14 @@ static bool container_move_in_direction(struct sway_container *container,
356 container_move_to_container_from_direction(container, 356 container_move_to_container_from_direction(container,
357 target, move_dir); 357 target, move_dir);
358 return true; 358 return true;
359 } else if (!container->parent) { 359 } else if (!container->pending.parent) {
360 // Container is at workspace level so we move it to the 360 // Container is at workspace level so we move it to the
361 // next workspace if possible 361 // next workspace if possible
362 return container_move_to_next_output(container, 362 return container_move_to_next_output(container,
363 current->workspace->output, move_dir); 363 current->pending.workspace->output, move_dir);
364 } else { 364 } else {
365 // Container has escaped its immediate parallel parent 365 // Container has escaped its immediate parallel parent
366 current = current->parent; 366 current = current->pending.parent;
367 continue; 367 continue;
368 } 368 }
369 } 369 }
@@ -377,31 +377,31 @@ static bool container_move_in_direction(struct sway_container *container,
377 container_move_to_container_from_direction(container, 377 container_move_to_container_from_direction(container,
378 target, move_dir); 378 target, move_dir);
379 return true; 379 return true;
380 } else if (!wrapped && !container->parent->parent && 380 } else if (!wrapped && !container->pending.parent->pending.parent &&
381 container->parent->children->length == 1) { 381 container->pending.parent->pending.children->length == 1) {
382 // Treat singleton children as if they are at workspace level like i3 382 // Treat singleton children as if they are at workspace level like i3
383 // https://github.com/i3/i3/blob/1d9160f2d247dbaa83fb62f02fd7041dec767fc2/src/move.c#L367 383 // https://github.com/i3/i3/blob/1d9160f2d247dbaa83fb62f02fd7041dec767fc2/src/move.c#L367
384 return container_move_to_next_output(container, 384 return container_move_to_next_output(container,
385 ancestor->workspace->output, move_dir); 385 ancestor->pending.workspace->output, move_dir);
386 } else { 386 } else {
387 // Container will be promoted 387 // Container will be promoted
388 struct sway_container *old_parent = container->parent; 388 struct sway_container *old_parent = container->pending.parent;
389 if (ancestor->parent) { 389 if (ancestor->pending.parent) {
390 // Container will move in with its parent 390 // Container will move in with its parent
391 container_insert_child(ancestor->parent, container, 391 container_insert_child(ancestor->pending.parent, container,
392 index + (offs < 0 ? 0 : 1)); 392 index + (offs < 0 ? 0 : 1));
393 } else { 393 } else {
394 // Container will move to workspace level, 394 // Container will move to workspace level,
395 // may be re-split by workspace_layout 395 // may be re-split by workspace_layout
396 workspace_insert_tiling(ancestor->workspace, container, 396 workspace_insert_tiling(ancestor->pending.workspace, container,
397 index + (offs < 0 ? 0 : 1)); 397 index + (offs < 0 ? 0 : 1));
398 } 398 }
399 ancestor->height = ancestor->width = 0; 399 ancestor->pending.height = ancestor->pending.width = 0;
400 ancestor->height_fraction = ancestor->width_fraction = 0; 400 ancestor->height_fraction = ancestor->width_fraction = 0;
401 if (old_parent) { 401 if (old_parent) {
402 container_reap_empty(old_parent); 402 container_reap_empty(old_parent);
403 } 403 }
404 workspace_squash(container->workspace); 404 workspace_squash(container->pending.workspace);
405 return true; 405 return true;
406 } 406 }
407} 407}
@@ -427,14 +427,14 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
427 container = workspace_wrap_children(workspace); 427 container = workspace_wrap_children(workspace);
428 } 428 }
429 429
430 if (container->fullscreen_mode == FULLSCREEN_GLOBAL) { 430 if (container->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
431 return cmd_results_new(CMD_FAILURE, 431 return cmd_results_new(CMD_FAILURE,
432 "Can't move fullscreen global container"); 432 "Can't move fullscreen global container");
433 } 433 }
434 434
435 struct sway_seat *seat = config->handler_context.seat; 435 struct sway_seat *seat = config->handler_context.seat;
436 struct sway_container *old_parent = container->parent; 436 struct sway_container *old_parent = container->pending.parent;
437 struct sway_workspace *old_ws = container->workspace; 437 struct sway_workspace *old_ws = container->pending.workspace;
438 struct sway_output *old_output = old_ws ? old_ws->output : NULL; 438 struct sway_output *old_output = old_ws ? old_ws->output : NULL;
439 struct sway_node *destination = NULL; 439 struct sway_node *destination = NULL;
440 440
@@ -508,7 +508,7 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
508 destination = dst ? &dst->node : &ws->node; 508 destination = dst ? &dst->node : &ws->node;
509 } else if (strcasecmp(argv[0], "output") == 0) { 509 } else if (strcasecmp(argv[0], "output") == 0) {
510 struct sway_output *new_output = output_in_direction(argv[1], 510 struct sway_output *new_output = output_in_direction(argv[1],
511 old_output, container->x, container->y); 511 old_output, container->pending.x, container->pending.y);
512 if (!new_output) { 512 if (!new_output) {
513 return cmd_results_new(CMD_FAILURE, 513 return cmd_results_new(CMD_FAILURE,
514 "Can't find output with name/direction '%s'", argv[1]); 514 "Can't find output with name/direction '%s'", argv[1]);
@@ -706,12 +706,12 @@ static struct cmd_results *cmd_move_in_direction(
706 "Cannot move workspaces in a direction"); 706 "Cannot move workspaces in a direction");
707 } 707 }
708 if (container_is_floating(container)) { 708 if (container_is_floating(container)) {
709 if (container->fullscreen_mode) { 709 if (container->pending.fullscreen_mode) {
710 return cmd_results_new(CMD_FAILURE, 710 return cmd_results_new(CMD_FAILURE,
711 "Cannot move fullscreen floating container"); 711 "Cannot move fullscreen floating container");
712 } 712 }
713 double lx = container->x; 713 double lx = container->pending.x;
714 double ly = container->y; 714 double ly = container->pending.y;
715 switch (direction) { 715 switch (direction) {
716 case WLR_DIRECTION_LEFT: 716 case WLR_DIRECTION_LEFT:
717 lx -= move_amt; 717 lx -= move_amt;
@@ -729,8 +729,8 @@ static struct cmd_results *cmd_move_in_direction(
729 container_floating_move_to(container, lx, ly); 729 container_floating_move_to(container, lx, ly);
730 return cmd_results_new(CMD_SUCCESS, NULL); 730 return cmd_results_new(CMD_SUCCESS, NULL);
731 } 731 }
732 struct sway_workspace *old_ws = container->workspace; 732 struct sway_workspace *old_ws = container->pending.workspace;
733 struct sway_container *old_parent = container->parent; 733 struct sway_container *old_parent = container->pending.parent;
734 734
735 if (!container_move_in_direction(container, direction)) { 735 if (!container_move_in_direction(container, direction)) {
736 // Container didn't move 736 // Container didn't move
@@ -744,7 +744,7 @@ static struct cmd_results *cmd_move_in_direction(
744 workspace_consider_destroy(old_ws); 744 workspace_consider_destroy(old_ws);
745 } 745 }
746 746
747 struct sway_workspace *new_ws = container->workspace; 747 struct sway_workspace *new_ws = container->pending.workspace;
748 748
749 if (root->fullscreen_global) { 749 if (root->fullscreen_global) {
750 arrange_root(); 750 arrange_root();
@@ -781,8 +781,8 @@ static struct cmd_results *cmd_move_to_position_pointer(
781 } 781 }
782 struct wlr_cursor *cursor = seat->cursor->cursor; 782 struct wlr_cursor *cursor = seat->cursor->cursor;
783 /* Determine where to put the window. */ 783 /* Determine where to put the window. */
784 double lx = cursor->x - container->width / 2; 784 double lx = cursor->x - container->pending.width / 2;
785 double ly = cursor->y - container->height / 2; 785 double ly = cursor->y - container->pending.height / 2;
786 786
787 /* Correct target coordinates to be in bounds (on screen). */ 787 /* Correct target coordinates to be in bounds (on screen). */
788 struct wlr_output *output = wlr_output_layout_output_at( 788 struct wlr_output *output = wlr_output_layout_output_at(
@@ -792,11 +792,11 @@ static struct cmd_results *cmd_move_to_position_pointer(
792 wlr_output_layout_get_box(root->output_layout, output); 792 wlr_output_layout_get_box(root->output_layout, output);
793 lx = fmax(lx, box->x); 793 lx = fmax(lx, box->x);
794 ly = fmax(ly, box->y); 794 ly = fmax(ly, box->y);
795 if (lx + container->width > box->x + box->width) { 795 if (lx + container->pending.width > box->x + box->width) {
796 lx = box->x + box->width - container->width; 796 lx = box->x + box->width - container->pending.width;
797 } 797 }
798 if (ly + container->height > box->y + box->height) { 798 if (ly + container->pending.height > box->y + box->height) {
799 ly = box->y + box->height - container->height; 799 ly = box->y + box->height - container->pending.height;
800 } 800 }
801 } 801 }
802 802
@@ -846,16 +846,16 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
846 } else if (strcmp(argv[0], "center") == 0) { 846 } else if (strcmp(argv[0], "center") == 0) {
847 double lx, ly; 847 double lx, ly;
848 if (absolute) { 848 if (absolute) {
849 lx = root->x + (root->width - container->width) / 2; 849 lx = root->x + (root->width - container->pending.width) / 2;
850 ly = root->y + (root->height - container->height) / 2; 850 ly = root->y + (root->height - container->pending.height) / 2;
851 } else { 851 } else {
852 struct sway_workspace *ws = container->workspace; 852 struct sway_workspace *ws = container->pending.workspace;
853 if (!ws) { 853 if (!ws) {
854 struct sway_seat *seat = config->handler_context.seat; 854 struct sway_seat *seat = config->handler_context.seat;
855 ws = seat_get_focused_workspace(seat); 855 ws = seat_get_focused_workspace(seat);
856 } 856 }
857 lx = ws->x + (ws->width - container->width) / 2; 857 lx = ws->x + (ws->width - container->pending.width) / 2;
858 ly = ws->y + (ws->height - container->height) / 2; 858 ly = ws->y + (ws->height - container->pending.height) / 2;
859 } 859 }
860 container_floating_move_to(container, lx, ly); 860 container_floating_move_to(container, lx, ly);
861 return cmd_results_new(CMD_SUCCESS, NULL); 861 return cmd_results_new(CMD_SUCCESS, NULL);
@@ -886,7 +886,7 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
886 return cmd_results_new(CMD_INVALID, "Invalid y position specified"); 886 return cmd_results_new(CMD_INVALID, "Invalid y position specified");
887 } 887 }
888 888
889 struct sway_workspace *ws = container->workspace; 889 struct sway_workspace *ws = container->pending.workspace;
890 if (!ws) { 890 if (!ws) {
891 struct sway_seat *seat = config->handler_context.seat; 891 struct sway_seat *seat = config->handler_context.seat;
892 ws = seat_get_focused_workspace(seat); 892 ws = seat_get_focused_workspace(seat);
@@ -960,14 +960,14 @@ static struct cmd_results *cmd_move_to_scratchpad(void) {
960 // If the container is in a floating split container, 960 // If the container is in a floating split container,
961 // operate on the split container instead of the child. 961 // operate on the split container instead of the child.
962 if (container_is_floating_or_child(con)) { 962 if (container_is_floating_or_child(con)) {
963 while (con->parent) { 963 while (con->pending.parent) {
964 con = con->parent; 964 con = con->pending.parent;
965 } 965 }
966 } 966 }
967 967
968 if (!con->scratchpad) { 968 if (!con->scratchpad) {
969 root_scratchpad_add_container(con, NULL); 969 root_scratchpad_add_container(con, NULL);
970 } else if (con->workspace) { 970 } else if (con->pending.workspace) {
971 root_scratchpad_hide(con); 971 root_scratchpad_hide(con);
972 } 972 }
973 return cmd_results_new(CMD_SUCCESS, NULL); 973 return cmd_results_new(CMD_SUCCESS, NULL);
diff --git a/sway/commands/resize.c b/sway/commands/resize.c
index ca36e858..425069de 100644
--- a/sway/commands/resize.c
+++ b/sway/commands/resize.c
@@ -57,7 +57,7 @@ struct sway_container *container_find_resize_parent(struct sway_container *con,
57 (allow_last || index < siblings->length - 1)) { 57 (allow_last || index < siblings->length - 1)) {
58 return con; 58 return con;
59 } 59 }
60 con = con->parent; 60 con = con->pending.parent;
61 } 61 }
62 62
63 return NULL; 63 return NULL;
@@ -115,13 +115,13 @@ void container_resize_tiled(struct sway_container *con,
115 int sibling_amount = prev ? ceil((double)amount / 2.0) : amount; 115 int sibling_amount = prev ? ceil((double)amount / 2.0) : amount;
116 116
117 if (is_horizontal(axis)) { 117 if (is_horizontal(axis)) {
118 if (con->width + amount < MIN_SANE_W) { 118 if (con->pending.width + amount < MIN_SANE_W) {
119 return; 119 return;
120 } 120 }
121 if (next->width - sibling_amount < MIN_SANE_W) { 121 if (next->pending.width - sibling_amount < MIN_SANE_W) {
122 return; 122 return;
123 } 123 }
124 if (prev && prev->width - sibling_amount < MIN_SANE_W) { 124 if (prev && prev->pending.width - sibling_amount < MIN_SANE_W) {
125 return; 125 return;
126 } 126 }
127 if (con->child_total_width <= 0) { 127 if (con->child_total_width <= 0) {
@@ -133,7 +133,7 @@ void container_resize_tiled(struct sway_container *con,
133 list_t *siblings = container_get_siblings(con); 133 list_t *siblings = container_get_siblings(con);
134 for (int i = 0; i < siblings->length; ++i) { 134 for (int i = 0; i < siblings->length; ++i) {
135 struct sway_container *con = siblings->items[i]; 135 struct sway_container *con = siblings->items[i];
136 con->width_fraction = con->width / con->child_total_width; 136 con->width_fraction = con->pending.width / con->child_total_width;
137 } 137 }
138 138
139 double amount_fraction = (double)amount / con->child_total_width; 139 double amount_fraction = (double)amount / con->child_total_width;
@@ -146,13 +146,13 @@ void container_resize_tiled(struct sway_container *con,
146 prev->width_fraction -= sibling_amount_fraction; 146 prev->width_fraction -= sibling_amount_fraction;
147 } 147 }
148 } else { 148 } else {
149 if (con->height + amount < MIN_SANE_H) { 149 if (con->pending.height + amount < MIN_SANE_H) {
150 return; 150 return;
151 } 151 }
152 if (next->height - sibling_amount < MIN_SANE_H) { 152 if (next->pending.height - sibling_amount < MIN_SANE_H) {
153 return; 153 return;
154 } 154 }
155 if (prev && prev->height - sibling_amount < MIN_SANE_H) { 155 if (prev && prev->pending.height - sibling_amount < MIN_SANE_H) {
156 return; 156 return;
157 } 157 }
158 if (con->child_total_height <= 0) { 158 if (con->child_total_height <= 0) {
@@ -164,7 +164,7 @@ void container_resize_tiled(struct sway_container *con,
164 list_t *siblings = container_get_siblings(con); 164 list_t *siblings = container_get_siblings(con);
165 for (int i = 0; i < siblings->length; ++i) { 165 for (int i = 0; i < siblings->length; ++i) {
166 struct sway_container *con = siblings->items[i]; 166 struct sway_container *con = siblings->items[i];
167 con->height_fraction = con->height / con->child_total_height; 167 con->height_fraction = con->pending.height / con->child_total_height;
168 } 168 }
169 169
170 double amount_fraction = (double)amount / con->child_total_height; 170 double amount_fraction = (double)amount / con->child_total_height;
@@ -178,10 +178,10 @@ void container_resize_tiled(struct sway_container *con,
178 } 178 }
179 } 179 }
180 180
181 if (con->parent) { 181 if (con->pending.parent) {
182 arrange_container(con->parent); 182 arrange_container(con->pending.parent);
183 } else { 183 } else {
184 arrange_workspace(con->workspace); 184 arrange_workspace(con->pending.workspace);
185 } 185 }
186} 186}
187 187
@@ -203,15 +203,15 @@ static struct cmd_results *resize_adjust_floating(uint32_t axis,
203 int min_width, max_width, min_height, max_height; 203 int min_width, max_width, min_height, max_height;
204 floating_calculate_constraints(&min_width, &max_width, 204 floating_calculate_constraints(&min_width, &max_width,
205 &min_height, &max_height); 205 &min_height, &max_height);
206 if (con->width + grow_width < min_width) { 206 if (con->pending.width + grow_width < min_width) {
207 grow_width = min_width - con->width; 207 grow_width = min_width - con->pending.width;
208 } else if (con->width + grow_width > max_width) { 208 } else if (con->pending.width + grow_width > max_width) {
209 grow_width = max_width - con->width; 209 grow_width = max_width - con->pending.width;
210 } 210 }
211 if (con->height + grow_height < min_height) { 211 if (con->pending.height + grow_height < min_height) {
212 grow_height = min_height - con->height; 212 grow_height = min_height - con->pending.height;
213 } else if (con->height + grow_height > max_height) { 213 } else if (con->pending.height + grow_height > max_height) {
214 grow_height = max_height - con->height; 214 grow_height = max_height - con->pending.height;
215 } 215 }
216 int grow_x = 0, grow_y = 0; 216 int grow_x = 0, grow_y = 0;
217 217
@@ -227,15 +227,15 @@ static struct cmd_results *resize_adjust_floating(uint32_t axis,
227 if (grow_width == 0 && grow_height == 0) { 227 if (grow_width == 0 && grow_height == 0) {
228 return cmd_results_new(CMD_INVALID, "Cannot resize any further"); 228 return cmd_results_new(CMD_INVALID, "Cannot resize any further");
229 } 229 }
230 con->x += grow_x; 230 con->pending.x += grow_x;
231 con->y += grow_y; 231 con->pending.y += grow_y;
232 con->width += grow_width; 232 con->pending.width += grow_width;
233 con->height += grow_height; 233 con->pending.height += grow_height;
234 234
235 con->content_x += grow_x; 235 con->pending.content_x += grow_x;
236 con->content_y += grow_y; 236 con->pending.content_y += grow_y;
237 con->content_width += grow_width; 237 con->pending.content_width += grow_width;
238 con->content_height += grow_height; 238 con->pending.content_height += grow_height;
239 239
240 arrange_container(con); 240 arrange_container(con);
241 241
@@ -256,9 +256,9 @@ static struct cmd_results *resize_adjust_tiled(uint32_t axis,
256 float pct = amount->amount / 100.0f; 256 float pct = amount->amount / 100.0f;
257 257
258 if (is_horizontal(axis)) { 258 if (is_horizontal(axis)) {
259 amount->amount = (float)current->width * pct; 259 amount->amount = (float)current->pending.width * pct;
260 } else { 260 } else {
261 amount->amount = (float)current->height * pct; 261 amount->amount = (float)current->pending.height * pct;
262 } 262 }
263 } 263 }
264 264
@@ -281,20 +281,20 @@ static struct cmd_results *resize_set_tiled(struct sway_container *con,
281 if (width->unit == MOVEMENT_UNIT_PPT || 281 if (width->unit == MOVEMENT_UNIT_PPT ||
282 width->unit == MOVEMENT_UNIT_DEFAULT) { 282 width->unit == MOVEMENT_UNIT_DEFAULT) {
283 // Convert to px 283 // Convert to px
284 struct sway_container *parent = con->parent; 284 struct sway_container *parent = con->pending.parent;
285 while (parent && parent->layout != L_HORIZ) { 285 while (parent && parent->pending.layout != L_HORIZ) {
286 parent = parent->parent; 286 parent = parent->pending.parent;
287 } 287 }
288 if (parent) { 288 if (parent) {
289 width->amount = parent->width * width->amount / 100; 289 width->amount = parent->pending.width * width->amount / 100;
290 } else { 290 } else {
291 width->amount = con->workspace->width * width->amount / 100; 291 width->amount = con->pending.workspace->width * width->amount / 100;
292 } 292 }
293 width->unit = MOVEMENT_UNIT_PX; 293 width->unit = MOVEMENT_UNIT_PX;
294 } 294 }
295 if (width->unit == MOVEMENT_UNIT_PX) { 295 if (width->unit == MOVEMENT_UNIT_PX) {
296 container_resize_tiled(con, AXIS_HORIZONTAL, 296 container_resize_tiled(con, AXIS_HORIZONTAL,
297 width->amount - con->width); 297 width->amount - con->pending.width);
298 } 298 }
299 } 299 }
300 300
@@ -302,20 +302,20 @@ static struct cmd_results *resize_set_tiled(struct sway_container *con,
302 if (height->unit == MOVEMENT_UNIT_PPT || 302 if (height->unit == MOVEMENT_UNIT_PPT ||
303 height->unit == MOVEMENT_UNIT_DEFAULT) { 303 height->unit == MOVEMENT_UNIT_DEFAULT) {
304 // Convert to px 304 // Convert to px
305 struct sway_container *parent = con->parent; 305 struct sway_container *parent = con->pending.parent;
306 while (parent && parent->layout != L_VERT) { 306 while (parent && parent->pending.layout != L_VERT) {
307 parent = parent->parent; 307 parent = parent->pending.parent;
308 } 308 }
309 if (parent) { 309 if (parent) {
310 height->amount = parent->height * height->amount / 100; 310 height->amount = parent->pending.height * height->amount / 100;
311 } else { 311 } else {
312 height->amount = con->workspace->height * height->amount / 100; 312 height->amount = con->pending.workspace->height * height->amount / 100;
313 } 313 }
314 height->unit = MOVEMENT_UNIT_PX; 314 height->unit = MOVEMENT_UNIT_PX;
315 } 315 }
316 if (height->unit == MOVEMENT_UNIT_PX) { 316 if (height->unit == MOVEMENT_UNIT_PX) {
317 container_resize_tiled(con, AXIS_VERTICAL, 317 container_resize_tiled(con, AXIS_VERTICAL,
318 height->amount - con->height); 318 height->amount - con->pending.height);
319 } 319 }
320 } 320 }
321 321
@@ -339,15 +339,15 @@ static struct cmd_results *resize_set_floating(struct sway_container *con,
339 "Cannot resize a hidden scratchpad container by ppt"); 339 "Cannot resize a hidden scratchpad container by ppt");
340 } 340 }
341 // Convert to px 341 // Convert to px
342 width->amount = con->workspace->width * width->amount / 100; 342 width->amount = con->pending.workspace->width * width->amount / 100;
343 width->unit = MOVEMENT_UNIT_PX; 343 width->unit = MOVEMENT_UNIT_PX;
344 // Falls through 344 // Falls through
345 case MOVEMENT_UNIT_PX: 345 case MOVEMENT_UNIT_PX:
346 case MOVEMENT_UNIT_DEFAULT: 346 case MOVEMENT_UNIT_DEFAULT:
347 width->amount = fmax(min_width, fmin(width->amount, max_width)); 347 width->amount = fmax(min_width, fmin(width->amount, max_width));
348 grow_width = width->amount - con->width; 348 grow_width = width->amount - con->pending.width;
349 con->x -= grow_width / 2; 349 con->pending.x -= grow_width / 2;
350 con->width = width->amount; 350 con->pending.width = width->amount;
351 break; 351 break;
352 case MOVEMENT_UNIT_INVALID: 352 case MOVEMENT_UNIT_INVALID:
353 sway_assert(false, "invalid width unit"); 353 sway_assert(false, "invalid width unit");
@@ -363,15 +363,15 @@ static struct cmd_results *resize_set_floating(struct sway_container *con,
363 "Cannot resize a hidden scratchpad container by ppt"); 363 "Cannot resize a hidden scratchpad container by ppt");
364 } 364 }
365 // Convert to px 365 // Convert to px
366 height->amount = con->workspace->height * height->amount / 100; 366 height->amount = con->pending.workspace->height * height->amount / 100;
367 height->unit = MOVEMENT_UNIT_PX; 367 height->unit = MOVEMENT_UNIT_PX;
368 // Falls through 368 // Falls through
369 case MOVEMENT_UNIT_PX: 369 case MOVEMENT_UNIT_PX:
370 case MOVEMENT_UNIT_DEFAULT: 370 case MOVEMENT_UNIT_DEFAULT:
371 height->amount = fmax(min_height, fmin(height->amount, max_height)); 371 height->amount = fmax(min_height, fmin(height->amount, max_height));
372 grow_height = height->amount - con->height; 372 grow_height = height->amount - con->pending.height;
373 con->y -= grow_height / 2; 373 con->pending.y -= grow_height / 2;
374 con->height = height->amount; 374 con->pending.height = height->amount;
375 break; 375 break;
376 case MOVEMENT_UNIT_INVALID: 376 case MOVEMENT_UNIT_INVALID:
377 sway_assert(false, "invalid height unit"); 377 sway_assert(false, "invalid height unit");
@@ -379,10 +379,10 @@ static struct cmd_results *resize_set_floating(struct sway_container *con,
379 } 379 }
380 } 380 }
381 381
382 con->content_x -= grow_width / 2; 382 con->pending.content_x -= grow_width / 2;
383 con->content_y -= grow_height / 2; 383 con->pending.content_y -= grow_height / 2;
384 con->content_width += grow_width; 384 con->pending.content_width += grow_width;
385 con->content_height += grow_height; 385 con->pending.content_height += grow_height;
386 386
387 arrange_container(con); 387 arrange_container(con);
388 388
@@ -437,10 +437,10 @@ static struct cmd_results *cmd_resize_set(int argc, char **argv) {
437 // If 0, don't resize that dimension 437 // If 0, don't resize that dimension
438 struct sway_container *con = config->handler_context.container; 438 struct sway_container *con = config->handler_context.container;
439 if (width.amount <= 0) { 439 if (width.amount <= 0) {
440 width.amount = con->width; 440 width.amount = con->pending.width;
441 } 441 }
442 if (height.amount <= 0) { 442 if (height.amount <= 0) {
443 height.amount = con->height; 443 height.amount = con->pending.height;
444 } 444 }
445 445
446 if (container_is_floating(con)) { 446 if (container_is_floating(con)) {
diff --git a/sway/commands/scratchpad.c b/sway/commands/scratchpad.c
index 34871bc6..a1285df5 100644
--- a/sway/commands/scratchpad.c
+++ b/sway/commands/scratchpad.c
@@ -21,8 +21,8 @@ static void scratchpad_toggle_auto(void) {
21 // If the focus is in a floating split container, 21 // If the focus is in a floating split container,
22 // operate on the split container instead of the child. 22 // operate on the split container instead of the child.
23 if (focus && container_is_floating_or_child(focus)) { 23 if (focus && container_is_floating_or_child(focus)) {
24 while (focus->parent) { 24 while (focus->pending.parent) {
25 focus = focus->parent; 25 focus = focus->pending.parent;
26 } 26 }
27 } 27 }
28 28
@@ -52,7 +52,7 @@ static void scratchpad_toggle_auto(void) {
52 // In this case we move it to the current workspace. 52 // In this case we move it to the current workspace.
53 for (int i = 0; i < root->scratchpad->length; ++i) { 53 for (int i = 0; i < root->scratchpad->length; ++i) {
54 struct sway_container *con = root->scratchpad->items[i]; 54 struct sway_container *con = root->scratchpad->items[i];
55 if (con->parent) { 55 if (con->pending.parent) {
56 sway_log(SWAY_DEBUG, 56 sway_log(SWAY_DEBUG,
57 "Moving a visible scratchpad window (%s) to this workspace", 57 "Moving a visible scratchpad window (%s) to this workspace",
58 con->title); 58 con->title);
@@ -80,7 +80,7 @@ static void scratchpad_toggle_container(struct sway_container *con) {
80 struct sway_seat *seat = input_manager_current_seat(); 80 struct sway_seat *seat = input_manager_current_seat();
81 struct sway_workspace *ws = seat_get_focused_workspace(seat); 81 struct sway_workspace *ws = seat_get_focused_workspace(seat);
82 // Check if it matches a currently visible scratchpad window and hide it. 82 // Check if it matches a currently visible scratchpad window and hide it.
83 if (con->workspace && ws == con->workspace) { 83 if (con->pending.workspace && ws == con->pending.workspace) {
84 root_scratchpad_hide(con); 84 root_scratchpad_hide(con);
85 return; 85 return;
86 } 86 }
@@ -111,8 +111,8 @@ struct cmd_results *cmd_scratchpad(int argc, char **argv) {
111 // If the container is in a floating split container, 111 // If the container is in a floating split container,
112 // operate on the split container instead of the child. 112 // operate on the split container instead of the child.
113 if (container_is_floating_or_child(con)) { 113 if (container_is_floating_or_child(con)) {
114 while (con->parent) { 114 while (con->pending.parent) {
115 con = con->parent; 115 con = con->pending.parent;
116 } 116 }
117 } 117 }
118 118
diff --git a/sway/commands/split.c b/sway/commands/split.c
index 782bab02..3e25c6f7 100644
--- a/sway/commands/split.c
+++ b/sway/commands/split.c
@@ -14,7 +14,7 @@ static struct cmd_results *do_split(int layout) {
14 struct sway_workspace *ws = config->handler_context.workspace; 14 struct sway_workspace *ws = config->handler_context.workspace;
15 if (con) { 15 if (con) {
16 if (container_is_scratchpad_hidden_or_child(con) && 16 if (container_is_scratchpad_hidden_or_child(con) &&
17 con->fullscreen_mode != FULLSCREEN_GLOBAL) { 17 con->pending.fullscreen_mode != FULLSCREEN_GLOBAL) {
18 return cmd_results_new(CMD_FAILURE, 18 return cmd_results_new(CMD_FAILURE,
19 "Cannot split a hidden scratchpad container"); 19 "Cannot split a hidden scratchpad container");
20 } 20 }
diff --git a/sway/commands/sticky.c b/sway/commands/sticky.c
index 3c93a276..9b09a0f9 100644
--- a/sway/commands/sticky.c
+++ b/sway/commands/sticky.c
@@ -29,14 +29,14 @@ struct cmd_results *cmd_sticky(int argc, char **argv) {
29 !container_is_scratchpad_hidden(container)) { 29 !container_is_scratchpad_hidden(container)) {
30 // move container to active workspace 30 // move container to active workspace
31 struct sway_workspace *active_workspace = 31 struct sway_workspace *active_workspace =
32 output_get_active_workspace(container->workspace->output); 32 output_get_active_workspace(container->pending.workspace->output);
33 if (!sway_assert(active_workspace, 33 if (!sway_assert(active_workspace,
34 "Expected output to have a workspace")) { 34 "Expected output to have a workspace")) {
35 return cmd_results_new(CMD_FAILURE, 35 return cmd_results_new(CMD_FAILURE,
36 "Expected output to have a workspace"); 36 "Expected output to have a workspace");
37 } 37 }
38 if (container->workspace != active_workspace) { 38 if (container->pending.workspace != active_workspace) {
39 struct sway_workspace *old_workspace = container->workspace; 39 struct sway_workspace *old_workspace = container->pending.workspace;
40 container_detach(container); 40 container_detach(container);
41 workspace_add_floating(active_workspace, container); 41 workspace_add_floating(active_workspace, container);
42 container_handle_fullscreen_reparent(container); 42 container_handle_fullscreen_reparent(container);
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index a7f9691b..ce5e5128 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -16,46 +16,46 @@ static const char expected_syntax[] =
16static void swap_places(struct sway_container *con1, 16static void swap_places(struct sway_container *con1,
17 struct sway_container *con2) { 17 struct sway_container *con2) {
18 struct sway_container *temp = malloc(sizeof(struct sway_container)); 18 struct sway_container *temp = malloc(sizeof(struct sway_container));
19 temp->x = con1->x; 19 temp->pending.x = con1->pending.x;
20 temp->y = con1->y; 20 temp->pending.y = con1->pending.y;
21 temp->width = con1->width; 21 temp->pending.width = con1->pending.width;
22 temp->height = con1->height; 22 temp->pending.height = con1->pending.height;
23 temp->width_fraction = con1->width_fraction; 23 temp->width_fraction = con1->width_fraction;
24 temp->height_fraction = con1->height_fraction; 24 temp->height_fraction = con1->height_fraction;
25 temp->parent = con1->parent; 25 temp->pending.parent = con1->pending.parent;
26 temp->workspace = con1->workspace; 26 temp->pending.workspace = con1->pending.workspace;
27 bool temp_floating = container_is_floating(con1); 27 bool temp_floating = container_is_floating(con1);
28 28
29 con1->x = con2->x; 29 con1->pending.x = con2->pending.x;
30 con1->y = con2->y; 30 con1->pending.y = con2->pending.y;
31 con1->width = con2->width; 31 con1->pending.width = con2->pending.width;
32 con1->height = con2->height; 32 con1->pending.height = con2->pending.height;
33 con1->width_fraction = con2->width_fraction; 33 con1->width_fraction = con2->width_fraction;
34 con1->height_fraction = con2->height_fraction; 34 con1->height_fraction = con2->height_fraction;
35 35
36 con2->x = temp->x; 36 con2->pending.x = temp->pending.x;
37 con2->y = temp->y; 37 con2->pending.y = temp->pending.y;
38 con2->width = temp->width; 38 con2->pending.width = temp->pending.width;
39 con2->height = temp->height; 39 con2->pending.height = temp->pending.height;
40 con2->width_fraction = temp->width_fraction; 40 con2->width_fraction = temp->width_fraction;
41 con2->height_fraction = temp->height_fraction; 41 con2->height_fraction = temp->height_fraction;
42 42
43 int temp_index = container_sibling_index(con1); 43 int temp_index = container_sibling_index(con1);
44 if (con2->parent) { 44 if (con2->pending.parent) {
45 container_insert_child(con2->parent, con1, 45 container_insert_child(con2->pending.parent, con1,
46 container_sibling_index(con2)); 46 container_sibling_index(con2));
47 } else if (container_is_floating(con2)) { 47 } else if (container_is_floating(con2)) {
48 workspace_add_floating(con2->workspace, con1); 48 workspace_add_floating(con2->pending.workspace, con1);
49 } else { 49 } else {
50 workspace_insert_tiling(con2->workspace, con1, 50 workspace_insert_tiling(con2->pending.workspace, con1,
51 container_sibling_index(con2)); 51 container_sibling_index(con2));
52 } 52 }
53 if (temp->parent) { 53 if (temp->pending.parent) {
54 container_insert_child(temp->parent, con2, temp_index); 54 container_insert_child(temp->pending.parent, con2, temp_index);
55 } else if (temp_floating) { 55 } else if (temp_floating) {
56 workspace_add_floating(temp->workspace, con2); 56 workspace_add_floating(temp->pending.workspace, con2);
57 } else { 57 } else {
58 workspace_insert_tiling(temp->workspace, con2, temp_index); 58 workspace_insert_tiling(temp->pending.workspace, con2, temp_index);
59 } 59 }
60 60
61 free(temp); 61 free(temp);
@@ -65,8 +65,8 @@ static void swap_focus(struct sway_container *con1,
65 struct sway_container *con2, struct sway_seat *seat, 65 struct sway_container *con2, struct sway_seat *seat,
66 struct sway_container *focus) { 66 struct sway_container *focus) {
67 if (focus == con1 || focus == con2) { 67 if (focus == con1 || focus == con2) {
68 struct sway_workspace *ws1 = con1->workspace; 68 struct sway_workspace *ws1 = con1->pending.workspace;
69 struct sway_workspace *ws2 = con2->workspace; 69 struct sway_workspace *ws2 = con2->pending.workspace;
70 enum sway_container_layout layout1 = container_parent_layout(con1); 70 enum sway_container_layout layout1 = container_parent_layout(con1);
71 enum sway_container_layout layout2 = container_parent_layout(con2); 71 enum sway_container_layout layout2 = container_parent_layout(con2);
72 if (focus == con1 && (layout2 == L_TABBED || layout2 == L_STACKED)) { 72 if (focus == con1 && (layout2 == L_TABBED || layout2 == L_STACKED)) {
@@ -125,8 +125,8 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) {
125 root_scratchpad_remove_container(con2); 125 root_scratchpad_remove_container(con2);
126 } 126 }
127 127
128 enum sway_fullscreen_mode fs1 = con1->fullscreen_mode; 128 enum sway_fullscreen_mode fs1 = con1->pending.fullscreen_mode;
129 enum sway_fullscreen_mode fs2 = con2->fullscreen_mode; 129 enum sway_fullscreen_mode fs2 = con2->pending.fullscreen_mode;
130 if (fs1) { 130 if (fs1) {
131 container_fullscreen_disable(con1); 131 container_fullscreen_disable(con1);
132 } 132 }
@@ -137,9 +137,9 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) {
137 struct sway_seat *seat = config->handler_context.seat; 137 struct sway_seat *seat = config->handler_context.seat;
138 struct sway_container *focus = seat_get_focused_container(seat); 138 struct sway_container *focus = seat_get_focused_container(seat);
139 struct sway_workspace *vis1 = 139 struct sway_workspace *vis1 =
140 output_get_active_workspace(con1->workspace->output); 140 output_get_active_workspace(con1->pending.workspace->output);
141 struct sway_workspace *vis2 = 141 struct sway_workspace *vis2 =
142 output_get_active_workspace(con2->workspace->output); 142 output_get_active_workspace(con2->pending.workspace->output);
143 if (!sway_assert(vis1 && vis2, "con1 or con2 are on an output without a" 143 if (!sway_assert(vis1 && vis2, "con1 or con2 are on an output without a"
144 "workspace. This should not happen")) { 144 "workspace. This should not happen")) {
145 return; 145 return;
diff --git a/sway/criteria.c b/sway/criteria.c
index 409160c5..d2a5566f 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -351,7 +351,7 @@ static bool criteria_matches_view(struct criteria *criteria,
351 } 351 }
352 352
353 if (criteria->workspace) { 353 if (criteria->workspace) {
354 struct sway_workspace *ws = view->container->workspace; 354 struct sway_workspace *ws = view->container->pending.workspace;
355 if (!ws) { 355 if (!ws) {
356 return false; 356 return false;
357 } 357 }
@@ -359,7 +359,7 @@ static bool criteria_matches_view(struct criteria *criteria,
359 switch (criteria->workspace->match_type) { 359 switch (criteria->workspace->match_type) {
360 case PATTERN_FOCUSED: 360 case PATTERN_FOCUSED:
361 if (focused && 361 if (focused &&
362 strcmp(ws->name, focused->container->workspace->name)) { 362 strcmp(ws->name, focused->container->pending.workspace->name)) {
363 return false; 363 return false;
364 } 364 }
365 break; 365 break;
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index fee19a33..3343fb31 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -957,7 +957,7 @@ static void render_floating(struct sway_output *soutput,
957 } 957 }
958 for (int k = 0; k < ws->current.floating->length; ++k) { 958 for (int k = 0; k < ws->current.floating->length; ++k) {
959 struct sway_container *floater = ws->current.floating->items[k]; 959 struct sway_container *floater = ws->current.floating->items[k];
960 if (floater->fullscreen_mode != FULLSCREEN_NONE) { 960 if (floater->pending.fullscreen_mode != FULLSCREEN_NONE) {
961 continue; 961 continue;
962 } 962 }
963 render_floating_container(soutput, damage, floater); 963 render_floating_container(soutput, damage, floater);
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 9f488963..6c392bab 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -128,8 +128,8 @@ static void copy_workspace_state(struct sway_workspace *ws,
128 // Set focused_inactive_child to the direct tiling child 128 // Set focused_inactive_child to the direct tiling child
129 struct sway_container *focus = seat_get_focus_inactive_tiling(seat, ws); 129 struct sway_container *focus = seat_get_focus_inactive_tiling(seat, ws);
130 if (focus) { 130 if (focus) {
131 while (focus->parent) { 131 while (focus->pending.parent) {
132 focus = focus->parent; 132 focus = focus->pending.parent;
133 } 133 }
134 } 134 }
135 state->focused_inactive_child = focus; 135 state->focused_inactive_child = focus;
@@ -139,32 +139,19 @@ static void copy_container_state(struct sway_container *container,
139 struct sway_transaction_instruction *instruction) { 139 struct sway_transaction_instruction *instruction) {
140 struct sway_container_state *state = &instruction->container_state; 140 struct sway_container_state *state = &instruction->container_state;
141 141
142 state->layout = container->layout; 142 if (state->children) {
143 state->x = container->x; 143 list_free(state->children);
144 state->y = container->y; 144 }
145 state->width = container->width; 145
146 state->height = container->height; 146 memcpy(state, &container->pending, sizeof(struct sway_container_state));
147 state->fullscreen_mode = container->fullscreen_mode;
148 state->parent = container->parent;
149 state->workspace = container->workspace;
150 state->border = container->border;
151 state->border_thickness = container->border_thickness;
152 state->border_top = container->border_top;
153 state->border_left = container->border_left;
154 state->border_right = container->border_right;
155 state->border_bottom = container->border_bottom;
156 state->content_x = container->content_x;
157 state->content_y = container->content_y;
158 state->content_width = container->content_width;
159 state->content_height = container->content_height;
160 147
161 if (!container->view) { 148 if (!container->view) {
162 if (state->children) { 149 // We store a copy of the child list to avoid having it mutated after
163 state->children->length = 0; 150 // we copy the state.
164 } else { 151 state->children = create_list();
165 state->children = create_list(); 152 list_cat(state->children, container->pending.children);
166 } 153 } else {
167 list_cat(state->children, container->children); 154 state->children = NULL;
168 } 155 }
169 156
170 struct sway_seat *seat = input_manager_current_seat(); 157 struct sway_seat *seat = input_manager_current_seat();
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 14880dcd..4c13f91f 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -70,13 +70,13 @@ static void popup_unconstrain(struct sway_xdg_popup *popup) {
70 struct sway_view *view = popup->child.view; 70 struct sway_view *view = popup->child.view;
71 struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_surface->popup; 71 struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_surface->popup;
72 72
73 struct sway_output *output = view->container->workspace->output; 73 struct sway_output *output = view->container->pending.workspace->output;
74 74
75 // the output box expressed in the coordinate system of the toplevel parent 75 // the output box expressed in the coordinate system of the toplevel parent
76 // of the popup 76 // of the popup
77 struct wlr_box output_toplevel_sx_box = { 77 struct wlr_box output_toplevel_sx_box = {
78 .x = output->lx - view->container->content_x, 78 .x = output->lx - view->container->pending.content_x,
79 .y = output->ly - view->container->content_y, 79 .y = output->ly - view->container->pending.content_y,
80 .width = output->width, 80 .width = output->width,
81 .height = output->height, 81 .height = output->height,
82 }; 82 };
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 4cd5f9d0..3ed65083 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -527,10 +527,10 @@ static void handle_request_configure(struct wl_listener *listener, void *data) {
527 view->natural_height = ev->height; 527 view->natural_height = ev->height;
528 container_floating_resize_and_center(view->container); 528 container_floating_resize_and_center(view->container);
529 529
530 configure(view, view->container->content_x, 530 configure(view, view->container->pending.content_x,
531 view->container->content_y, 531 view->container->pending.content_y,
532 view->container->content_width, 532 view->container->pending.content_width,
533 view->container->content_height); 533 view->container->pending.content_height);
534 node_set_dirty(&view->container->node); 534 node_set_dirty(&view->container->node);
535 } else { 535 } else {
536 configure(view, view->container->current.content_x, 536 configure(view, view->container->current.content_x,
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index b40e0299..cbb5c6e9 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -824,8 +824,8 @@ static void check_constraint_region(struct sway_cursor *cursor) {
824 824
825 struct sway_container *con = view->container; 825 struct sway_container *con = view->container;
826 826
827 double sx = cursor->cursor->x - con->content_x + view->geometry.x; 827 double sx = cursor->cursor->x - con->pending.content_x + view->geometry.x;
828 double sy = cursor->cursor->y - con->content_y + view->geometry.y; 828 double sy = cursor->cursor->y - con->pending.content_y + view->geometry.y;
829 829
830 if (!pixman_region32_contains_point(region, 830 if (!pixman_region32_contains_point(region,
831 floor(sx), floor(sy), NULL)) { 831 floor(sx), floor(sy), NULL)) {
@@ -836,8 +836,8 @@ static void check_constraint_region(struct sway_cursor *cursor) {
836 double sy = (boxes[0].y1 + boxes[0].y2) / 2.; 836 double sy = (boxes[0].y1 + boxes[0].y2) / 2.;
837 837
838 wlr_cursor_warp_closest(cursor->cursor, NULL, 838 wlr_cursor_warp_closest(cursor->cursor, NULL,
839 sx + con->content_x - view->geometry.x, 839 sx + con->pending.content_x - view->geometry.x,
840 sy + con->content_y - view->geometry.y); 840 sy + con->pending.content_y - view->geometry.y);
841 841
842 cursor_rebase(cursor); 842 cursor_rebase(cursor);
843 } 843 }
@@ -1157,8 +1157,8 @@ void cursor_warp_to_container(struct sway_cursor *cursor,
1157 return; 1157 return;
1158 } 1158 }
1159 1159
1160 double x = container->x + container->width / 2.0; 1160 double x = container->pending.x + container->pending.width / 2.0;
1161 double y = container->y + container->height / 2.0; 1161 double y = container->pending.y + container->pending.height / 2.0;
1162 1162
1163 wlr_cursor_warp(cursor->cursor, NULL, x, y); 1163 wlr_cursor_warp(cursor->cursor, NULL, x, y);
1164 cursor_unhide(cursor); 1164 cursor_unhide(cursor);
@@ -1271,8 +1271,8 @@ static void warp_to_constraint_cursor_hint(struct sway_cursor *cursor) {
1271 struct sway_view *view = view_from_wlr_surface(constraint->surface); 1271 struct sway_view *view = view_from_wlr_surface(constraint->surface);
1272 struct sway_container *con = view->container; 1272 struct sway_container *con = view->container;
1273 1273
1274 double lx = sx + con->content_x - view->geometry.x; 1274 double lx = sx + con->pending.content_x - view->geometry.x;
1275 double ly = sy + con->content_y - view->geometry.y; 1275 double ly = sy + con->pending.content_y - view->geometry.y;
1276 1276
1277 wlr_cursor_warp(cursor->cursor, NULL, lx, ly); 1277 wlr_cursor_warp(cursor->cursor, NULL, lx, ly);
1278 1278
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 3c0d9a29..e6e1d4fb 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -309,8 +309,8 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) {
309 // Setting focus_inactive 309 // Setting focus_inactive
310 focus = seat_get_focus_inactive(seat, &root->node); 310 focus = seat_get_focus_inactive(seat, &root->node);
311 seat_set_raw_focus(seat, next_focus); 311 seat_set_raw_focus(seat, next_focus);
312 if (focus->type == N_CONTAINER && focus->sway_container->workspace) { 312 if (focus->type == N_CONTAINER && focus->sway_container->pending.workspace) {
313 seat_set_raw_focus(seat, &focus->sway_container->workspace->node); 313 seat_set_raw_focus(seat, &focus->sway_container->pending.workspace->node);
314 } 314 }
315 seat_set_raw_focus(seat, focus); 315 seat_set_raw_focus(seat, focus);
316 } 316 }
@@ -1086,7 +1086,7 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
1086 } 1086 }
1087 1087
1088 struct sway_workspace *new_workspace = node->type == N_WORKSPACE ? 1088 struct sway_workspace *new_workspace = node->type == N_WORKSPACE ?
1089 node->sway_workspace : node->sway_container->workspace; 1089 node->sway_workspace : node->sway_container->pending.workspace;
1090 struct sway_container *container = node->type == N_CONTAINER ? 1090 struct sway_container *container = node->type == N_CONTAINER ?
1091 node->sway_container : NULL; 1091 node->sway_container : NULL;
1092 1092
@@ -1135,10 +1135,10 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
1135 // Put the container parents on the focus stack, then the workspace, then 1135 // Put the container parents on the focus stack, then the workspace, then
1136 // the focused container. 1136 // the focused container.
1137 if (container) { 1137 if (container) {
1138 struct sway_container *parent = container->parent; 1138 struct sway_container *parent = container->pending.parent;
1139 while (parent) { 1139 while (parent) {
1140 seat_set_raw_focus(seat, &parent->node); 1140 seat_set_raw_focus(seat, &parent->node);
1141 parent = parent->parent; 1141 parent = parent->pending.parent;
1142 } 1142 }
1143 } 1143 }
1144 if (new_workspace) { 1144 if (new_workspace) {
@@ -1327,7 +1327,7 @@ struct sway_container *seat_get_focus_inactive_tiling(struct sway_seat *seat,
1327 struct sway_node *node = current->node; 1327 struct sway_node *node = current->node;
1328 if (node->type == N_CONTAINER && 1328 if (node->type == N_CONTAINER &&
1329 !container_is_floating_or_child(node->sway_container) && 1329 !container_is_floating_or_child(node->sway_container) &&
1330 node->sway_container->workspace == workspace) { 1330 node->sway_container->pending.workspace == workspace) {
1331 return node->sway_container; 1331 return node->sway_container;
1332 } 1332 }
1333 } 1333 }
@@ -1344,7 +1344,7 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
1344 struct sway_node *node = current->node; 1344 struct sway_node *node = current->node;
1345 if (node->type == N_CONTAINER && 1345 if (node->type == N_CONTAINER &&
1346 container_is_floating_or_child(node->sway_container) && 1346 container_is_floating_or_child(node->sway_container) &&
1347 node->sway_container->workspace == workspace) { 1347 node->sway_container->pending.workspace == workspace) {
1348 return node->sway_container; 1348 return node->sway_container;
1349 } 1349 }
1350 } 1350 }
@@ -1392,7 +1392,7 @@ struct sway_workspace *seat_get_focused_workspace(struct sway_seat *seat) {
1392 return NULL; 1392 return NULL;
1393 } 1393 }
1394 if (focus->type == N_CONTAINER) { 1394 if (focus->type == N_CONTAINER) {
1395 return focus->sway_container->workspace; 1395 return focus->sway_container->pending.workspace;
1396 } 1396 }
1397 if (focus->type == N_WORKSPACE) { 1397 if (focus->type == N_WORKSPACE) {
1398 return focus->sway_workspace; 1398 return focus->sway_workspace;
@@ -1405,8 +1405,8 @@ struct sway_workspace *seat_get_last_known_workspace(struct sway_seat *seat) {
1405 wl_list_for_each(current, &seat->focus_stack, link) { 1405 wl_list_for_each(current, &seat->focus_stack, link) {
1406 struct sway_node *node = current->node; 1406 struct sway_node *node = current->node;
1407 if (node->type == N_CONTAINER && 1407 if (node->type == N_CONTAINER &&
1408 node->sway_container->workspace) { 1408 node->sway_container->pending.workspace) {
1409 return node->sway_container->workspace; 1409 return node->sway_container->pending.workspace;
1410 } else if (node->type == N_WORKSPACE) { 1410 } else if (node->type == N_WORKSPACE) {
1411 return node->sway_workspace; 1411 return node->sway_workspace;
1412 } 1412 }
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index 10d97309..f9eb8c8a 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -60,7 +60,7 @@ static bool edge_is_external(struct sway_container *cont, enum wlr_edges edge) {
60 return false; 60 return false;
61 } 61 }
62 } 62 }
63 cont = cont->parent; 63 cont = cont->pending.parent;
64 } 64 }
65 return true; 65 return true;
66} 66}
@@ -70,25 +70,25 @@ static enum wlr_edges find_edge(struct sway_container *cont,
70 if (!cont->view || (surface && cont->view->surface != surface)) { 70 if (!cont->view || (surface && cont->view->surface != surface)) {
71 return WLR_EDGE_NONE; 71 return WLR_EDGE_NONE;
72 } 72 }
73 if (cont->border == B_NONE || !cont->border_thickness || 73 if (cont->pending.border == B_NONE || !cont->pending.border_thickness ||
74 cont->border == B_CSD) { 74 cont->pending.border == B_CSD) {
75 return WLR_EDGE_NONE; 75 return WLR_EDGE_NONE;
76 } 76 }
77 if (cont->fullscreen_mode) { 77 if (cont->pending.fullscreen_mode) {
78 return WLR_EDGE_NONE; 78 return WLR_EDGE_NONE;
79 } 79 }
80 80
81 enum wlr_edges edge = 0; 81 enum wlr_edges edge = 0;
82 if (cursor->cursor->x < cont->x + cont->border_thickness) { 82 if (cursor->cursor->x < cont->pending.x + cont->pending.border_thickness) {
83 edge |= WLR_EDGE_LEFT; 83 edge |= WLR_EDGE_LEFT;
84 } 84 }
85 if (cursor->cursor->y < cont->y + cont->border_thickness) { 85 if (cursor->cursor->y < cont->pending.y + cont->pending.border_thickness) {
86 edge |= WLR_EDGE_TOP; 86 edge |= WLR_EDGE_TOP;
87 } 87 }
88 if (cursor->cursor->x >= cont->x + cont->width - cont->border_thickness) { 88 if (cursor->cursor->x >= cont->pending.x + cont->pending.width - cont->pending.border_thickness) {
89 edge |= WLR_EDGE_RIGHT; 89 edge |= WLR_EDGE_RIGHT;
90 } 90 }
91 if (cursor->cursor->y >= cont->y + cont->height - cont->border_thickness) { 91 if (cursor->cursor->y >= cont->pending.y + cont->pending.height - cont->pending.border_thickness) {
92 edge |= WLR_EDGE_BOTTOM; 92 edge |= WLR_EDGE_BOTTOM;
93 } 93 }
94 94
@@ -251,7 +251,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
251 251
252 // Handle moving a tiling container 252 // Handle moving a tiling container
253 if (config->tiling_drag && mod_pressed && !is_floating_or_child && 253 if (config->tiling_drag && mod_pressed && !is_floating_or_child &&
254 cont->fullscreen_mode == FULLSCREEN_NONE) { 254 cont->pending.fullscreen_mode == FULLSCREEN_NONE) {
255 seatop_begin_move_tiling(seat, cont); 255 seatop_begin_move_tiling(seat, cont);
256 return; 256 return;
257 } 257 }
@@ -386,7 +386,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
386 struct sway_container *cont_to_focus = cont; 386 struct sway_container *cont_to_focus = cont;
387 enum sway_container_layout layout = container_parent_layout(cont); 387 enum sway_container_layout layout = container_parent_layout(cont);
388 if (layout == L_TABBED || layout == L_STACKED) { 388 if (layout == L_TABBED || layout == L_STACKED) {
389 cont_to_focus = seat_get_focus_inactive_view(seat, &cont->parent->node); 389 cont_to_focus = seat_get_focus_inactive_view(seat, &cont->pending.parent->node);
390 } 390 }
391 391
392 seat_set_focus_container(seat, cont_to_focus); 392 seat_set_focus_container(seat, cont_to_focus);
@@ -402,9 +402,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
402 BTN_LEFT : BTN_RIGHT; 402 BTN_LEFT : BTN_RIGHT;
403 if (button == btn_resize) { 403 if (button == btn_resize) {
404 edge = 0; 404 edge = 0;
405 edge |= cursor->cursor->x > cont->x + cont->width / 2 ? 405 edge |= cursor->cursor->x > cont->pending.x + cont->pending.width / 2 ?
406 WLR_EDGE_RIGHT : WLR_EDGE_LEFT; 406 WLR_EDGE_RIGHT : WLR_EDGE_LEFT;
407 edge |= cursor->cursor->y > cont->y + cont->height / 2 ? 407 edge |= cursor->cursor->y > cont->pending.y + cont->pending.height / 2 ?
408 WLR_EDGE_BOTTOM : WLR_EDGE_TOP; 408 WLR_EDGE_BOTTOM : WLR_EDGE_TOP;
409 409
410 const char *image = NULL; 410 const char *image = NULL;
@@ -451,9 +451,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
451 if (mod_pressed && button == btn_resize) { 451 if (mod_pressed && button == btn_resize) {
452 struct sway_container *floater = container_toplevel_ancestor(cont); 452 struct sway_container *floater = container_toplevel_ancestor(cont);
453 edge = 0; 453 edge = 0;
454 edge |= cursor->cursor->x > floater->x + floater->width / 2 ? 454 edge |= cursor->cursor->x > floater->pending.x + floater->pending.width / 2 ?
455 WLR_EDGE_RIGHT : WLR_EDGE_LEFT; 455 WLR_EDGE_RIGHT : WLR_EDGE_LEFT;
456 edge |= cursor->cursor->y > floater->y + floater->height / 2 ? 456 edge |= cursor->cursor->y > floater->pending.y + floater->pending.height / 2 ?
457 WLR_EDGE_BOTTOM : WLR_EDGE_TOP; 457 WLR_EDGE_BOTTOM : WLR_EDGE_TOP;
458 seatop_begin_resize_floating(seat, floater, edge); 458 seatop_begin_resize_floating(seat, floater, edge);
459 return; 459 return;
@@ -463,7 +463,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
463 // Handle moving a tiling container 463 // Handle moving a tiling container
464 if (config->tiling_drag && (mod_pressed || on_titlebar) && 464 if (config->tiling_drag && (mod_pressed || on_titlebar) &&
465 state == WLR_BUTTON_PRESSED && !is_floating_or_child && 465 state == WLR_BUTTON_PRESSED && !is_floating_or_child &&
466 cont && cont->fullscreen_mode == FULLSCREEN_NONE) { 466 cont && cont->pending.fullscreen_mode == FULLSCREEN_NONE) {
467 struct sway_container *focus = seat_get_focused_container(seat); 467 struct sway_container *focus = seat_get_focused_container(seat);
468 bool focused = focus == cont || container_has_ancestor(focus, cont); 468 bool focused = focus == cont || container_has_ancestor(focus, cont);
469 if (on_titlebar && !focused) { 469 if (on_titlebar && !focused) {
@@ -674,7 +674,7 @@ static void handle_pointer_axis(struct sway_seat *seat,
674 bool on_border = edge != WLR_EDGE_NONE; 674 bool on_border = edge != WLR_EDGE_NONE;
675 bool on_titlebar = cont && !on_border && !surface; 675 bool on_titlebar = cont && !on_border && !surface;
676 bool on_titlebar_border = cont && on_border && 676 bool on_titlebar_border = cont && on_border &&
677 cursor->cursor->y < cont->content_y; 677 cursor->cursor->y < cont->pending.content_y;
678 bool on_contents = cont && !on_border && surface; 678 bool on_contents = cont && !on_border && surface;
679 bool on_workspace = node && node->type == N_WORKSPACE; 679 bool on_workspace = node && node->type == N_WORKSPACE;
680 float scroll_factor = 680 float scroll_factor =
diff --git a/sway/input/seatop_move_floating.c b/sway/input/seatop_move_floating.c
index 6683be21..ddcd4c53 100644
--- a/sway/input/seatop_move_floating.c
+++ b/sway/input/seatop_move_floating.c
@@ -15,7 +15,7 @@ static void finalize_move(struct sway_seat *seat) {
15 15
16 // We "move" the container to its own location 16 // We "move" the container to its own location
17 // so it discovers its output again. 17 // so it discovers its output again.
18 container_floating_move_to(e->con, e->con->x, e->con->y); 18 container_floating_move_to(e->con, e->con->pending.x, e->con->pending.y);
19 transaction_commit_dirty(); 19 transaction_commit_dirty();
20 20
21 seatop_begin_default(seat); 21 seatop_begin_default(seat);
@@ -70,8 +70,8 @@ void seatop_begin_move_floating(struct sway_seat *seat,
70 return; 70 return;
71 } 71 }
72 e->con = con; 72 e->con = con;
73 e->dx = cursor->cursor->x - con->x; 73 e->dx = cursor->cursor->x - con->pending.x;
74 e->dy = cursor->cursor->y - con->y; 74 e->dy = cursor->cursor->y - con->pending.y;
75 75
76 seat->seatop_impl = &seatop_impl; 76 seat->seatop_impl = &seatop_impl;
77 seat->seatop_data = e; 77 seat->seatop_data = e;
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c
index 7d9ecd8f..446612c6 100644
--- a/sway/input/seatop_move_tiling.c
+++ b/sway/input/seatop_move_tiling.c
@@ -120,8 +120,8 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
120 120
121 // Deny moving within own workspace if this is the only child 121 // Deny moving within own workspace if this is the only child
122 struct sway_container *con = node->sway_container; 122 struct sway_container *con = node->sway_container;
123 if (workspace_num_tiling_views(e->con->workspace) == 1 && 123 if (workspace_num_tiling_views(e->con->pending.workspace) == 1 &&
124 con->workspace == e->con->workspace) { 124 con->pending.workspace == e->con->pending.workspace) {
125 e->target_node = NULL; 125 e->target_node = NULL;
126 e->target_edge = WLR_EDGE_NONE; 126 e->target_edge = WLR_EDGE_NONE;
127 return; 127 return;
@@ -133,8 +133,8 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
133 enum wlr_edges edge = WLR_EDGE_NONE; 133 enum wlr_edges edge = WLR_EDGE_NONE;
134 enum sway_container_layout layout = container_parent_layout(con); 134 enum sway_container_layout layout = container_parent_layout(con);
135 struct wlr_box parent; 135 struct wlr_box parent;
136 con->parent ? container_get_box(con->parent, &parent) : 136 con->pending.parent ? container_get_box(con->pending.parent, &parent) :
137 workspace_get_box(con->workspace, &parent); 137 workspace_get_box(con->pending.workspace, &parent);
138 if (layout == L_HORIZ || layout == L_TABBED) { 138 if (layout == L_HORIZ || layout == L_TABBED) {
139 if (cursor->cursor->y < parent.y + DROP_LAYOUT_BORDER) { 139 if (cursor->cursor->y < parent.y + DROP_LAYOUT_BORDER) {
140 edge = WLR_EDGE_TOP; 140 edge = WLR_EDGE_TOP;
@@ -161,7 +161,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
161 desktop_damage_box(&e->drop_box); 161 desktop_damage_box(&e->drop_box);
162 return; 162 return;
163 } 163 }
164 con = con->parent; 164 con = con->pending.parent;
165 } 165 }
166 166
167 // Use the hovered view - but we must be over the actual surface 167 // Use the hovered view - but we must be over the actual surface
@@ -174,23 +174,23 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
174 } 174 }
175 175
176 // Find the closest edge 176 // Find the closest edge
177 size_t thickness = fmin(con->content_width, con->content_height) * 0.3; 177 size_t thickness = fmin(con->pending.content_width, con->pending.content_height) * 0.3;
178 size_t closest_dist = INT_MAX; 178 size_t closest_dist = INT_MAX;
179 size_t dist; 179 size_t dist;
180 e->target_edge = WLR_EDGE_NONE; 180 e->target_edge = WLR_EDGE_NONE;
181 if ((dist = cursor->cursor->y - con->y) < closest_dist) { 181 if ((dist = cursor->cursor->y - con->pending.y) < closest_dist) {
182 closest_dist = dist; 182 closest_dist = dist;
183 e->target_edge = WLR_EDGE_TOP; 183 e->target_edge = WLR_EDGE_TOP;
184 } 184 }
185 if ((dist = cursor->cursor->x - con->x) < closest_dist) { 185 if ((dist = cursor->cursor->x - con->pending.x) < closest_dist) {
186 closest_dist = dist; 186 closest_dist = dist;
187 e->target_edge = WLR_EDGE_LEFT; 187 e->target_edge = WLR_EDGE_LEFT;
188 } 188 }
189 if ((dist = con->x + con->width - cursor->cursor->x) < closest_dist) { 189 if ((dist = con->pending.x + con->pending.width - cursor->cursor->x) < closest_dist) {
190 closest_dist = dist; 190 closest_dist = dist;
191 e->target_edge = WLR_EDGE_RIGHT; 191 e->target_edge = WLR_EDGE_RIGHT;
192 } 192 }
193 if ((dist = con->y + con->height - cursor->cursor->y) < closest_dist) { 193 if ((dist = con->pending.y + con->pending.height - cursor->cursor->y) < closest_dist) {
194 closest_dist = dist; 194 closest_dist = dist;
195 e->target_edge = WLR_EDGE_BOTTOM; 195 e->target_edge = WLR_EDGE_BOTTOM;
196 } 196 }
@@ -200,10 +200,10 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
200 } 200 }
201 201
202 e->target_node = node; 202 e->target_node = node;
203 e->drop_box.x = con->content_x; 203 e->drop_box.x = con->pending.content_x;
204 e->drop_box.y = con->content_y; 204 e->drop_box.y = con->pending.content_y;
205 e->drop_box.width = con->content_width; 205 e->drop_box.width = con->pending.content_width;
206 e->drop_box.height = con->content_height; 206 e->drop_box.height = con->pending.content_height;
207 resize_box(&e->drop_box, e->target_edge, thickness); 207 resize_box(&e->drop_box, e->target_edge, thickness);
208 desktop_damage_box(&e->drop_box); 208 desktop_damage_box(&e->drop_box);
209} 209}
@@ -234,11 +234,11 @@ static void finalize_move(struct sway_seat *seat) {
234 } 234 }
235 235
236 struct sway_container *con = e->con; 236 struct sway_container *con = e->con;
237 struct sway_container *old_parent = con->parent; 237 struct sway_container *old_parent = con->pending.parent;
238 struct sway_workspace *old_ws = con->workspace; 238 struct sway_workspace *old_ws = con->pending.workspace;
239 struct sway_node *target_node = e->target_node; 239 struct sway_node *target_node = e->target_node;
240 struct sway_workspace *new_ws = target_node->type == N_WORKSPACE ? 240 struct sway_workspace *new_ws = target_node->type == N_WORKSPACE ?
241 target_node->sway_workspace : target_node->sway_container->workspace; 241 target_node->sway_workspace : target_node->sway_container->pending.workspace;
242 enum wlr_edges edge = e->target_edge; 242 enum wlr_edges edge = e->target_edge;
243 int after = edge != WLR_EDGE_TOP && edge != WLR_EDGE_LEFT; 243 int after = edge != WLR_EDGE_TOP && edge != WLR_EDGE_LEFT;
244 bool swap = edge == WLR_EDGE_NONE && target_node->type == N_CONTAINER; 244 bool swap = edge == WLR_EDGE_NONE && target_node->type == N_CONTAINER;
@@ -285,8 +285,8 @@ static void finalize_move(struct sway_seat *seat) {
285 int index = list_find(siblings, con); 285 int index = list_find(siblings, con);
286 struct sway_container *sibling = index == 0 ? 286 struct sway_container *sibling = index == 0 ?
287 siblings->items[1] : siblings->items[index - 1]; 287 siblings->items[1] : siblings->items[index - 1];
288 con->width = sibling->width; 288 con->pending.width = sibling->pending.width;
289 con->height = sibling->height; 289 con->pending.height = sibling->pending.height;
290 con->width_fraction = sibling->width_fraction; 290 con->width_fraction = sibling->width_fraction;
291 con->height_fraction = sibling->height_fraction; 291 con->height_fraction = sibling->height_fraction;
292 } 292 }
diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c
index 78dfe29f..8400a4b3 100644
--- a/sway/input/seatop_resize_floating.c
+++ b/sway/input/seatop_resize_floating.c
@@ -118,21 +118,21 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) {
118 118
119 // Determine the amounts we need to bump everything relative to the current 119 // Determine the amounts we need to bump everything relative to the current
120 // size. 120 // size.
121 int relative_grow_width = width - con->width; 121 int relative_grow_width = width - con->pending.width;
122 int relative_grow_height = height - con->height; 122 int relative_grow_height = height - con->pending.height;
123 int relative_grow_x = (e->ref_con_lx + grow_x) - con->x; 123 int relative_grow_x = (e->ref_con_lx + grow_x) - con->pending.x;
124 int relative_grow_y = (e->ref_con_ly + grow_y) - con->y; 124 int relative_grow_y = (e->ref_con_ly + grow_y) - con->pending.y;
125 125
126 // Actually resize stuff 126 // Actually resize stuff
127 con->x += relative_grow_x; 127 con->pending.x += relative_grow_x;
128 con->y += relative_grow_y; 128 con->pending.y += relative_grow_y;
129 con->width += relative_grow_width; 129 con->pending.width += relative_grow_width;
130 con->height += relative_grow_height; 130 con->pending.height += relative_grow_height;
131 131
132 con->content_x += relative_grow_x; 132 con->pending.content_x += relative_grow_x;
133 con->content_y += relative_grow_y; 133 con->pending.content_y += relative_grow_y;
134 con->content_width += relative_grow_width; 134 con->pending.content_width += relative_grow_width;
135 con->content_height += relative_grow_height; 135 con->pending.content_height += relative_grow_height;
136 136
137 arrange_container(con); 137 arrange_container(con);
138 transaction_commit_dirty(); 138 transaction_commit_dirty();
@@ -169,10 +169,10 @@ void seatop_begin_resize_floating(struct sway_seat *seat,
169 e->edge = edge == WLR_EDGE_NONE ? WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT : edge; 169 e->edge = edge == WLR_EDGE_NONE ? WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT : edge;
170 e->ref_lx = seat->cursor->cursor->x; 170 e->ref_lx = seat->cursor->cursor->x;
171 e->ref_ly = seat->cursor->cursor->y; 171 e->ref_ly = seat->cursor->cursor->y;
172 e->ref_con_lx = con->x; 172 e->ref_con_lx = con->pending.x;
173 e->ref_con_ly = con->y; 173 e->ref_con_ly = con->pending.y;
174 e->ref_width = con->width; 174 e->ref_width = con->pending.width;
175 e->ref_height = con->height; 175 e->ref_height = con->pending.height;
176 176
177 seat->seatop_impl = &seatop_impl; 177 seat->seatop_impl = &seatop_impl;
178 seat->seatop_data = e; 178 seat->seatop_data = e;
diff --git a/sway/input/seatop_resize_tiling.c b/sway/input/seatop_resize_tiling.c
index c5fe269e..869d11b5 100644
--- a/sway/input/seatop_resize_tiling.c
+++ b/sway/input/seatop_resize_tiling.c
@@ -53,19 +53,19 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
53 if (e->h_con) { 53 if (e->h_con) {
54 container_set_resizing(e->h_con, false); 54 container_set_resizing(e->h_con, false);
55 container_set_resizing(e->h_sib, false); 55 container_set_resizing(e->h_sib, false);
56 if (e->h_con->parent) { 56 if (e->h_con->pending.parent) {
57 arrange_container(e->h_con->parent); 57 arrange_container(e->h_con->pending.parent);
58 } else { 58 } else {
59 arrange_workspace(e->h_con->workspace); 59 arrange_workspace(e->h_con->pending.workspace);
60 } 60 }
61 } 61 }
62 if (e->v_con) { 62 if (e->v_con) {
63 container_set_resizing(e->v_con, false); 63 container_set_resizing(e->v_con, false);
64 container_set_resizing(e->v_sib, false); 64 container_set_resizing(e->v_sib, false);
65 if (e->v_con->parent) { 65 if (e->v_con->pending.parent) {
66 arrange_container(e->v_con->parent); 66 arrange_container(e->v_con->pending.parent);
67 } else { 67 } else {
68 arrange_workspace(e->v_con->workspace); 68 arrange_workspace(e->v_con->pending.workspace);
69 } 69 }
70 } 70 }
71 transaction_commit_dirty(); 71 transaction_commit_dirty();
@@ -82,16 +82,16 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) {
82 82
83 if (e->h_con) { 83 if (e->h_con) {
84 if (e->edge & WLR_EDGE_LEFT) { 84 if (e->edge & WLR_EDGE_LEFT) {
85 amount_x = (e->h_con_orig_width - moved_x) - e->h_con->width; 85 amount_x = (e->h_con_orig_width - moved_x) - e->h_con->pending.width;
86 } else if (e->edge & WLR_EDGE_RIGHT) { 86 } else if (e->edge & WLR_EDGE_RIGHT) {
87 amount_x = (e->h_con_orig_width + moved_x) - e->h_con->width; 87 amount_x = (e->h_con_orig_width + moved_x) - e->h_con->pending.width;
88 } 88 }
89 } 89 }
90 if (e->v_con) { 90 if (e->v_con) {
91 if (e->edge & WLR_EDGE_TOP) { 91 if (e->edge & WLR_EDGE_TOP) {
92 amount_y = (e->v_con_orig_height - moved_y) - e->v_con->height; 92 amount_y = (e->v_con_orig_height - moved_y) - e->v_con->pending.height;
93 } else if (e->edge & WLR_EDGE_BOTTOM) { 93 } else if (e->edge & WLR_EDGE_BOTTOM) {
94 amount_y = (e->v_con_orig_height + moved_y) - e->v_con->height; 94 amount_y = (e->v_con_orig_height + moved_y) - e->v_con->pending.height;
95 } 95 }
96 } 96 }
97 97
@@ -143,7 +143,7 @@ void seatop_begin_resize_tiling(struct sway_seat *seat,
143 if (e->h_con) { 143 if (e->h_con) {
144 container_set_resizing(e->h_con, true); 144 container_set_resizing(e->h_con, true);
145 container_set_resizing(e->h_sib, true); 145 container_set_resizing(e->h_sib, true);
146 e->h_con_orig_width = e->h_con->width; 146 e->h_con_orig_width = e->h_con->pending.width;
147 } 147 }
148 } 148 }
149 if (edge & (WLR_EDGE_TOP | WLR_EDGE_BOTTOM)) { 149 if (edge & (WLR_EDGE_TOP | WLR_EDGE_BOTTOM)) {
@@ -154,7 +154,7 @@ void seatop_begin_resize_tiling(struct sway_seat *seat,
154 if (e->v_con) { 154 if (e->v_con) {
155 container_set_resizing(e->v_con, true); 155 container_set_resizing(e->v_con, true);
156 container_set_resizing(e->v_sib, true); 156 container_set_resizing(e->v_sib, true);
157 e->v_con_orig_height = e->v_con->height; 157 e->v_con_orig_height = e->v_con->pending.height;
158 } 158 }
159 } 159 }
160 160
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index cfc6dfcf..2c4c52a3 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -456,27 +456,27 @@ static void get_deco_rect(struct sway_container *c, struct wlr_box *deco_rect) {
456 bool tab_or_stack = parent_layout == L_TABBED || parent_layout == L_STACKED; 456 bool tab_or_stack = parent_layout == L_TABBED || parent_layout == L_STACKED;
457 if (((!tab_or_stack || container_is_floating(c)) && 457 if (((!tab_or_stack || container_is_floating(c)) &&
458 c->current.border != B_NORMAL) || 458 c->current.border != B_NORMAL) ||
459 c->fullscreen_mode != FULLSCREEN_NONE || 459 c->pending.fullscreen_mode != FULLSCREEN_NONE ||
460 c->workspace == NULL) { 460 c->pending.workspace == NULL) {
461 deco_rect->x = deco_rect->y = deco_rect->width = deco_rect->height = 0; 461 deco_rect->x = deco_rect->y = deco_rect->width = deco_rect->height = 0;
462 return; 462 return;
463 } 463 }
464 464
465 if (c->parent) { 465 if (c->pending.parent) {
466 deco_rect->x = c->x - c->parent->x; 466 deco_rect->x = c->pending.x - c->pending.parent->pending.x;
467 deco_rect->y = c->y - c->parent->y; 467 deco_rect->y = c->pending.y - c->pending.parent->pending.y;
468 } else { 468 } else {
469 deco_rect->x = c->x - c->workspace->x; 469 deco_rect->x = c->pending.x - c->pending.workspace->x;
470 deco_rect->y = c->y - c->workspace->y; 470 deco_rect->y = c->pending.y - c->pending.workspace->y;
471 } 471 }
472 deco_rect->width = c->width; 472 deco_rect->width = c->pending.width;
473 deco_rect->height = container_titlebar_height(); 473 deco_rect->height = container_titlebar_height();
474 474
475 if (!container_is_floating(c)) { 475 if (!container_is_floating(c)) {
476 if (parent_layout == L_TABBED) { 476 if (parent_layout == L_TABBED) {
477 deco_rect->width = c->parent 477 deco_rect->width = c->pending.parent
478 ? c->parent->width / c->parent->children->length 478 ? c->pending.parent->pending.width / c->pending.parent->pending.children->length
479 : c->workspace->width / c->workspace->tiling->length; 479 : c->pending.workspace->width / c->pending.workspace->tiling->length;
480 deco_rect->x += deco_rect->width * container_sibling_index(c); 480 deco_rect->x += deco_rect->width * container_sibling_index(c);
481 } else if (parent_layout == L_STACKED) { 481 } else if (parent_layout == L_STACKED) {
482 if (!c->view) { 482 if (!c->view) {
@@ -499,10 +499,10 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
499 json_object_object_add(object, "visible", json_object_new_boolean(visible)); 499 json_object_object_add(object, "visible", json_object_new_boolean(visible));
500 500
501 struct wlr_box window_box = { 501 struct wlr_box window_box = {
502 c->content_x - c->x, 502 c->pending.content_x - c->pending.x,
503 (c->current.border == B_PIXEL) ? c->current.border_thickness : 0, 503 (c->current.border == B_PIXEL) ? c->current.border_thickness : 0,
504 c->content_width, 504 c->pending.content_width,
505 c->content_height 505 c->pending.content_height
506 }; 506 };
507 507
508 json_object_object_add(object, "window_rect", ipc_json_create_rect(&window_box)); 508 json_object_object_add(object, "window_rect", ipc_json_create_rect(&window_box));
@@ -595,11 +595,11 @@ static void ipc_json_describe_container(struct sway_container *c, json_object *o
595 595
596 json_object_object_add(object, "layout", 596 json_object_object_add(object, "layout",
597 json_object_new_string( 597 json_object_new_string(
598 ipc_json_layout_description(c->layout))); 598 ipc_json_layout_description(c->pending.layout)));
599 599
600 json_object_object_add(object, "orientation", 600 json_object_object_add(object, "orientation",
601 json_object_new_string( 601 json_object_new_string(
602 ipc_json_orientation_description(c->layout))); 602 ipc_json_orientation_description(c->pending.layout)));
603 603
604 bool urgent = c->view ? 604 bool urgent = c->view ?
605 view_is_urgent(c->view) : container_has_urgent_child(c); 605 view_is_urgent(c->view) : container_has_urgent_child(c);
@@ -607,7 +607,7 @@ static void ipc_json_describe_container(struct sway_container *c, json_object *o
607 json_object_object_add(object, "sticky", json_object_new_boolean(c->is_sticky)); 607 json_object_object_add(object, "sticky", json_object_new_boolean(c->is_sticky));
608 608
609 json_object_object_add(object, "fullscreen_mode", 609 json_object_object_add(object, "fullscreen_mode",
610 json_object_new_int(c->fullscreen_mode)); 610 json_object_new_int(c->pending.fullscreen_mode));
611 611
612 struct sway_node *parent = node_get_parent(&c->node); 612 struct sway_node *parent = node_get_parent(&c->node);
613 struct wlr_box parent_box = {0, 0, 0, 0}; 613 struct wlr_box parent_box = {0, 0, 0, 0};
@@ -617,8 +617,8 @@ static void ipc_json_describe_container(struct sway_container *c, json_object *o
617 } 617 }
618 618
619 if (parent_box.width != 0 && parent_box.height != 0) { 619 if (parent_box.width != 0 && parent_box.height != 0) {
620 double percent = ((double)c->width / parent_box.width) 620 double percent = ((double)c->pending.width / parent_box.width)
621 * ((double)c->height / parent_box.height); 621 * ((double)c->pending.height / parent_box.height);
622 json_object_object_add(object, "percent", json_object_new_double(percent)); 622 json_object_object_add(object, "percent", json_object_new_double(percent));
623 } 623 }
624 624
@@ -749,10 +749,10 @@ json_object *ipc_json_describe_node_recursive(struct sway_node *node) {
749 } 749 }
750 break; 750 break;
751 case N_CONTAINER: 751 case N_CONTAINER:
752 if (node->sway_container->children) { 752 if (node->sway_container->pending.children) {
753 for (i = 0; i < node->sway_container->children->length; ++i) { 753 for (i = 0; i < node->sway_container->pending.children->length; ++i) {
754 struct sway_container *child = 754 struct sway_container *child =
755 node->sway_container->children->items[i]; 755 node->sway_container->pending.children->items[i];
756 json_object_array_add(children, 756 json_object_array_add(children,
757 ipc_json_describe_node_recursive(&child->node)); 757 ipc_json_describe_node_recursive(&child->node));
758 } 758 }
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index bac9f2fa..4aa82c35 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -55,7 +55,7 @@ static void apply_horiz_layout(list_t *children, struct wlr_box *parent) {
55 // Calculate gap size 55 // Calculate gap size
56 double inner_gap = 0; 56 double inner_gap = 0;
57 struct sway_container *child = children->items[0]; 57 struct sway_container *child = children->items[0];
58 struct sway_workspace *ws = child->workspace; 58 struct sway_workspace *ws = child->pending.workspace;
59 if (ws) { 59 if (ws) {
60 inner_gap = ws->gaps_inner; 60 inner_gap = ws->gaps_inner;
61 } 61 }
@@ -66,7 +66,7 @@ static void apply_horiz_layout(list_t *children, struct wlr_box *parent) {
66 if (layout == L_TABBED || layout == L_STACKED) { 66 if (layout == L_TABBED || layout == L_STACKED) {
67 inner_gap = 0; 67 inner_gap = 0;
68 } 68 }
69 temp = temp->parent; 69 temp = temp->pending.parent;
70 } 70 }
71 double total_gap = fmin(inner_gap * (children->length - 1), 71 double total_gap = fmin(inner_gap * (children->length - 1),
72 fmax(0, parent->width - MIN_SANE_W * children->length)); 72 fmax(0, parent->width - MIN_SANE_W * children->length));
@@ -79,15 +79,15 @@ static void apply_horiz_layout(list_t *children, struct wlr_box *parent) {
79 for (int i = 0; i < children->length; ++i) { 79 for (int i = 0; i < children->length; ++i) {
80 struct sway_container *child = children->items[i]; 80 struct sway_container *child = children->items[i];
81 child->child_total_width = child_total_width; 81 child->child_total_width = child_total_width;
82 child->x = child_x; 82 child->pending.x = child_x;
83 child->y = parent->y; 83 child->pending.y = parent->y;
84 child->width = round(child->width_fraction * child_total_width); 84 child->pending.width = round(child->width_fraction * child_total_width);
85 child->height = parent->height; 85 child->pending.height = parent->height;
86 child_x += child->width + inner_gap; 86 child_x += child->pending.width + inner_gap;
87 87
88 // Make last child use remaining width of parent 88 // Make last child use remaining width of parent
89 if (i == children->length - 1) { 89 if (i == children->length - 1) {
90 child->width = parent->x + parent->width - child->x; 90 child->pending.width = parent->x + parent->width - child->pending.x;
91 } 91 }
92 } 92 }
93} 93}
@@ -134,7 +134,7 @@ static void apply_vert_layout(list_t *children, struct wlr_box *parent) {
134 // Calculate gap size 134 // Calculate gap size
135 double inner_gap = 0; 135 double inner_gap = 0;
136 struct sway_container *child = children->items[0]; 136 struct sway_container *child = children->items[0];
137 struct sway_workspace *ws = child->workspace; 137 struct sway_workspace *ws = child->pending.workspace;
138 if (ws) { 138 if (ws) {
139 inner_gap = ws->gaps_inner; 139 inner_gap = ws->gaps_inner;
140 } 140 }
@@ -145,7 +145,7 @@ static void apply_vert_layout(list_t *children, struct wlr_box *parent) {
145 if (layout == L_TABBED || layout == L_STACKED) { 145 if (layout == L_TABBED || layout == L_STACKED) {
146 inner_gap = 0; 146 inner_gap = 0;
147 } 147 }
148 temp = temp->parent; 148 temp = temp->pending.parent;
149 } 149 }
150 double total_gap = fmin(inner_gap * (children->length - 1), 150 double total_gap = fmin(inner_gap * (children->length - 1),
151 fmax(0, parent->height - MIN_SANE_H * children->length)); 151 fmax(0, parent->height - MIN_SANE_H * children->length));
@@ -158,15 +158,15 @@ static void apply_vert_layout(list_t *children, struct wlr_box *parent) {
158 for (int i = 0; i < children->length; ++i) { 158 for (int i = 0; i < children->length; ++i) {
159 struct sway_container *child = children->items[i]; 159 struct sway_container *child = children->items[i];
160 child->child_total_height = child_total_height; 160 child->child_total_height = child_total_height;
161 child->x = parent->x; 161 child->pending.x = parent->x;
162 child->y = child_y; 162 child->pending.y = child_y;
163 child->width = parent->width; 163 child->pending.width = parent->width;
164 child->height = round(child->height_fraction * child_total_height); 164 child->pending.height = round(child->height_fraction * child_total_height);
165 child_y += child->height + inner_gap; 165 child_y += child->pending.height + inner_gap;
166 166
167 // Make last child use remaining height of parent 167 // Make last child use remaining height of parent
168 if (i == children->length - 1) { 168 if (i == children->length - 1) {
169 child->height = parent->y + parent->height - child->y; 169 child->pending.height = parent->y + parent->height - child->pending.y;
170 } 170 }
171 } 171 }
172} 172}
@@ -178,10 +178,10 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) {
178 for (int i = 0; i < children->length; ++i) { 178 for (int i = 0; i < children->length; ++i) {
179 struct sway_container *child = children->items[i]; 179 struct sway_container *child = children->items[i];
180 int parent_offset = child->view ? 0 : container_titlebar_height(); 180 int parent_offset = child->view ? 0 : container_titlebar_height();
181 child->x = parent->x; 181 child->pending.x = parent->x;
182 child->y = parent->y + parent_offset; 182 child->pending.y = parent->y + parent_offset;
183 child->width = parent->width; 183 child->pending.width = parent->width;
184 child->height = parent->height - parent_offset; 184 child->pending.height = parent->height - parent_offset;
185 } 185 }
186} 186}
187 187
@@ -193,10 +193,10 @@ static void apply_stacked_layout(list_t *children, struct wlr_box *parent) {
193 struct sway_container *child = children->items[i]; 193 struct sway_container *child = children->items[i];
194 int parent_offset = child->view ? 0 : 194 int parent_offset = child->view ? 0 :
195 container_titlebar_height() * children->length; 195 container_titlebar_height() * children->length;
196 child->x = parent->x; 196 child->pending.x = parent->x;
197 child->y = parent->y + parent_offset; 197 child->pending.y = parent->y + parent_offset;
198 child->width = parent->width; 198 child->pending.width = parent->width;
199 child->height = parent->height - parent_offset; 199 child->pending.height = parent->height - parent_offset;
200 } 200 }
201} 201}
202 202
@@ -246,7 +246,7 @@ void arrange_container(struct sway_container *container) {
246 } 246 }
247 struct wlr_box box; 247 struct wlr_box box;
248 container_get_box(container, &box); 248 container_get_box(container, &box);
249 arrange_children(container->children, container->layout, &box); 249 arrange_children(container->pending.children, container->pending.layout, &box);
250 node_set_dirty(&container->node); 250 node_set_dirty(&container->node);
251} 251}
252 252
@@ -278,8 +278,8 @@ void arrange_workspace(struct sway_workspace *workspace) {
278 for (int i = 0; i < workspace->floating->length; ++i) { 278 for (int i = 0; i < workspace->floating->length; ++i) {
279 struct sway_container *floater = workspace->floating->items[i]; 279 struct sway_container *floater = workspace->floating->items[i];
280 container_floating_translate(floater, diff_x, diff_y); 280 container_floating_translate(floater, diff_x, diff_y);
281 double center_x = floater->x + floater->width / 2; 281 double center_x = floater->pending.x + floater->pending.width / 2;
282 double center_y = floater->y + floater->height / 2; 282 double center_y = floater->pending.y + floater->pending.height / 2;
283 struct wlr_box workspace_box; 283 struct wlr_box workspace_box;
284 workspace_get_box(workspace, &workspace_box); 284 workspace_get_box(workspace, &workspace_box);
285 if (!wlr_box_contains_point(&workspace_box, center_x, center_y)) { 285 if (!wlr_box_contains_point(&workspace_box, center_x, center_y)) {
@@ -294,10 +294,10 @@ void arrange_workspace(struct sway_workspace *workspace) {
294 workspace->x, workspace->y); 294 workspace->x, workspace->y);
295 if (workspace->fullscreen) { 295 if (workspace->fullscreen) {
296 struct sway_container *fs = workspace->fullscreen; 296 struct sway_container *fs = workspace->fullscreen;
297 fs->x = output->lx; 297 fs->pending.x = output->lx;
298 fs->y = output->ly; 298 fs->pending.y = output->ly;
299 fs->width = output->width; 299 fs->pending.width = output->width;
300 fs->height = output->height; 300 fs->pending.height = output->height;
301 arrange_container(fs); 301 arrange_container(fs);
302 } else { 302 } else {
303 struct wlr_box box; 303 struct wlr_box box;
@@ -337,10 +337,10 @@ void arrange_root(void) {
337 337
338 if (root->fullscreen_global) { 338 if (root->fullscreen_global) {
339 struct sway_container *fs = root->fullscreen_global; 339 struct sway_container *fs = root->fullscreen_global;
340 fs->x = root->x; 340 fs->pending.x = root->x;
341 fs->y = root->y; 341 fs->pending.y = root->y;
342 fs->width = root->width; 342 fs->pending.width = root->width;
343 fs->height = root->height; 343 fs->pending.height = root->height;
344 arrange_container(fs); 344 arrange_container(fs);
345 } else { 345 } else {
346 for (int i = 0; i < root->outputs->length; ++i) { 346 for (int i = 0; i < root->outputs->length; ++i) {
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 6a9ce1c4..8c8dfb3b 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -30,12 +30,12 @@ struct sway_container *container_create(struct sway_view *view) {
30 return NULL; 30 return NULL;
31 } 31 }
32 node_init(&c->node, N_CONTAINER, c); 32 node_init(&c->node, N_CONTAINER, c);
33 c->layout = L_NONE; 33 c->pending.layout = L_NONE;
34 c->view = view; 34 c->view = view;
35 c->alpha = 1.0f; 35 c->alpha = 1.0f;
36 36
37 if (!view) { 37 if (!view) {
38 c->children = create_list(); 38 c->pending.children = create_list();
39 c->current.children = create_list(); 39 c->current.children = create_list();
40 } 40 }
41 c->marks = create_list(); 41 c->marks = create_list();
@@ -62,7 +62,7 @@ void container_destroy(struct sway_container *con) {
62 wlr_texture_destroy(con->title_focused_inactive); 62 wlr_texture_destroy(con->title_focused_inactive);
63 wlr_texture_destroy(con->title_unfocused); 63 wlr_texture_destroy(con->title_unfocused);
64 wlr_texture_destroy(con->title_urgent); 64 wlr_texture_destroy(con->title_urgent);
65 list_free(con->children); 65 list_free(con->pending.children);
66 list_free(con->current.children); 66 list_free(con->current.children);
67 list_free(con->outputs); 67 list_free(con->outputs);
68 68
@@ -90,10 +90,10 @@ void container_begin_destroy(struct sway_container *con) {
90 } 90 }
91 // The workspace must have the fullscreen pointer cleared so that the 91 // The workspace must have the fullscreen pointer cleared so that the
92 // seat code can find an appropriate new focus. 92 // seat code can find an appropriate new focus.
93 if (con->fullscreen_mode == FULLSCREEN_WORKSPACE && con->workspace) { 93 if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE && con->pending.workspace) {
94 con->workspace->fullscreen = NULL; 94 con->pending.workspace->fullscreen = NULL;
95 } 95 }
96 if (con->scratchpad && con->fullscreen_mode == FULLSCREEN_GLOBAL) { 96 if (con->scratchpad && con->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
97 container_fullscreen_disable(con); 97 container_fullscreen_disable(con);
98 } 98 }
99 99
@@ -108,11 +108,11 @@ void container_begin_destroy(struct sway_container *con) {
108 root_scratchpad_remove_container(con); 108 root_scratchpad_remove_container(con);
109 } 109 }
110 110
111 if (con->fullscreen_mode == FULLSCREEN_GLOBAL) { 111 if (con->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
112 container_fullscreen_disable(con); 112 container_fullscreen_disable(con);
113 } 113 }
114 114
115 if (con->parent || con->workspace) { 115 if (con->pending.parent || con->pending.workspace) {
116 container_detach(con); 116 container_detach(con);
117 } 117 }
118} 118}
@@ -121,12 +121,12 @@ void container_reap_empty(struct sway_container *con) {
121 if (con->view) { 121 if (con->view) {
122 return; 122 return;
123 } 123 }
124 struct sway_workspace *ws = con->workspace; 124 struct sway_workspace *ws = con->pending.workspace;
125 while (con) { 125 while (con) {
126 if (con->children->length) { 126 if (con->pending.children->length) {
127 return; 127 return;
128 } 128 }
129 struct sway_container *parent = con->parent; 129 struct sway_container *parent = con->pending.parent;
130 container_begin_destroy(con); 130 container_begin_destroy(con);
131 con = parent; 131 con = parent;
132 } 132 }
@@ -139,9 +139,9 @@ struct sway_container *container_flatten(struct sway_container *container) {
139 if (container->view) { 139 if (container->view) {
140 return NULL; 140 return NULL;
141 } 141 }
142 while (container && container->children->length == 1) { 142 while (container && container->pending.children->length == 1) {
143 struct sway_container *child = container->children->items[0]; 143 struct sway_container *child = container->pending.children->items[0];
144 struct sway_container *parent = container->parent; 144 struct sway_container *parent = container->pending.parent;
145 container_replace(container, child); 145 container_replace(container, child);
146 container_begin_destroy(container); 146 container_begin_destroy(container);
147 container = parent; 147 container = parent;
@@ -151,11 +151,11 @@ struct sway_container *container_flatten(struct sway_container *container) {
151 151
152struct sway_container *container_find_child(struct sway_container *container, 152struct sway_container *container_find_child(struct sway_container *container,
153 bool (*test)(struct sway_container *con, void *data), void *data) { 153 bool (*test)(struct sway_container *con, void *data), void *data) {
154 if (!container->children) { 154 if (!container->pending.children) {
155 return NULL; 155 return NULL;
156 } 156 }
157 for (int i = 0; i < container->children->length; ++i) { 157 for (int i = 0; i < container->pending.children->length; ++i) {
158 struct sway_container *child = container->children->items[i]; 158 struct sway_container *child = container->pending.children->items[i];
159 if (test(child, data)) { 159 if (test(child, data)) {
160 return child; 160 return child;
161 } 161 }
@@ -319,10 +319,10 @@ struct sway_container *view_container_at(struct sway_node *parent,
319 319
320 struct sway_container *container = parent->sway_container; 320 struct sway_container *container = parent->sway_container;
321 struct wlr_box box = { 321 struct wlr_box box = {
322 .x = container->x, 322 .x = container->pending.x,
323 .y = container->y, 323 .y = container->pending.y,
324 .width = container->width, 324 .width = container->pending.width,
325 .height = container->height, 325 .height = container->pending.height,
326 }; 326 };
327 327
328 if (wlr_box_contains_point(&box, lx, ly)) { 328 if (wlr_box_contains_point(&box, lx, ly)) {
@@ -408,9 +408,9 @@ struct sway_container *container_at(struct sway_workspace *workspace,
408void container_for_each_child(struct sway_container *container, 408void container_for_each_child(struct sway_container *container,
409 void (*f)(struct sway_container *container, void *data), 409 void (*f)(struct sway_container *container, void *data),
410 void *data) { 410 void *data) {
411 if (container->children) { 411 if (container->pending.children) {
412 for (int i = 0; i < container->children->length; ++i) { 412 for (int i = 0; i < container->pending.children->length; ++i) {
413 struct sway_container *child = container->children->items[i]; 413 struct sway_container *child = container->pending.children->items[i];
414 f(child, data); 414 f(child, data);
415 container_for_each_child(child, f, data); 415 container_for_each_child(child, f, data);
416 } 416 }
@@ -420,7 +420,7 @@ void container_for_each_child(struct sway_container *container,
420bool container_has_ancestor(struct sway_container *descendant, 420bool container_has_ancestor(struct sway_container *descendant,
421 struct sway_container *ancestor) { 421 struct sway_container *ancestor) {
422 while (descendant) { 422 while (descendant) {
423 descendant = descendant->parent; 423 descendant = descendant->pending.parent;
424 if (descendant == ancestor) { 424 if (descendant == ancestor) {
425 return true; 425 return true;
426 } 426 }
@@ -596,23 +596,23 @@ size_t container_build_representation(enum sway_container_layout layout,
596 596
597void container_update_representation(struct sway_container *con) { 597void container_update_representation(struct sway_container *con) {
598 if (!con->view) { 598 if (!con->view) {
599 size_t len = container_build_representation(con->layout, 599 size_t len = container_build_representation(con->pending.layout,
600 con->children, NULL); 600 con->pending.children, NULL);
601 free(con->formatted_title); 601 free(con->formatted_title);
602 con->formatted_title = calloc(len + 1, sizeof(char)); 602 con->formatted_title = calloc(len + 1, sizeof(char));
603 if (!sway_assert(con->formatted_title, 603 if (!sway_assert(con->formatted_title,
604 "Unable to allocate title string")) { 604 "Unable to allocate title string")) {
605 return; 605 return;
606 } 606 }
607 container_build_representation(con->layout, con->children, 607 container_build_representation(con->pending.layout, con->pending.children,
608 con->formatted_title); 608 con->formatted_title);
609 container_calculate_title_height(con); 609 container_calculate_title_height(con);
610 container_update_title_textures(con); 610 container_update_title_textures(con);
611 } 611 }
612 if (con->parent) { 612 if (con->pending.parent) {
613 container_update_representation(con->parent); 613 container_update_representation(con->pending.parent);
614 } else if (con->workspace) { 614 } else if (con->pending.workspace) {
615 workspace_update_representation(con->workspace); 615 workspace_update_representation(con->pending.workspace);
616 } 616 }
617} 617}
618 618
@@ -663,20 +663,20 @@ static void floating_natural_resize(struct sway_container *con) {
663 floating_calculate_constraints(&min_width, &max_width, 663 floating_calculate_constraints(&min_width, &max_width,
664 &min_height, &max_height); 664 &min_height, &max_height);
665 if (!con->view) { 665 if (!con->view) {
666 con->width = fmax(min_width, fmin(con->width, max_width)); 666 con->pending.width = fmax(min_width, fmin(con->pending.width, max_width));
667 con->height = fmax(min_height, fmin(con->height, max_height)); 667 con->pending.height = fmax(min_height, fmin(con->pending.height, max_height));
668 } else { 668 } else {
669 struct sway_view *view = con->view; 669 struct sway_view *view = con->view;
670 con->content_width = 670 con->pending.content_width =
671 fmax(min_width, fmin(view->natural_width, max_width)); 671 fmax(min_width, fmin(view->natural_width, max_width));
672 con->content_height = 672 con->pending.content_height =
673 fmax(min_height, fmin(view->natural_height, max_height)); 673 fmax(min_height, fmin(view->natural_height, max_height));
674 container_set_geometry_from_content(con); 674 container_set_geometry_from_content(con);
675 } 675 }
676} 676}
677 677
678void container_floating_resize_and_center(struct sway_container *con) { 678void container_floating_resize_and_center(struct sway_container *con) {
679 struct sway_workspace *ws = con->workspace; 679 struct sway_workspace *ws = con->pending.workspace;
680 if (!ws) { 680 if (!ws) {
681 // On scratchpad, just resize 681 // On scratchpad, just resize
682 floating_natural_resize(con); 682 floating_natural_resize(con);
@@ -687,42 +687,42 @@ void container_floating_resize_and_center(struct sway_container *con) {
687 ws->output->wlr_output); 687 ws->output->wlr_output);
688 if (!ob) { 688 if (!ob) {
689 // On NOOP output. Will be called again when moved to an output 689 // On NOOP output. Will be called again when moved to an output
690 con->x = 0; 690 con->pending.x = 0;
691 con->y = 0; 691 con->pending.y = 0;
692 con->width = 0; 692 con->pending.width = 0;
693 con->height = 0; 693 con->pending.height = 0;
694 return; 694 return;
695 } 695 }
696 696
697 floating_natural_resize(con); 697 floating_natural_resize(con);
698 if (!con->view) { 698 if (!con->view) {
699 if (con->width > ws->width || con->height > ws->height) { 699 if (con->pending.width > ws->width || con->pending.height > ws->height) {
700 con->x = ob->x + (ob->width - con->width) / 2; 700 con->pending.x = ob->x + (ob->width - con->pending.width) / 2;
701 con->y = ob->y + (ob->height - con->height) / 2; 701 con->pending.y = ob->y + (ob->height - con->pending.height) / 2;
702 } else { 702 } else {
703 con->x = ws->x + (ws->width - con->width) / 2; 703 con->pending.x = ws->x + (ws->width - con->pending.width) / 2;
704 con->y = ws->y + (ws->height - con->height) / 2; 704 con->pending.y = ws->y + (ws->height - con->pending.height) / 2;
705 } 705 }
706 } else { 706 } else {
707 if (con->content_width > ws->width 707 if (con->pending.content_width > ws->width
708 || con->content_height > ws->height) { 708 || con->pending.content_height > ws->height) {
709 con->content_x = ob->x + (ob->width - con->content_width) / 2; 709 con->pending.content_x = ob->x + (ob->width - con->pending.content_width) / 2;
710 con->content_y = ob->y + (ob->height - con->content_height) / 2; 710 con->pending.content_y = ob->y + (ob->height - con->pending.content_height) / 2;
711 } else { 711 } else {
712 con->content_x = ws->x + (ws->width - con->content_width) / 2; 712 con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2;
713 con->content_y = ws->y + (ws->height - con->content_height) / 2; 713 con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2;
714 } 714 }
715 715
716 // If the view's border is B_NONE then these properties are ignored. 716 // If the view's border is B_NONE then these properties are ignored.
717 con->border_top = con->border_bottom = true; 717 con->pending.border_top = con->pending.border_bottom = true;
718 con->border_left = con->border_right = true; 718 con->pending.border_left = con->pending.border_right = true;
719 719
720 container_set_geometry_from_content(con); 720 container_set_geometry_from_content(con);
721 } 721 }
722} 722}
723 723
724void container_floating_set_default_size(struct sway_container *con) { 724void container_floating_set_default_size(struct sway_container *con) {
725 if (!sway_assert(con->workspace, "Expected a container on a workspace")) { 725 if (!sway_assert(con->pending.workspace, "Expected a container on a workspace")) {
726 return; 726 return;
727 } 727 }
728 728
@@ -730,16 +730,16 @@ void container_floating_set_default_size(struct sway_container *con) {
730 floating_calculate_constraints(&min_width, &max_width, 730 floating_calculate_constraints(&min_width, &max_width,
731 &min_height, &max_height); 731 &min_height, &max_height);
732 struct wlr_box *box = calloc(1, sizeof(struct wlr_box)); 732 struct wlr_box *box = calloc(1, sizeof(struct wlr_box));
733 workspace_get_box(con->workspace, box); 733 workspace_get_box(con->pending.workspace, box);
734 734
735 double width = fmax(min_width, fmin(box->width * 0.5, max_width)); 735 double width = fmax(min_width, fmin(box->width * 0.5, max_width));
736 double height = fmax(min_height, fmin(box->height * 0.75, max_height)); 736 double height = fmax(min_height, fmin(box->height * 0.75, max_height));
737 if (!con->view) { 737 if (!con->view) {
738 con->width = width; 738 con->pending.width = width;
739 con->height = height; 739 con->pending.height = height;
740 } else { 740 } else {
741 con->content_width = width; 741 con->pending.content_width = width;
742 con->content_height = height; 742 con->pending.content_height = height;
743 container_set_geometry_from_content(con); 743 container_set_geometry_from_content(con);
744 } 744 }
745 745
@@ -761,8 +761,8 @@ void container_set_resizing(struct sway_container *con, bool resizing) {
761 con->view->impl->set_resizing(con->view, resizing); 761 con->view->impl->set_resizing(con->view, resizing);
762 } 762 }
763 } else { 763 } else {
764 for (int i = 0; i < con->children->length; ++i ) { 764 for (int i = 0; i < con->pending.children->length; ++i ) {
765 struct sway_container *child = con->children->items[i]; 765 struct sway_container *child = con->pending.children->items[i];
766 container_set_resizing(child, resizing); 766 container_set_resizing(child, resizing);
767 } 767 }
768 } 768 }
@@ -774,16 +774,16 @@ void container_set_floating(struct sway_container *container, bool enable) {
774 } 774 }
775 775
776 struct sway_seat *seat = input_manager_current_seat(); 776 struct sway_seat *seat = input_manager_current_seat();
777 struct sway_workspace *workspace = container->workspace; 777 struct sway_workspace *workspace = container->pending.workspace;
778 778
779 if (enable) { 779 if (enable) {
780 struct sway_container *old_parent = container->parent; 780 struct sway_container *old_parent = container->pending.parent;
781 container_detach(container); 781 container_detach(container);
782 workspace_add_floating(workspace, container); 782 workspace_add_floating(workspace, container);
783 if (container->view) { 783 if (container->view) {
784 view_set_tiled(container->view, false); 784 view_set_tiled(container->view, false);
785 if (container->view->using_csd) { 785 if (container->view->using_csd) {
786 container->border = B_CSD; 786 container->pending.border = B_CSD;
787 } 787 }
788 } 788 }
789 container_floating_set_default_size(container); 789 container_floating_set_default_size(container);
@@ -801,18 +801,18 @@ void container_set_floating(struct sway_container *container, bool enable) {
801 seat_get_focus_inactive_tiling(seat, workspace); 801 seat_get_focus_inactive_tiling(seat, workspace);
802 if (reference) { 802 if (reference) {
803 container_add_sibling(reference, container, 1); 803 container_add_sibling(reference, container, 1);
804 container->width = reference->width; 804 container->pending.width = reference->pending.width;
805 container->height = reference->height; 805 container->pending.height = reference->pending.height;
806 } else { 806 } else {
807 struct sway_container *other = 807 struct sway_container *other =
808 workspace_add_tiling(workspace, container); 808 workspace_add_tiling(workspace, container);
809 other->width = workspace->width; 809 other->pending.width = workspace->width;
810 other->height = workspace->height; 810 other->pending.height = workspace->height;
811 } 811 }
812 if (container->view) { 812 if (container->view) {
813 view_set_tiled(container->view, true); 813 view_set_tiled(container->view, true);
814 if (container->view->using_csd) { 814 if (container->view->using_csd) {
815 container->border = container->saved_border; 815 container->pending.border = container->saved_border;
816 } 816 }
817 } 817 }
818 container->width_fraction = 0; 818 container->width_fraction = 0;
@@ -834,22 +834,22 @@ void container_set_geometry_from_content(struct sway_container *con) {
834 size_t border_width = 0; 834 size_t border_width = 0;
835 size_t top = 0; 835 size_t top = 0;
836 836
837 if (con->border != B_CSD) { 837 if (con->pending.border != B_CSD) {
838 border_width = con->border_thickness * (con->border != B_NONE); 838 border_width = con->pending.border_thickness * (con->pending.border != B_NONE);
839 top = con->border == B_NORMAL ? 839 top = con->pending.border == B_NORMAL ?
840 container_titlebar_height() : border_width; 840 container_titlebar_height() : border_width;
841 } 841 }
842 842
843 con->x = con->content_x - border_width; 843 con->pending.x = con->pending.content_x - border_width;
844 con->y = con->content_y - top; 844 con->pending.y = con->pending.content_y - top;
845 con->width = con->content_width + border_width * 2; 845 con->pending.width = con->pending.content_width + border_width * 2;
846 con->height = top + con->content_height + border_width; 846 con->pending.height = top + con->pending.content_height + border_width;
847 node_set_dirty(&con->node); 847 node_set_dirty(&con->node);
848} 848}
849 849
850bool container_is_floating(struct sway_container *container) { 850bool container_is_floating(struct sway_container *container) {
851 if (!container->parent && container->workspace && 851 if (!container->pending.parent && container->pending.workspace &&
852 list_find(container->workspace->floating, container) != -1) { 852 list_find(container->pending.workspace->floating, container) != -1) {
853 return true; 853 return true;
854 } 854 }
855 if (container->scratchpad) { 855 if (container->scratchpad) {
@@ -859,10 +859,10 @@ bool container_is_floating(struct sway_container *container) {
859} 859}
860 860
861void container_get_box(struct sway_container *container, struct wlr_box *box) { 861void container_get_box(struct sway_container *container, struct wlr_box *box) {
862 box->x = container->x; 862 box->x = container->pending.x;
863 box->y = container->y; 863 box->y = container->pending.y;
864 box->width = container->width; 864 box->width = container->pending.width;
865 box->height = container->height; 865 box->height = container->pending.height;
866} 866}
867 867
868/** 868/**
@@ -870,14 +870,14 @@ void container_get_box(struct sway_container *container, struct wlr_box *box) {
870 */ 870 */
871void container_floating_translate(struct sway_container *con, 871void container_floating_translate(struct sway_container *con,
872 double x_amount, double y_amount) { 872 double x_amount, double y_amount) {
873 con->x += x_amount; 873 con->pending.x += x_amount;
874 con->y += y_amount; 874 con->pending.y += y_amount;
875 con->content_x += x_amount; 875 con->pending.content_x += x_amount;
876 con->content_y += y_amount; 876 con->pending.content_y += y_amount;
877 877
878 if (con->children) { 878 if (con->pending.children) {
879 for (int i = 0; i < con->children->length; ++i) { 879 for (int i = 0; i < con->pending.children->length; ++i) {
880 struct sway_container *child = con->children->items[i]; 880 struct sway_container *child = con->pending.children->items[i];
881 container_floating_translate(child, x_amount, y_amount); 881 container_floating_translate(child, x_amount, y_amount);
882 } 882 }
883 } 883 }
@@ -893,8 +893,8 @@ void container_floating_translate(struct sway_container *con,
893 * center. 893 * center.
894 */ 894 */
895struct sway_output *container_floating_find_output(struct sway_container *con) { 895struct sway_output *container_floating_find_output(struct sway_container *con) {
896 double center_x = con->x + con->width / 2; 896 double center_x = con->pending.x + con->pending.width / 2;
897 double center_y = con->y + con->height / 2; 897 double center_y = con->pending.y + con->pending.height / 2;
898 struct sway_output *closest_output = NULL; 898 struct sway_output *closest_output = NULL;
899 double closest_distance = DBL_MAX; 899 double closest_distance = DBL_MAX;
900 for (int i = 0; i < root->outputs->length; ++i) { 900 for (int i = 0; i < root->outputs->length; ++i) {
@@ -925,11 +925,11 @@ void container_floating_move_to(struct sway_container *con,
925 "Expected a floating container")) { 925 "Expected a floating container")) {
926 return; 926 return;
927 } 927 }
928 container_floating_translate(con, lx - con->x, ly - con->y); 928 container_floating_translate(con, lx - con->pending.x, ly - con->pending.y);
929 if (container_is_scratchpad_hidden(con)) { 929 if (container_is_scratchpad_hidden(con)) {
930 return; 930 return;
931 } 931 }
932 struct sway_workspace *old_workspace = con->workspace; 932 struct sway_workspace *old_workspace = con->pending.workspace;
933 struct sway_output *new_output = container_floating_find_output(con); 933 struct sway_output *new_output = container_floating_find_output(con);
934 if (!sway_assert(new_output, "Unable to find any output")) { 934 if (!sway_assert(new_output, "Unable to find any output")) {
935 return; 935 return;
@@ -951,10 +951,10 @@ void container_floating_move_to_center(struct sway_container *con) {
951 "Expected a floating container")) { 951 "Expected a floating container")) {
952 return; 952 return;
953 } 953 }
954 struct sway_workspace *ws = con->workspace; 954 struct sway_workspace *ws = con->pending.workspace;
955 double new_lx = ws->x + (ws->width - con->width) / 2; 955 double new_lx = ws->x + (ws->width - con->pending.width) / 2;
956 double new_ly = ws->y + (ws->height - con->height) / 2; 956 double new_ly = ws->y + (ws->height - con->pending.height) / 2;
957 container_floating_translate(con, new_lx - con->x, new_ly - con->y); 957 container_floating_translate(con, new_lx - con->pending.x, new_ly - con->pending.y);
958} 958}
959 959
960static bool find_urgent_iterator(struct sway_container *con, void *data) { 960static bool find_urgent_iterator(struct sway_container *con, void *data) {
@@ -987,27 +987,27 @@ static void set_fullscreen_iterator(struct sway_container *con, void *data) {
987} 987}
988 988
989static void container_fullscreen_workspace(struct sway_container *con) { 989static void container_fullscreen_workspace(struct sway_container *con) {
990 if (!sway_assert(con->fullscreen_mode == FULLSCREEN_NONE, 990 if (!sway_assert(con->pending.fullscreen_mode == FULLSCREEN_NONE,
991 "Expected a non-fullscreen container")) { 991 "Expected a non-fullscreen container")) {
992 return; 992 return;
993 } 993 }
994 bool enable = true; 994 bool enable = true;
995 set_fullscreen_iterator(con, &enable); 995 set_fullscreen_iterator(con, &enable);
996 container_for_each_child(con, set_fullscreen_iterator, &enable); 996 container_for_each_child(con, set_fullscreen_iterator, &enable);
997 con->fullscreen_mode = FULLSCREEN_WORKSPACE; 997 con->pending.fullscreen_mode = FULLSCREEN_WORKSPACE;
998 998
999 con->saved_x = con->x; 999 con->saved_x = con->pending.x;
1000 con->saved_y = con->y; 1000 con->saved_y = con->pending.y;
1001 con->saved_width = con->width; 1001 con->saved_width = con->pending.width;
1002 con->saved_height = con->height; 1002 con->saved_height = con->pending.height;
1003 1003
1004 if (con->workspace) { 1004 if (con->pending.workspace) {
1005 con->workspace->fullscreen = con; 1005 con->pending.workspace->fullscreen = con;
1006 struct sway_seat *seat; 1006 struct sway_seat *seat;
1007 struct sway_workspace *focus_ws; 1007 struct sway_workspace *focus_ws;
1008 wl_list_for_each(seat, &server.input->seats, link) { 1008 wl_list_for_each(seat, &server.input->seats, link) {
1009 focus_ws = seat_get_focused_workspace(seat); 1009 focus_ws = seat_get_focused_workspace(seat);
1010 if (focus_ws == con->workspace) { 1010 if (focus_ws == con->pending.workspace) {
1011 seat_set_focus_container(seat, con); 1011 seat_set_focus_container(seat, con);
1012 } else { 1012 } else {
1013 struct sway_node *focus = 1013 struct sway_node *focus =
@@ -1023,7 +1023,7 @@ static void container_fullscreen_workspace(struct sway_container *con) {
1023} 1023}
1024 1024
1025static void container_fullscreen_global(struct sway_container *con) { 1025static void container_fullscreen_global(struct sway_container *con) {
1026 if (!sway_assert(con->fullscreen_mode == FULLSCREEN_NONE, 1026 if (!sway_assert(con->pending.fullscreen_mode == FULLSCREEN_NONE,
1027 "Expected a non-fullscreen container")) { 1027 "Expected a non-fullscreen container")) {
1028 return; 1028 return;
1029 } 1029 }
@@ -1032,10 +1032,10 @@ static void container_fullscreen_global(struct sway_container *con) {
1032 container_for_each_child(con, set_fullscreen_iterator, &enable); 1032 container_for_each_child(con, set_fullscreen_iterator, &enable);
1033 1033
1034 root->fullscreen_global = con; 1034 root->fullscreen_global = con;
1035 con->saved_x = con->x; 1035 con->saved_x = con->pending.x;
1036 con->saved_y = con->y; 1036 con->saved_y = con->pending.y;
1037 con->saved_width = con->width; 1037 con->saved_width = con->pending.width;
1038 con->saved_height = con->height; 1038 con->saved_height = con->pending.height;
1039 1039
1040 struct sway_seat *seat; 1040 struct sway_seat *seat;
1041 wl_list_for_each(seat, &server.input->seats, link) { 1041 wl_list_for_each(seat, &server.input->seats, link) {
@@ -1045,13 +1045,13 @@ static void container_fullscreen_global(struct sway_container *con) {
1045 } 1045 }
1046 } 1046 }
1047 1047
1048 con->fullscreen_mode = FULLSCREEN_GLOBAL; 1048 con->pending.fullscreen_mode = FULLSCREEN_GLOBAL;
1049 container_end_mouse_operation(con); 1049 container_end_mouse_operation(con);
1050 ipc_event_window(con, "fullscreen_mode"); 1050 ipc_event_window(con, "fullscreen_mode");
1051} 1051}
1052 1052
1053void container_fullscreen_disable(struct sway_container *con) { 1053void container_fullscreen_disable(struct sway_container *con) {
1054 if (!sway_assert(con->fullscreen_mode != FULLSCREEN_NONE, 1054 if (!sway_assert(con->pending.fullscreen_mode != FULLSCREEN_NONE,
1055 "Expected a fullscreen container")) { 1055 "Expected a fullscreen container")) {
1056 return; 1056 return;
1057 } 1057 }
@@ -1060,19 +1060,19 @@ void container_fullscreen_disable(struct sway_container *con) {
1060 container_for_each_child(con, set_fullscreen_iterator, &enable); 1060 container_for_each_child(con, set_fullscreen_iterator, &enable);
1061 1061
1062 if (container_is_floating(con)) { 1062 if (container_is_floating(con)) {
1063 con->x = con->saved_x; 1063 con->pending.x = con->saved_x;
1064 con->y = con->saved_y; 1064 con->pending.y = con->saved_y;
1065 con->width = con->saved_width; 1065 con->pending.width = con->saved_width;
1066 con->height = con->saved_height; 1066 con->pending.height = con->saved_height;
1067 } 1067 }
1068 1068
1069 if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) { 1069 if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
1070 if (con->workspace) { 1070 if (con->pending.workspace) {
1071 con->workspace->fullscreen = NULL; 1071 con->pending.workspace->fullscreen = NULL;
1072 if (container_is_floating(con)) { 1072 if (container_is_floating(con)) {
1073 struct sway_output *output = 1073 struct sway_output *output =
1074 container_floating_find_output(con); 1074 container_floating_find_output(con);
1075 if (con->workspace->output != output) { 1075 if (con->pending.workspace->output != output) {
1076 container_floating_move_to_center(con); 1076 container_floating_move_to_center(con);
1077 } 1077 }
1078 } 1078 }
@@ -1084,11 +1084,11 @@ void container_fullscreen_disable(struct sway_container *con) {
1084 // If the container was mapped as fullscreen and set as floating by 1084 // If the container was mapped as fullscreen and set as floating by
1085 // criteria, it needs to be reinitialized as floating to get the proper 1085 // criteria, it needs to be reinitialized as floating to get the proper
1086 // size and location 1086 // size and location
1087 if (container_is_floating(con) && (con->width == 0 || con->height == 0)) { 1087 if (container_is_floating(con) && (con->pending.width == 0 || con->pending.height == 0)) {
1088 container_floating_resize_and_center(con); 1088 container_floating_resize_and_center(con);
1089 } 1089 }
1090 1090
1091 con->fullscreen_mode = FULLSCREEN_NONE; 1091 con->pending.fullscreen_mode = FULLSCREEN_NONE;
1092 container_end_mouse_operation(con); 1092 container_end_mouse_operation(con);
1093 ipc_event_window(con, "fullscreen_mode"); 1093 ipc_event_window(con, "fullscreen_mode");
1094 1094
@@ -1106,7 +1106,7 @@ void container_fullscreen_disable(struct sway_container *con) {
1106 1106
1107void container_set_fullscreen(struct sway_container *con, 1107void container_set_fullscreen(struct sway_container *con,
1108 enum sway_fullscreen_mode mode) { 1108 enum sway_fullscreen_mode mode) {
1109 if (con->fullscreen_mode == mode) { 1109 if (con->pending.fullscreen_mode == mode) {
1110 return; 1110 return;
1111 } 1111 }
1112 1112
@@ -1118,8 +1118,8 @@ void container_set_fullscreen(struct sway_container *con,
1118 if (root->fullscreen_global) { 1118 if (root->fullscreen_global) {
1119 container_fullscreen_disable(root->fullscreen_global); 1119 container_fullscreen_disable(root->fullscreen_global);
1120 } 1120 }
1121 if (con->workspace && con->workspace->fullscreen) { 1121 if (con->pending.workspace && con->pending.workspace->fullscreen) {
1122 container_fullscreen_disable(con->workspace->fullscreen); 1122 container_fullscreen_disable(con->pending.workspace->fullscreen);
1123 } 1123 }
1124 container_fullscreen_workspace(con); 1124 container_fullscreen_workspace(con);
1125 break; 1125 break;
@@ -1127,7 +1127,7 @@ void container_set_fullscreen(struct sway_container *con,
1127 if (root->fullscreen_global) { 1127 if (root->fullscreen_global) {
1128 container_fullscreen_disable(root->fullscreen_global); 1128 container_fullscreen_disable(root->fullscreen_global);
1129 } 1129 }
1130 if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) { 1130 if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
1131 container_fullscreen_disable(con); 1131 container_fullscreen_disable(con);
1132 } 1132 }
1133 container_fullscreen_global(con); 1133 container_fullscreen_global(con);
@@ -1137,8 +1137,8 @@ void container_set_fullscreen(struct sway_container *con,
1137 1137
1138struct sway_container *container_toplevel_ancestor( 1138struct sway_container *container_toplevel_ancestor(
1139 struct sway_container *container) { 1139 struct sway_container *container) {
1140 while (container->parent) { 1140 while (container->pending.parent) {
1141 container = container->parent; 1141 container = container->pending.parent;
1142 } 1142 }
1143 1143
1144 return container; 1144 return container;
@@ -1150,10 +1150,10 @@ bool container_is_floating_or_child(struct sway_container *container) {
1150 1150
1151bool container_is_fullscreen_or_child(struct sway_container *container) { 1151bool container_is_fullscreen_or_child(struct sway_container *container) {
1152 do { 1152 do {
1153 if (container->fullscreen_mode) { 1153 if (container->pending.fullscreen_mode) {
1154 return true; 1154 return true;
1155 } 1155 }
1156 container = container->parent; 1156 container = container->pending.parent;
1157 } while (container); 1157 } while (container);
1158 1158
1159 return false; 1159 return false;
@@ -1226,11 +1226,11 @@ void container_discover_outputs(struct sway_container *con) {
1226} 1226}
1227 1227
1228enum sway_container_layout container_parent_layout(struct sway_container *con) { 1228enum sway_container_layout container_parent_layout(struct sway_container *con) {
1229 if (con->parent) { 1229 if (con->pending.parent) {
1230 return con->parent->layout; 1230 return con->pending.parent->pending.layout;
1231 } 1231 }
1232 if (con->workspace) { 1232 if (con->pending.workspace) {
1233 return con->workspace->layout; 1233 return con->pending.workspace->layout;
1234 } 1234 }
1235 return L_NONE; 1235 return L_NONE;
1236} 1236}
@@ -1244,16 +1244,16 @@ enum sway_container_layout container_current_parent_layout(
1244} 1244}
1245 1245
1246list_t *container_get_siblings(struct sway_container *container) { 1246list_t *container_get_siblings(struct sway_container *container) {
1247 if (container->parent) { 1247 if (container->pending.parent) {
1248 return container->parent->children; 1248 return container->pending.parent->pending.children;
1249 } 1249 }
1250 if (container_is_scratchpad_hidden(container)) { 1250 if (container_is_scratchpad_hidden(container)) {
1251 return NULL; 1251 return NULL;
1252 } 1252 }
1253 if (list_find(container->workspace->tiling, container) != -1) { 1253 if (list_find(container->pending.workspace->tiling, container) != -1) {
1254 return container->workspace->tiling; 1254 return container->pending.workspace->tiling;
1255 } 1255 }
1256 return container->workspace->floating; 1256 return container->pending.workspace->floating;
1257} 1257}
1258 1258
1259int container_sibling_index(struct sway_container *child) { 1259int container_sibling_index(struct sway_container *child) {
@@ -1268,30 +1268,30 @@ list_t *container_get_current_siblings(struct sway_container *container) {
1268} 1268}
1269 1269
1270void container_handle_fullscreen_reparent(struct sway_container *con) { 1270void container_handle_fullscreen_reparent(struct sway_container *con) {
1271 if (con->fullscreen_mode != FULLSCREEN_WORKSPACE || !con->workspace || 1271 if (con->pending.fullscreen_mode != FULLSCREEN_WORKSPACE || !con->pending.workspace ||
1272 con->workspace->fullscreen == con) { 1272 con->pending.workspace->fullscreen == con) {
1273 return; 1273 return;
1274 } 1274 }
1275 if (con->workspace->fullscreen) { 1275 if (con->pending.workspace->fullscreen) {
1276 container_fullscreen_disable(con->workspace->fullscreen); 1276 container_fullscreen_disable(con->pending.workspace->fullscreen);
1277 } 1277 }
1278 con->workspace->fullscreen = con; 1278 con->pending.workspace->fullscreen = con;
1279 1279
1280 arrange_workspace(con->workspace); 1280 arrange_workspace(con->pending.workspace);
1281} 1281}
1282 1282
1283static void set_workspace(struct sway_container *container, void *data) { 1283static void set_workspace(struct sway_container *container, void *data) {
1284 container->workspace = container->parent->workspace; 1284 container->pending.workspace = container->pending.parent->pending.workspace;
1285} 1285}
1286 1286
1287void container_insert_child(struct sway_container *parent, 1287void container_insert_child(struct sway_container *parent,
1288 struct sway_container *child, int i) { 1288 struct sway_container *child, int i) {
1289 if (child->workspace) { 1289 if (child->pending.workspace) {
1290 container_detach(child); 1290 container_detach(child);
1291 } 1291 }
1292 list_insert(parent->children, i, child); 1292 list_insert(parent->pending.children, i, child);
1293 child->parent = parent; 1293 child->pending.parent = parent;
1294 child->workspace = parent->workspace; 1294 child->pending.workspace = parent->pending.workspace;
1295 container_for_each_child(child, set_workspace, NULL); 1295 container_for_each_child(child, set_workspace, NULL);
1296 container_handle_fullscreen_reparent(child); 1296 container_handle_fullscreen_reparent(child);
1297 container_update_representation(parent); 1297 container_update_representation(parent);
@@ -1299,14 +1299,14 @@ void container_insert_child(struct sway_container *parent,
1299 1299
1300void container_add_sibling(struct sway_container *fixed, 1300void container_add_sibling(struct sway_container *fixed,
1301 struct sway_container *active, bool after) { 1301 struct sway_container *active, bool after) {
1302 if (active->workspace) { 1302 if (active->pending.workspace) {
1303 container_detach(active); 1303 container_detach(active);
1304 } 1304 }
1305 list_t *siblings = container_get_siblings(fixed); 1305 list_t *siblings = container_get_siblings(fixed);
1306 int index = list_find(siblings, fixed); 1306 int index = list_find(siblings, fixed);
1307 list_insert(siblings, index + after, active); 1307 list_insert(siblings, index + after, active);
1308 active->parent = fixed->parent; 1308 active->pending.parent = fixed->pending.parent;
1309 active->workspace = fixed->workspace; 1309 active->pending.workspace = fixed->pending.workspace;
1310 container_for_each_child(active, set_workspace, NULL); 1310 container_for_each_child(active, set_workspace, NULL);
1311 container_handle_fullscreen_reparent(active); 1311 container_handle_fullscreen_reparent(active);
1312 container_update_representation(active); 1312 container_update_representation(active);
@@ -1314,15 +1314,15 @@ void container_add_sibling(struct sway_container *fixed,
1314 1314
1315void container_add_child(struct sway_container *parent, 1315void container_add_child(struct sway_container *parent,
1316 struct sway_container *child) { 1316 struct sway_container *child) {
1317 if (child->workspace) { 1317 if (child->pending.workspace) {
1318 container_detach(child); 1318 container_detach(child);
1319 } 1319 }
1320 list_add(parent->children, child); 1320 list_add(parent->pending.children, child);
1321 child->parent = parent; 1321 child->pending.parent = parent;
1322 child->workspace = parent->workspace; 1322 child->pending.workspace = parent->pending.workspace;
1323 container_for_each_child(child, set_workspace, NULL); 1323 container_for_each_child(child, set_workspace, NULL);
1324 bool fullscreen = child->fullscreen_mode != FULLSCREEN_NONE || 1324 bool fullscreen = child->pending.fullscreen_mode != FULLSCREEN_NONE ||
1325 parent->fullscreen_mode != FULLSCREEN_NONE; 1325 parent->pending.fullscreen_mode != FULLSCREEN_NONE;
1326 set_fullscreen_iterator(child, &fullscreen); 1326 set_fullscreen_iterator(child, &fullscreen);
1327 container_for_each_child(child, set_fullscreen_iterator, &fullscreen); 1327 container_for_each_child(child, set_fullscreen_iterator, &fullscreen);
1328 container_handle_fullscreen_reparent(child); 1328 container_handle_fullscreen_reparent(child);
@@ -1332,15 +1332,15 @@ void container_add_child(struct sway_container *parent,
1332} 1332}
1333 1333
1334void container_detach(struct sway_container *child) { 1334void container_detach(struct sway_container *child) {
1335 if (child->fullscreen_mode == FULLSCREEN_WORKSPACE) { 1335 if (child->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
1336 child->workspace->fullscreen = NULL; 1336 child->pending.workspace->fullscreen = NULL;
1337 } 1337 }
1338 if (child->fullscreen_mode == FULLSCREEN_GLOBAL) { 1338 if (child->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
1339 root->fullscreen_global = NULL; 1339 root->fullscreen_global = NULL;
1340 } 1340 }
1341 1341
1342 struct sway_container *old_parent = child->parent; 1342 struct sway_container *old_parent = child->pending.parent;
1343 struct sway_workspace *old_workspace = child->workspace; 1343 struct sway_workspace *old_workspace = child->pending.workspace;
1344 list_t *siblings = container_get_siblings(child); 1344 list_t *siblings = container_get_siblings(child);
1345 if (siblings) { 1345 if (siblings) {
1346 int index = list_find(siblings, child); 1346 int index = list_find(siblings, child);
@@ -1348,8 +1348,8 @@ void container_detach(struct sway_container *child) {
1348 list_del(siblings, index); 1348 list_del(siblings, index);
1349 } 1349 }
1350 } 1350 }
1351 child->parent = NULL; 1351 child->pending.parent = NULL;
1352 child->workspace = NULL; 1352 child->pending.workspace = NULL;
1353 container_for_each_child(child, set_workspace, NULL); 1353 container_for_each_child(child, set_workspace, NULL);
1354 1354
1355 if (old_parent) { 1355 if (old_parent) {
@@ -1364,18 +1364,18 @@ void container_detach(struct sway_container *child) {
1364 1364
1365void container_replace(struct sway_container *container, 1365void container_replace(struct sway_container *container,
1366 struct sway_container *replacement) { 1366 struct sway_container *replacement) {
1367 enum sway_fullscreen_mode fullscreen = container->fullscreen_mode; 1367 enum sway_fullscreen_mode fullscreen = container->pending.fullscreen_mode;
1368 bool scratchpad = container->scratchpad; 1368 bool scratchpad = container->scratchpad;
1369 struct sway_workspace *ws = NULL; 1369 struct sway_workspace *ws = NULL;
1370 if (fullscreen != FULLSCREEN_NONE) { 1370 if (fullscreen != FULLSCREEN_NONE) {
1371 container_fullscreen_disable(container); 1371 container_fullscreen_disable(container);
1372 } 1372 }
1373 if (scratchpad) { 1373 if (scratchpad) {
1374 ws = container->workspace; 1374 ws = container->pending.workspace;
1375 root_scratchpad_show(container); 1375 root_scratchpad_show(container);
1376 root_scratchpad_remove_container(container); 1376 root_scratchpad_remove_container(container);
1377 } 1377 }
1378 if (container->parent || container->workspace) { 1378 if (container->pending.parent || container->pending.workspace) {
1379 float width_fraction = container->width_fraction; 1379 float width_fraction = container->width_fraction;
1380 float height_fraction = container->height_fraction; 1380 float height_fraction = container->height_fraction;
1381 container_add_sibling(container, replacement, 1); 1381 container_add_sibling(container, replacement, 1);
@@ -1403,7 +1403,7 @@ struct sway_container *container_split(struct sway_container *child,
1403 enum sway_container_layout layout) { 1403 enum sway_container_layout layout) {
1404 // i3 doesn't split singleton H/V containers 1404 // i3 doesn't split singleton H/V containers
1405 // https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/tree.c#L354 1405 // https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/tree.c#L354
1406 if (child->parent || child->workspace) { 1406 if (child->pending.parent || child->pending.workspace) {
1407 list_t *siblings = container_get_siblings(child); 1407 list_t *siblings = container_get_siblings(child);
1408 if (siblings->length == 1) { 1408 if (siblings->length == 1) {
1409 enum sway_container_layout current = container_parent_layout(child); 1409 enum sway_container_layout current = container_parent_layout(child);
@@ -1411,12 +1411,12 @@ struct sway_container *container_split(struct sway_container *child,
1411 current = L_NONE; 1411 current = L_NONE;
1412 } 1412 }
1413 if (current == L_HORIZ || current == L_VERT) { 1413 if (current == L_HORIZ || current == L_VERT) {
1414 if (child->parent) { 1414 if (child->pending.parent) {
1415 child->parent->layout = layout; 1415 child->pending.parent->pending.layout = layout;
1416 container_update_representation(child->parent); 1416 container_update_representation(child->pending.parent);
1417 } else { 1417 } else {
1418 child->workspace->layout = layout; 1418 child->pending.workspace->layout = layout;
1419 workspace_update_representation(child->workspace); 1419 workspace_update_representation(child->pending.workspace);
1420 } 1420 }
1421 return child; 1421 return child;
1422 } 1422 }
@@ -1429,25 +1429,25 @@ struct sway_container *container_split(struct sway_container *child,
1429 if (container_is_floating(child) && child->view) { 1429 if (container_is_floating(child) && child->view) {
1430 view_set_tiled(child->view, true); 1430 view_set_tiled(child->view, true);
1431 if (child->view->using_csd) { 1431 if (child->view->using_csd) {
1432 child->border = child->saved_border; 1432 child->pending.border = child->saved_border;
1433 } 1433 }
1434 } 1434 }
1435 1435
1436 struct sway_container *cont = container_create(NULL); 1436 struct sway_container *cont = container_create(NULL);
1437 cont->width = child->width; 1437 cont->pending.width = child->pending.width;
1438 cont->height = child->height; 1438 cont->pending.height = child->pending.height;
1439 cont->width_fraction = child->width_fraction; 1439 cont->width_fraction = child->width_fraction;
1440 cont->height_fraction = child->height_fraction; 1440 cont->height_fraction = child->height_fraction;
1441 cont->x = child->x; 1441 cont->pending.x = child->pending.x;
1442 cont->y = child->y; 1442 cont->pending.y = child->pending.y;
1443 cont->layout = layout; 1443 cont->pending.layout = layout;
1444 1444
1445 container_replace(child, cont); 1445 container_replace(child, cont);
1446 container_add_child(cont, child); 1446 container_add_child(cont, child);
1447 1447
1448 if (set_focus) { 1448 if (set_focus) {
1449 seat_set_raw_focus(seat, &cont->node); 1449 seat_set_raw_focus(seat, &cont->node);
1450 if (cont->fullscreen_mode == FULLSCREEN_GLOBAL) { 1450 if (cont->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
1451 seat_set_focus(seat, &child->node); 1451 seat_set_focus(seat, &child->node);
1452 } else { 1452 } else {
1453 seat_set_raw_focus(seat, &child->node); 1453 seat_set_raw_focus(seat, &child->node);
@@ -1608,19 +1608,19 @@ void container_update_marks_textures(struct sway_container *con) {
1608void container_raise_floating(struct sway_container *con) { 1608void container_raise_floating(struct sway_container *con) {
1609 // Bring container to front by putting it at the end of the floating list. 1609 // Bring container to front by putting it at the end of the floating list.
1610 struct sway_container *floater = container_toplevel_ancestor(con); 1610 struct sway_container *floater = container_toplevel_ancestor(con);
1611 if (container_is_floating(floater) && floater->workspace) { 1611 if (container_is_floating(floater) && floater->pending.workspace) {
1612 list_move_to_end(floater->workspace->floating, floater); 1612 list_move_to_end(floater->pending.workspace->floating, floater);
1613 node_set_dirty(&floater->workspace->node); 1613 node_set_dirty(&floater->pending.workspace->node);
1614 } 1614 }
1615} 1615}
1616 1616
1617bool container_is_scratchpad_hidden(struct sway_container *con) { 1617bool container_is_scratchpad_hidden(struct sway_container *con) {
1618 return con->scratchpad && !con->workspace; 1618 return con->scratchpad && !con->pending.workspace;
1619} 1619}
1620 1620
1621bool container_is_scratchpad_hidden_or_child(struct sway_container *con) { 1621bool container_is_scratchpad_hidden_or_child(struct sway_container *con) {
1622 con = container_toplevel_ancestor(con); 1622 con = container_toplevel_ancestor(con);
1623 return con->scratchpad && !con->workspace; 1623 return con->scratchpad && !con->pending.workspace;
1624} 1624}
1625 1625
1626bool container_is_sticky(struct sway_container *con) { 1626bool container_is_sticky(struct sway_container *con) {
@@ -1648,39 +1648,39 @@ static bool is_parallel(enum sway_container_layout first,
1648static bool container_is_squashable(struct sway_container *con, 1648static bool container_is_squashable(struct sway_container *con,
1649 struct sway_container *child) { 1649 struct sway_container *child) {
1650 enum sway_container_layout gp_layout = container_parent_layout(con); 1650 enum sway_container_layout gp_layout = container_parent_layout(con);
1651 return (con->layout == L_HORIZ || con->layout == L_VERT) && 1651 return (con->pending.layout == L_HORIZ || con->pending.layout == L_VERT) &&
1652 (child->layout == L_HORIZ || child->layout == L_VERT) && 1652 (child->pending.layout == L_HORIZ || child->pending.layout == L_VERT) &&
1653 !is_parallel(con->layout, child->layout) && 1653 !is_parallel(con->pending.layout, child->pending.layout) &&
1654 is_parallel(gp_layout, child->layout); 1654 is_parallel(gp_layout, child->pending.layout);
1655} 1655}
1656 1656
1657static void container_squash_children(struct sway_container *con) { 1657static void container_squash_children(struct sway_container *con) {
1658 for (int i = 0; i < con->children->length; i++) { 1658 for (int i = 0; i < con->pending.children->length; i++) {
1659 struct sway_container *child = con->children->items[i]; 1659 struct sway_container *child = con->pending.children->items[i];
1660 i += container_squash(child); 1660 i += container_squash(child);
1661 } 1661 }
1662} 1662}
1663 1663
1664int container_squash(struct sway_container *con) { 1664int container_squash(struct sway_container *con) {
1665 if (!con->children) { 1665 if (!con->pending.children) {
1666 return 0; 1666 return 0;
1667 } 1667 }
1668 if (con->children->length != 1) { 1668 if (con->pending.children->length != 1) {
1669 container_squash_children(con); 1669 container_squash_children(con);
1670 return 0; 1670 return 0;
1671 } 1671 }
1672 struct sway_container *child = con->children->items[0]; 1672 struct sway_container *child = con->pending.children->items[0];
1673 int idx = container_sibling_index(con); 1673 int idx = container_sibling_index(con);
1674 int change = 0; 1674 int change = 0;
1675 if (container_is_squashable(con, child)) { 1675 if (container_is_squashable(con, child)) {
1676 // con and child are a redundant H/V pair. Destroy them. 1676 // con and child are a redundant H/V pair. Destroy them.
1677 while (child->children->length) { 1677 while (child->pending.children->length) {
1678 struct sway_container *current = child->children->items[0]; 1678 struct sway_container *current = child->pending.children->items[0];
1679 container_detach(current); 1679 container_detach(current);
1680 if (con->parent) { 1680 if (con->pending.parent) {
1681 container_insert_child(con->parent, current, idx); 1681 container_insert_child(con->pending.parent, current, idx);
1682 } else { 1682 } else {
1683 workspace_insert_tiling_direct(con->workspace, current, idx); 1683 workspace_insert_tiling_direct(con->pending.workspace, current, idx);
1684 } 1684 }
1685 change++; 1685 change++;
1686 } 1686 }
diff --git a/sway/tree/node.c b/sway/tree/node.c
index ffa7f2cc..bc7e2aa5 100644
--- a/sway/tree/node.c
+++ b/sway/tree/node.c
@@ -75,7 +75,7 @@ void node_get_box(struct sway_node *node, struct wlr_box *box) {
75struct sway_output *node_get_output(struct sway_node *node) { 75struct sway_output *node_get_output(struct sway_node *node) {
76 switch (node->type) { 76 switch (node->type) {
77 case N_CONTAINER: { 77 case N_CONTAINER: {
78 struct sway_workspace *ws = node->sway_container->workspace; 78 struct sway_workspace *ws = node->sway_container->pending.workspace;
79 return ws ? ws->output : NULL; 79 return ws ? ws->output : NULL;
80 } 80 }
81 case N_WORKSPACE: 81 case N_WORKSPACE:
@@ -91,7 +91,7 @@ struct sway_output *node_get_output(struct sway_node *node) {
91enum sway_container_layout node_get_layout(struct sway_node *node) { 91enum sway_container_layout node_get_layout(struct sway_node *node) {
92 switch (node->type) { 92 switch (node->type) {
93 case N_CONTAINER: 93 case N_CONTAINER:
94 return node->sway_container->layout; 94 return node->sway_container->pending.layout;
95 case N_WORKSPACE: 95 case N_WORKSPACE:
96 return node->sway_workspace->layout; 96 return node->sway_workspace->layout;
97 case N_OUTPUT: 97 case N_OUTPUT:
@@ -105,11 +105,11 @@ struct sway_node *node_get_parent(struct sway_node *node) {
105 switch (node->type) { 105 switch (node->type) {
106 case N_CONTAINER: { 106 case N_CONTAINER: {
107 struct sway_container *con = node->sway_container; 107 struct sway_container *con = node->sway_container;
108 if (con->parent) { 108 if (con->pending.parent) {
109 return &con->parent->node; 109 return &con->pending.parent->node;
110 } 110 }
111 if (con->workspace) { 111 if (con->pending.workspace) {
112 return &con->workspace->node; 112 return &con->pending.workspace->node;
113 } 113 }
114 } 114 }
115 return NULL; 115 return NULL;
@@ -131,7 +131,7 @@ struct sway_node *node_get_parent(struct sway_node *node) {
131list_t *node_get_children(struct sway_node *node) { 131list_t *node_get_children(struct sway_node *node) {
132 switch (node->type) { 132 switch (node->type) {
133 case N_CONTAINER: 133 case N_CONTAINER:
134 return node->sway_container->children; 134 return node->sway_container->pending.children;
135 case N_WORKSPACE: 135 case N_WORKSPACE:
136 return node->sway_workspace->tiling; 136 return node->sway_workspace->tiling;
137 case N_OUTPUT: 137 case N_OUTPUT:
@@ -143,7 +143,7 @@ list_t *node_get_children(struct sway_node *node) {
143 143
144bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor) { 144bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor) {
145 if (ancestor->type == N_ROOT && node->type == N_CONTAINER && 145 if (ancestor->type == N_ROOT && node->type == N_CONTAINER &&
146 node->sway_container->fullscreen_mode == FULLSCREEN_GLOBAL) { 146 node->sway_container->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
147 return true; 147 return true;
148 } 148 }
149 struct sway_node *parent = node_get_parent(node); 149 struct sway_node *parent = node_get_parent(node);
@@ -152,7 +152,7 @@ bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor) {
152 return true; 152 return true;
153 } 153 }
154 if (ancestor->type == N_ROOT && parent->type == N_CONTAINER && 154 if (ancestor->type == N_ROOT && parent->type == N_CONTAINER &&
155 parent->sway_container->fullscreen_mode == FULLSCREEN_GLOBAL) { 155 parent->sway_container->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
156 return true; 156 return true;
157 } 157 }
158 parent = node_get_parent(parent); 158 parent = node_get_parent(parent);
diff --git a/sway/tree/output.c b/sway/tree/output.c
index a8ae30f7..c095dce0 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -70,13 +70,13 @@ static void restore_workspaces(struct sway_output *output) {
70 // floater re-centered 70 // floater re-centered
71 for (int i = 0; i < ws->floating->length; i++) { 71 for (int i = 0; i < ws->floating->length; i++) {
72 struct sway_container *floater = ws->floating->items[i]; 72 struct sway_container *floater = ws->floating->items[i];
73 if (floater->width == 0 || floater->height == 0 || 73 if (floater->pending.width == 0 || floater->pending.height == 0 ||
74 floater->width > output->width || 74 floater->pending.width > output->width ||
75 floater->height > output->height || 75 floater->pending.height > output->height ||
76 floater->x > output->lx + output->width || 76 floater->pending.x > output->lx + output->width ||
77 floater->y > output->ly + output->height || 77 floater->pending.y > output->ly + output->height ||
78 floater->x + floater->width < output->lx || 78 floater->pending.x + floater->pending.width < output->lx ||
79 floater->y + floater->height < output->ly) { 79 floater->pending.y + floater->pending.height < output->ly) {
80 container_floating_resize_and_center(floater); 80 container_floating_resize_and_center(floater);
81 } 81 }
82 } 82 }
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 7a594538..dd4d8e33 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -59,11 +59,11 @@ void root_scratchpad_add_container(struct sway_container *con, struct sway_works
59 return; 59 return;
60 } 60 }
61 61
62 struct sway_container *parent = con->parent; 62 struct sway_container *parent = con->pending.parent;
63 struct sway_workspace *workspace = con->workspace; 63 struct sway_workspace *workspace = con->pending.workspace;
64 64
65 // Clear the fullscreen mode when sending to the scratchpad 65 // Clear the fullscreen mode when sending to the scratchpad
66 if (con->fullscreen_mode != FULLSCREEN_NONE) { 66 if (con->pending.fullscreen_mode != FULLSCREEN_NONE) {
67 container_fullscreen_disable(con); 67 container_fullscreen_disable(con);
68 } 68 }
69 69
@@ -117,7 +117,7 @@ void root_scratchpad_show(struct sway_container *con) {
117 sway_log(SWAY_DEBUG, "No focused workspace to show scratchpad on"); 117 sway_log(SWAY_DEBUG, "No focused workspace to show scratchpad on");
118 return; 118 return;
119 } 119 }
120 struct sway_workspace *old_ws = con->workspace; 120 struct sway_workspace *old_ws = con->pending.workspace;
121 121
122 // If the current con or any of its parents are in fullscreen mode, we 122 // If the current con or any of its parents are in fullscreen mode, we
123 // first need to disable it before showing the scratchpad con. 123 // first need to disable it before showing the scratchpad con.
@@ -134,15 +134,15 @@ void root_scratchpad_show(struct sway_container *con) {
134 workspace_consider_destroy(old_ws); 134 workspace_consider_destroy(old_ws);
135 } else { 135 } else {
136 // Act on the ancestor of scratchpad hidden split containers 136 // Act on the ancestor of scratchpad hidden split containers
137 while (con->parent) { 137 while (con->pending.parent) {
138 con = con->parent; 138 con = con->pending.parent;
139 } 139 }
140 } 140 }
141 workspace_add_floating(new_ws, con); 141 workspace_add_floating(new_ws, con);
142 142
143 // Make sure the container's center point overlaps this workspace 143 // Make sure the container's center point overlaps this workspace
144 double center_lx = con->x + con->width / 2; 144 double center_lx = con->pending.x + con->pending.width / 2;
145 double center_ly = con->y + con->height / 2; 145 double center_ly = con->pending.y + con->pending.height / 2;
146 146
147 struct wlr_box workspace_box; 147 struct wlr_box workspace_box;
148 workspace_get_box(new_ws, &workspace_box); 148 workspace_get_box(new_ws, &workspace_box);
@@ -155,7 +155,7 @@ void root_scratchpad_show(struct sway_container *con) {
155} 155}
156 156
157static void disable_fullscreen(struct sway_container *con, void *data) { 157static void disable_fullscreen(struct sway_container *con, void *data) {
158 if (con->fullscreen_mode != FULLSCREEN_NONE) { 158 if (con->pending.fullscreen_mode != FULLSCREEN_NONE) {
159 container_fullscreen_disable(con); 159 container_fullscreen_disable(con);
160 } 160 }
161} 161}
@@ -163,9 +163,9 @@ static void disable_fullscreen(struct sway_container *con, void *data) {
163void root_scratchpad_hide(struct sway_container *con) { 163void root_scratchpad_hide(struct sway_container *con) {
164 struct sway_seat *seat = input_manager_current_seat(); 164 struct sway_seat *seat = input_manager_current_seat();
165 struct sway_node *focus = seat_get_focus_inactive(seat, &root->node); 165 struct sway_node *focus = seat_get_focus_inactive(seat, &root->node);
166 struct sway_workspace *ws = con->workspace; 166 struct sway_workspace *ws = con->pending.workspace;
167 167
168 if (con->fullscreen_mode == FULLSCREEN_GLOBAL && !con->workspace) { 168 if (con->pending.fullscreen_mode == FULLSCREEN_GLOBAL && !con->pending.workspace) {
169 // If the container was made fullscreen global while in the scratchpad, 169 // If the container was made fullscreen global while in the scratchpad,
170 // it should be shown until fullscreen has been disabled 170 // it should be shown until fullscreen has been disabled
171 return; 171 return;
diff --git a/sway/tree/view.c b/sway/tree/view.c
index e62fd018..ad79b229 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -206,7 +206,7 @@ bool view_ancestor_is_only_visible(struct sway_view *view) {
206 } else { 206 } else {
207 only_visible = true; 207 only_visible = true;
208 } 208 }
209 con = con->parent; 209 con = con->pending.parent;
210 } 210 }
211 return only_visible; 211 return only_visible;
212} 212}
@@ -222,58 +222,58 @@ static bool view_is_only_visible(struct sway_view *view) {
222 } 222 }
223 } 223 }
224 224
225 con = con->parent; 225 con = con->pending.parent;
226 } 226 }
227 227
228 return true; 228 return true;
229} 229}
230 230
231static bool gaps_to_edge(struct sway_view *view) { 231static bool gaps_to_edge(struct sway_view *view) {
232 struct side_gaps gaps = view->container->workspace->current_gaps; 232 struct side_gaps gaps = view->container->pending.workspace->current_gaps;
233 return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0; 233 return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0;
234} 234}
235 235
236void view_autoconfigure(struct sway_view *view) { 236void view_autoconfigure(struct sway_view *view) {
237 struct sway_container *con = view->container; 237 struct sway_container *con = view->container;
238 struct sway_workspace *ws = con->workspace; 238 struct sway_workspace *ws = con->pending.workspace;
239 239
240 if (container_is_scratchpad_hidden(con) && 240 if (container_is_scratchpad_hidden(con) &&
241 con->fullscreen_mode != FULLSCREEN_GLOBAL) { 241 con->pending.fullscreen_mode != FULLSCREEN_GLOBAL) {
242 return; 242 return;
243 } 243 }
244 struct sway_output *output = ws ? ws->output : NULL; 244 struct sway_output *output = ws ? ws->output : NULL;
245 245
246 if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) { 246 if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
247 con->content_x = output->lx; 247 con->pending.content_x = output->lx;
248 con->content_y = output->ly; 248 con->pending.content_y = output->ly;
249 con->content_width = output->width; 249 con->pending.content_width = output->width;
250 con->content_height = output->height; 250 con->pending.content_height = output->height;
251 return; 251 return;
252 } else if (con->fullscreen_mode == FULLSCREEN_GLOBAL) { 252 } else if (con->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
253 con->content_x = root->x; 253 con->pending.content_x = root->x;
254 con->content_y = root->y; 254 con->pending.content_y = root->y;
255 con->content_width = root->width; 255 con->pending.content_width = root->width;
256 con->content_height = root->height; 256 con->pending.content_height = root->height;
257 return; 257 return;
258 } 258 }
259 259
260 con->border_top = con->border_bottom = true; 260 con->pending.border_top = con->pending.border_bottom = true;
261 con->border_left = con->border_right = true; 261 con->pending.border_left = con->pending.border_right = true;
262 double y_offset = 0; 262 double y_offset = 0;
263 263
264 if (!container_is_floating(con) && ws) { 264 if (!container_is_floating(con) && ws) {
265 if (config->hide_edge_borders == E_BOTH 265 if (config->hide_edge_borders == E_BOTH
266 || config->hide_edge_borders == E_VERTICAL) { 266 || config->hide_edge_borders == E_VERTICAL) {
267 con->border_left = con->x != ws->x; 267 con->pending.border_left = con->pending.x != ws->x;
268 int right_x = con->x + con->width; 268 int right_x = con->pending.x + con->pending.width;
269 con->border_right = right_x != ws->x + ws->width; 269 con->pending.border_right = right_x != ws->x + ws->width;
270 } 270 }
271 271
272 if (config->hide_edge_borders == E_BOTH 272 if (config->hide_edge_borders == E_BOTH
273 || config->hide_edge_borders == E_HORIZONTAL) { 273 || config->hide_edge_borders == E_HORIZONTAL) {
274 con->border_top = con->y != ws->y; 274 con->pending.border_top = con->pending.y != ws->y;
275 int bottom_y = con->y + con->height; 275 int bottom_y = con->pending.y + con->pending.height;
276 con->border_bottom = bottom_y != ws->y + ws->height; 276 con->pending.border_bottom = bottom_y != ws->y + ws->height;
277 } 277 }
278 278
279 bool smart = config->hide_edge_borders_smart == ESMART_ON || 279 bool smart = config->hide_edge_borders_smart == ESMART_ON ||
@@ -282,10 +282,10 @@ void view_autoconfigure(struct sway_view *view) {
282 if (smart) { 282 if (smart) {
283 bool show_border = container_is_floating_or_child(con) || 283 bool show_border = container_is_floating_or_child(con) ||
284 !view_is_only_visible(view); 284 !view_is_only_visible(view);
285 con->border_left &= show_border; 285 con->pending.border_left &= show_border;
286 con->border_right &= show_border; 286 con->pending.border_right &= show_border;
287 con->border_top &= show_border; 287 con->pending.border_top &= show_border;
288 con->border_bottom &= show_border; 288 con->pending.border_bottom &= show_border;
289 } 289 }
290 290
291 // In a tabbed or stacked container, the container's y is the top of the 291 // In a tabbed or stacked container, the container's y is the top of the
@@ -298,56 +298,56 @@ void view_autoconfigure(struct sway_view *view) {
298 enum sway_container_layout layout = container_parent_layout(con); 298 enum sway_container_layout layout = container_parent_layout(con);
299 if (layout == L_TABBED) { 299 if (layout == L_TABBED) {
300 y_offset = container_titlebar_height(); 300 y_offset = container_titlebar_height();
301 con->border_top = false; 301 con->pending.border_top = false;
302 } else if (layout == L_STACKED) { 302 } else if (layout == L_STACKED) {
303 y_offset = container_titlebar_height() * siblings->length; 303 y_offset = container_titlebar_height() * siblings->length;
304 con->border_top = false; 304 con->pending.border_top = false;
305 } 305 }
306 } 306 }
307 } 307 }
308 308
309 double x, y, width, height; 309 double x, y, width, height;
310 switch (con->border) { 310 switch (con->pending.border) {
311 default: 311 default:
312 case B_CSD: 312 case B_CSD:
313 case B_NONE: 313 case B_NONE:
314 x = con->x; 314 x = con->pending.x;
315 y = con->y + y_offset; 315 y = con->pending.y + y_offset;
316 width = con->width; 316 width = con->pending.width;
317 height = con->height - y_offset; 317 height = con->pending.height - y_offset;
318 break; 318 break;
319 case B_PIXEL: 319 case B_PIXEL:
320 x = con->x + con->border_thickness * con->border_left; 320 x = con->pending.x + con->pending.border_thickness * con->pending.border_left;
321 y = con->y + con->border_thickness * con->border_top + y_offset; 321 y = con->pending.y + con->pending.border_thickness * con->pending.border_top + y_offset;
322 width = con->width 322 width = con->pending.width
323 - con->border_thickness * con->border_left 323 - con->pending.border_thickness * con->pending.border_left
324 - con->border_thickness * con->border_right; 324 - con->pending.border_thickness * con->pending.border_right;
325 height = con->height - y_offset 325 height = con->pending.height - y_offset
326 - con->border_thickness * con->border_top 326 - con->pending.border_thickness * con->pending.border_top
327 - con->border_thickness * con->border_bottom; 327 - con->pending.border_thickness * con->pending.border_bottom;
328 break; 328 break;
329 case B_NORMAL: 329 case B_NORMAL:
330 // Height is: 1px border + 3px pad + title height + 3px pad + 1px border 330 // Height is: 1px border + 3px pad + title height + 3px pad + 1px border
331 x = con->x + con->border_thickness * con->border_left; 331 x = con->pending.x + con->pending.border_thickness * con->pending.border_left;
332 width = con->width 332 width = con->pending.width
333 - con->border_thickness * con->border_left 333 - con->pending.border_thickness * con->pending.border_left
334 - con->border_thickness * con->border_right; 334 - con->pending.border_thickness * con->pending.border_right;
335 if (y_offset) { 335 if (y_offset) {
336 y = con->y + y_offset; 336 y = con->pending.y + y_offset;
337 height = con->height - y_offset 337 height = con->pending.height - y_offset
338 - con->border_thickness * con->border_bottom; 338 - con->pending.border_thickness * con->pending.border_bottom;
339 } else { 339 } else {
340 y = con->y + container_titlebar_height(); 340 y = con->pending.y + container_titlebar_height();
341 height = con->height - container_titlebar_height() 341 height = con->pending.height - container_titlebar_height()
342 - con->border_thickness * con->border_bottom; 342 - con->pending.border_thickness * con->pending.border_bottom;
343 } 343 }
344 break; 344 break;
345 } 345 }
346 346
347 con->content_x = x; 347 con->pending.content_x = x;
348 con->content_y = y; 348 con->pending.content_y = y;
349 con->content_width = width; 349 con->pending.content_width = width;
350 con->content_height = height; 350 con->pending.content_height = height;
351} 351}
352 352
353void view_set_activated(struct sway_view *view, bool activated) { 353void view_set_activated(struct sway_view *view, bool activated) {
@@ -361,7 +361,7 @@ void view_set_activated(struct sway_view *view, bool activated) {
361} 361}
362 362
363void view_request_activate(struct sway_view *view) { 363void view_request_activate(struct sway_view *view) {
364 struct sway_workspace *ws = view->container->workspace; 364 struct sway_workspace *ws = view->container->pending.workspace;
365 if (!ws) { // hidden scratchpad container 365 if (!ws) { // hidden scratchpad container
366 return; 366 return;
367 } 367 }
@@ -401,13 +401,13 @@ void view_set_csd_from_server(struct sway_view *view, bool enabled) {
401void view_update_csd_from_client(struct sway_view *view, bool enabled) { 401void view_update_csd_from_client(struct sway_view *view, bool enabled) {
402 sway_log(SWAY_DEBUG, "View %p updated CSD to %i", view, enabled); 402 sway_log(SWAY_DEBUG, "View %p updated CSD to %i", view, enabled);
403 struct sway_container *con = view->container; 403 struct sway_container *con = view->container;
404 if (enabled && con && con->border != B_CSD) { 404 if (enabled && con && con->pending.border != B_CSD) {
405 con->saved_border = con->border; 405 con->saved_border = con->pending.border;
406 if (container_is_floating(con)) { 406 if (container_is_floating(con)) {
407 con->border = B_CSD; 407 con->pending.border = B_CSD;
408 } 408 }
409 } else if (!enabled && con && con->border == B_CSD) { 409 } else if (!enabled && con && con->pending.border == B_CSD) {
410 con->border = con->saved_border; 410 con->pending.border = con->saved_border;
411 } 411 }
412 view->using_csd = enabled; 412 view->using_csd = enabled;
413} 413}
@@ -577,7 +577,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
577 if (node && node->type == N_WORKSPACE) { 577 if (node && node->type == N_WORKSPACE) {
578 return node->sway_workspace; 578 return node->sway_workspace;
579 } else if (node && node->type == N_CONTAINER) { 579 } else if (node && node->type == N_CONTAINER) {
580 return node->sway_container->workspace; 580 return node->sway_container->pending.workspace;
581 } 581 }
582 582
583 // When there's no outputs connected, the above should match a workspace on 583 // When there's no outputs connected, the above should match a workspace on
@@ -590,9 +590,9 @@ static bool should_focus(struct sway_view *view) {
590 struct sway_seat *seat = input_manager_current_seat(); 590 struct sway_seat *seat = input_manager_current_seat();
591 struct sway_container *prev_con = seat_get_focused_container(seat); 591 struct sway_container *prev_con = seat_get_focused_container(seat);
592 struct sway_workspace *prev_ws = seat_get_focused_workspace(seat); 592 struct sway_workspace *prev_ws = seat_get_focused_workspace(seat);
593 struct sway_workspace *map_ws = view->container->workspace; 593 struct sway_workspace *map_ws = view->container->pending.workspace;
594 594
595 if (view->container->fullscreen_mode == FULLSCREEN_GLOBAL) { 595 if (view->container->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
596 return true; 596 return true;
597 } 597 }
598 598
@@ -603,9 +603,9 @@ static bool should_focus(struct sway_view *view) {
603 603
604 // If the view is the only one in the focused workspace, it'll get focus 604 // If the view is the only one in the focused workspace, it'll get focus
605 // regardless of any no_focus criteria. 605 // regardless of any no_focus criteria.
606 if (!view->container->parent && !prev_con) { 606 if (!view->container->pending.parent && !prev_con) {
607 size_t num_children = view->container->workspace->tiling->length + 607 size_t num_children = view->container->pending.workspace->tiling->length +
608 view->container->workspace->floating->length; 608 view->container->pending.workspace->floating->length;
609 if (num_children == 1) { 609 if (num_children == 1) {
610 return true; 610 return true;
611 } 611 }
@@ -645,9 +645,9 @@ static void handle_foreign_fullscreen_request(
645 645
646 // Match fullscreen command behavior for scratchpad hidden views 646 // Match fullscreen command behavior for scratchpad hidden views
647 struct sway_container *container = view->container; 647 struct sway_container *container = view->container;
648 if (!container->workspace) { 648 if (!container->pending.workspace) {
649 while (container->parent) { 649 while (container->pending.parent) {
650 container = container->parent; 650 container = container->pending.parent;
651 } 651 }
652 } 652 }
653 653
@@ -668,10 +668,10 @@ static void handle_foreign_fullscreen_request(
668 if (event->fullscreen) { 668 if (event->fullscreen) {
669 arrange_root(); 669 arrange_root();
670 } else { 670 } else {
671 if (container->parent) { 671 if (container->pending.parent) {
672 arrange_container(container->parent); 672 arrange_container(container->pending.parent);
673 } else if (container->workspace) { 673 } else if (container->pending.workspace) {
674 arrange_workspace(container->workspace); 674 arrange_workspace(container->pending.workspace);
675 } 675 }
676 } 676 }
677} 677}
@@ -762,20 +762,20 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
762 } 762 }
763 763
764 if (view->impl->wants_floating && view->impl->wants_floating(view)) { 764 if (view->impl->wants_floating && view->impl->wants_floating(view)) {
765 view->container->border = config->floating_border; 765 view->container->pending.border = config->floating_border;
766 view->container->border_thickness = config->floating_border_thickness; 766 view->container->pending.border_thickness = config->floating_border_thickness;
767 container_set_floating(view->container, true); 767 container_set_floating(view->container, true);
768 } else { 768 } else {
769 view->container->border = config->border; 769 view->container->pending.border = config->border;
770 view->container->border_thickness = config->border_thickness; 770 view->container->pending.border_thickness = config->border_thickness;
771 view_set_tiled(view, true); 771 view_set_tiled(view, true);
772 } 772 }
773 773
774 if (config->popup_during_fullscreen == POPUP_LEAVE && 774 if (config->popup_during_fullscreen == POPUP_LEAVE &&
775 container->workspace && 775 container->pending.workspace &&
776 container->workspace->fullscreen && 776 container->pending.workspace->fullscreen &&
777 container->workspace->fullscreen->view) { 777 container->pending.workspace->fullscreen->view) {
778 struct sway_container *fs = container->workspace->fullscreen; 778 struct sway_container *fs = container->pending.workspace->fullscreen;
779 if (view_is_transient_for(view, fs->view)) { 779 if (view_is_transient_for(view, fs->view)) {
780 container_set_fullscreen(fs, false); 780 container_set_fullscreen(fs, false);
781 } 781 }
@@ -786,12 +786,12 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
786 786
787 if (fullscreen) { 787 if (fullscreen) {
788 container_set_fullscreen(view->container, true); 788 container_set_fullscreen(view->container, true);
789 arrange_workspace(view->container->workspace); 789 arrange_workspace(view->container->pending.workspace);
790 } else { 790 } else {
791 if (container->parent) { 791 if (container->pending.parent) {
792 arrange_container(container->parent); 792 arrange_container(container->pending.parent);
793 } else if (container->workspace) { 793 } else if (container->pending.workspace) {
794 arrange_workspace(container->workspace); 794 arrange_workspace(container->pending.workspace);
795 } 795 }
796 } 796 }
797 797
@@ -838,8 +838,8 @@ void view_unmap(struct sway_view *view) {
838 view->foreign_toplevel = NULL; 838 view->foreign_toplevel = NULL;
839 } 839 }
840 840
841 struct sway_container *parent = view->container->parent; 841 struct sway_container *parent = view->container->pending.parent;
842 struct sway_workspace *ws = view->container->workspace; 842 struct sway_workspace *ws = view->container->pending.workspace;
843 container_begin_destroy(view->container); 843 container_begin_destroy(view->container);
844 if (parent) { 844 if (parent) {
845 container_reap_empty(parent); 845 container_reap_empty(parent);
@@ -874,8 +874,8 @@ void view_unmap(struct sway_view *view) {
874 874
875void view_update_size(struct sway_view *view) { 875void view_update_size(struct sway_view *view) {
876 struct sway_container *con = view->container; 876 struct sway_container *con = view->container;
877 con->content_width = view->geometry.width; 877 con->pending.content_width = view->geometry.width;
878 con->content_height = view->geometry.height; 878 con->pending.content_height = view->geometry.height;
879 container_set_geometry_from_content(con); 879 container_set_geometry_from_content(con);
880} 880}
881 881
@@ -989,8 +989,8 @@ static void view_child_damage(struct sway_view_child *child, bool whole) {
989 int sx, sy; 989 int sx, sy;
990 child->impl->get_root_coords(child, &sx, &sy); 990 child->impl->get_root_coords(child, &sx, &sy);
991 desktop_damage_surface(child->surface, 991 desktop_damage_surface(child->surface,
992 child->view->container->content_x + sx, 992 child->view->container->pending.content_x + sx,
993 child->view->container->content_y + sy, whole); 993 child->view->container->pending.content_y + sy, whole);
994} 994}
995 995
996static void view_child_handle_surface_commit(struct wl_listener *listener, 996static void view_child_handle_surface_commit(struct wl_listener *listener,
@@ -1073,7 +1073,7 @@ void view_child_init(struct sway_view_child *child,
1073 wl_signal_add(&view->events.unmap, &child->view_unmap); 1073 wl_signal_add(&view->events.unmap, &child->view_unmap);
1074 child->view_unmap.notify = view_child_handle_view_unmap; 1074 child->view_unmap.notify = view_child_handle_view_unmap;
1075 1075
1076 struct sway_workspace *workspace = child->view->container->workspace; 1076 struct sway_workspace *workspace = child->view->container->pending.workspace;
1077 if (workspace) { 1077 if (workspace) {
1078 wlr_surface_send_enter(child->surface, workspace->output->wlr_output); 1078 wlr_surface_send_enter(child->surface, workspace->output->wlr_output);
1079 } 1079 }
@@ -1256,15 +1256,15 @@ bool view_is_visible(struct sway_view *view) {
1256 if (view->container->node.destroying) { 1256 if (view->container->node.destroying) {
1257 return false; 1257 return false;
1258 } 1258 }
1259 struct sway_workspace *workspace = view->container->workspace; 1259 struct sway_workspace *workspace = view->container->pending.workspace;
1260 if (!workspace && view->container->fullscreen_mode != FULLSCREEN_GLOBAL) { 1260 if (!workspace && view->container->pending.fullscreen_mode != FULLSCREEN_GLOBAL) {
1261 bool fs_global_descendant = false; 1261 bool fs_global_descendant = false;
1262 struct sway_container *parent = view->container->parent; 1262 struct sway_container *parent = view->container->pending.parent;
1263 while (parent) { 1263 while (parent) {
1264 if (parent->fullscreen_mode == FULLSCREEN_GLOBAL) { 1264 if (parent->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
1265 fs_global_descendant = true; 1265 fs_global_descendant = true;
1266 } 1266 }
1267 parent = parent->parent; 1267 parent = parent->pending.parent;
1268 } 1268 }
1269 if (!fs_global_descendant) { 1269 if (!fs_global_descendant) {
1270 return false; 1270 return false;
@@ -1282,13 +1282,13 @@ bool view_is_visible(struct sway_view *view) {
1282 enum sway_container_layout layout = container_parent_layout(con); 1282 enum sway_container_layout layout = container_parent_layout(con);
1283 if ((layout == L_TABBED || layout == L_STACKED) 1283 if ((layout == L_TABBED || layout == L_STACKED)
1284 && !container_is_floating(con)) { 1284 && !container_is_floating(con)) {
1285 struct sway_node *parent = con->parent ? 1285 struct sway_node *parent = con->pending.parent ?
1286 &con->parent->node : &con->workspace->node; 1286 &con->pending.parent->node : &con->pending.workspace->node;
1287 if (seat_get_active_tiling_child(seat, parent) != &con->node) { 1287 if (seat_get_active_tiling_child(seat, parent) != &con->node) {
1288 return false; 1288 return false;
1289 } 1289 }
1290 } 1290 }
1291 con = con->parent; 1291 con = con->pending.parent;
1292 } 1292 }
1293 // Check view isn't hidden by another fullscreen view 1293 // Check view isn't hidden by another fullscreen view
1294 struct sway_container *fs = root->fullscreen_global ? 1294 struct sway_container *fs = root->fullscreen_global ?
@@ -1322,7 +1322,7 @@ void view_set_urgent(struct sway_view *view, bool enable) {
1322 ipc_event_window(view->container, "urgent"); 1322 ipc_event_window(view->container, "urgent");
1323 1323
1324 if (!container_is_scratchpad_hidden(view->container)) { 1324 if (!container_is_scratchpad_hidden(view->container)) {
1325 workspace_detect_urgent(view->container->workspace); 1325 workspace_detect_urgent(view->container->pending.workspace);
1326 } 1326 }
1327} 1327}
1328 1328
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 921b7d19..4e735064 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -48,7 +48,7 @@ struct sway_output *workspace_get_initial_output(const char *name) {
48 if (focus && focus->type == N_WORKSPACE) { 48 if (focus && focus->type == N_WORKSPACE) {
49 return focus->sway_workspace->output; 49 return focus->sway_workspace->output;
50 } else if (focus && focus->type == N_CONTAINER) { 50 } else if (focus && focus->type == N_CONTAINER) {
51 return focus->sway_container->workspace->output; 51 return focus->sway_container->pending.workspace->output;
52 } 52 }
53 // Fallback to the first output or noop output for headless 53 // Fallback to the first output or noop output for headless
54 return root->outputs->length ? root->outputs->items[0] : root->noop_output; 54 return root->outputs->length ? root->outputs->items[0] : root->noop_output;
@@ -569,7 +569,7 @@ bool workspace_switch(struct sway_workspace *workspace,
569 if (focus && focus->type == N_WORKSPACE) { 569 if (focus && focus->type == N_WORKSPACE) {
570 active_ws = focus->sway_workspace; 570 active_ws = focus->sway_workspace;
571 } else if (focus && focus->type == N_CONTAINER) { 571 } else if (focus && focus->type == N_CONTAINER) {
572 active_ws = focus->sway_container->workspace; 572 active_ws = focus->sway_container->pending.workspace;
573 } 573 }
574 574
575 if (!no_auto_back_and_forth && config->auto_back_and_forth && active_ws 575 if (!no_auto_back_and_forth && config->auto_back_and_forth && active_ws
@@ -736,13 +736,13 @@ struct sway_container *workspace_find_container(struct sway_workspace *ws,
736} 736}
737 737
738static void set_workspace(struct sway_container *container, void *data) { 738static void set_workspace(struct sway_container *container, void *data) {
739 container->workspace = container->parent->workspace; 739 container->pending.workspace = container->pending.parent->pending.workspace;
740} 740}
741 741
742static void workspace_attach_tiling(struct sway_workspace *ws, 742static void workspace_attach_tiling(struct sway_workspace *ws,
743 struct sway_container *con) { 743 struct sway_container *con) {
744 list_add(ws->tiling, con); 744 list_add(ws->tiling, con);
745 con->workspace = ws; 745 con->pending.workspace = ws;
746 container_for_each_child(con, set_workspace, NULL); 746 container_for_each_child(con, set_workspace, NULL);
747 container_handle_fullscreen_reparent(con); 747 container_handle_fullscreen_reparent(con);
748 workspace_update_representation(ws); 748 workspace_update_representation(ws);
@@ -753,7 +753,7 @@ static void workspace_attach_tiling(struct sway_workspace *ws,
753struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { 753struct sway_container *workspace_wrap_children(struct sway_workspace *ws) {
754 struct sway_container *fs = ws->fullscreen; 754 struct sway_container *fs = ws->fullscreen;
755 struct sway_container *middle = container_create(NULL); 755 struct sway_container *middle = container_create(NULL);
756 middle->layout = ws->layout; 756 middle->pending.layout = ws->layout;
757 while (ws->tiling->length) { 757 while (ws->tiling->length) {
758 struct sway_container *child = ws->tiling->items[0]; 758 struct sway_container *child = ws->tiling->items[0];
759 container_detach(child); 759 container_detach(child);
@@ -771,9 +771,9 @@ void workspace_unwrap_children(struct sway_workspace *ws,
771 return; 771 return;
772 } 772 }
773 773
774 ws->layout = wrap->layout; 774 ws->layout = wrap->pending.layout;
775 while (wrap->children->length) { 775 while (wrap->pending.children->length) {
776 struct sway_container *child = wrap->children->items[0]; 776 struct sway_container *child = wrap->pending.children->items[0];
777 container_detach(child); 777 container_detach(child);
778 workspace_add_tiling(ws, child); 778 workspace_add_tiling(ws, child);
779 } 779 }
@@ -793,14 +793,14 @@ void workspace_detach(struct sway_workspace *workspace) {
793 793
794struct sway_container *workspace_add_tiling(struct sway_workspace *workspace, 794struct sway_container *workspace_add_tiling(struct sway_workspace *workspace,
795 struct sway_container *con) { 795 struct sway_container *con) {
796 if (con->workspace) { 796 if (con->pending.workspace) {
797 container_detach(con); 797 container_detach(con);
798 } 798 }
799 if (config->default_layout != L_NONE) { 799 if (config->default_layout != L_NONE) {
800 con = container_split(con, config->default_layout); 800 con = container_split(con, config->default_layout);
801 } 801 }
802 list_add(workspace->tiling, con); 802 list_add(workspace->tiling, con);
803 con->workspace = workspace; 803 con->pending.workspace = workspace;
804 container_for_each_child(con, set_workspace, NULL); 804 container_for_each_child(con, set_workspace, NULL);
805 container_handle_fullscreen_reparent(con); 805 container_handle_fullscreen_reparent(con);
806 workspace_update_representation(workspace); 806 workspace_update_representation(workspace);
@@ -811,11 +811,11 @@ struct sway_container *workspace_add_tiling(struct sway_workspace *workspace,
811 811
812void workspace_add_floating(struct sway_workspace *workspace, 812void workspace_add_floating(struct sway_workspace *workspace,
813 struct sway_container *con) { 813 struct sway_container *con) {
814 if (con->workspace) { 814 if (con->pending.workspace) {
815 container_detach(con); 815 container_detach(con);
816 } 816 }
817 list_add(workspace->floating, con); 817 list_add(workspace->floating, con);
818 con->workspace = workspace; 818 con->pending.workspace = workspace;
819 container_for_each_child(con, set_workspace, NULL); 819 container_for_each_child(con, set_workspace, NULL);
820 container_handle_fullscreen_reparent(con); 820 container_handle_fullscreen_reparent(con);
821 node_set_dirty(&workspace->node); 821 node_set_dirty(&workspace->node);
@@ -825,7 +825,7 @@ void workspace_add_floating(struct sway_workspace *workspace,
825void workspace_insert_tiling_direct(struct sway_workspace *workspace, 825void workspace_insert_tiling_direct(struct sway_workspace *workspace,
826 struct sway_container *con, int index) { 826 struct sway_container *con, int index) {
827 list_insert(workspace->tiling, index, con); 827 list_insert(workspace->tiling, index, con);
828 con->workspace = workspace; 828 con->pending.workspace = workspace;
829 container_for_each_child(con, set_workspace, NULL); 829 container_for_each_child(con, set_workspace, NULL);
830 container_handle_fullscreen_reparent(con); 830 container_handle_fullscreen_reparent(con);
831 workspace_update_representation(workspace); 831 workspace_update_representation(workspace);
@@ -835,7 +835,7 @@ void workspace_insert_tiling_direct(struct sway_workspace *workspace,
835 835
836struct sway_container *workspace_insert_tiling(struct sway_workspace *workspace, 836struct sway_container *workspace_insert_tiling(struct sway_workspace *workspace,
837 struct sway_container *con, int index) { 837 struct sway_container *con, int index) {
838 if (con->workspace) { 838 if (con->pending.workspace) {
839 container_detach(con); 839 container_detach(con);
840 } 840 }
841 if (config->default_layout != L_NONE) { 841 if (config->default_layout != L_NONE) {
@@ -905,7 +905,7 @@ struct sway_container *workspace_split(struct sway_workspace *workspace,
905 enum sway_container_layout old_layout = workspace->layout; 905 enum sway_container_layout old_layout = workspace->layout;
906 struct sway_container *middle = workspace_wrap_children(workspace); 906 struct sway_container *middle = workspace_wrap_children(workspace);
907 workspace->layout = layout; 907 workspace->layout = layout;
908 middle->layout = old_layout; 908 middle->pending.layout = old_layout;
909 909
910 struct sway_seat *seat; 910 struct sway_seat *seat;
911 wl_list_for_each(seat, &server.input->seats, link) { 911 wl_list_for_each(seat, &server.input->seats, link) {