diff options
Diffstat (limited to 'sway/tree/arrange.c')
-rw-r--r-- | sway/tree/arrange.c | 70 |
1 files changed, 35 insertions, 35 deletions
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) { |