aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-13 15:52:18 +0100
committeremersion <contact@emersion.fr>2017-12-13 15:52:18 +0100
commita4619e98c462690f14baf5c0c72c25553e3c6d51 (patch)
treed5b8341824d7bcc882343f2173c55d23b330346f /sway/tree/layout.c
parentd293c429424a9f96c3fc8143af457645326e7a0e (diff)
Update output containers on output layout change
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index fd17f8a5..65382231 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -16,10 +16,24 @@
swayc_t root_container;
static void output_layout_change_notify(struct wl_listener *listener, void *data) {
- struct wlr_box *box = wlr_output_layout_get_box(
+ struct wlr_box *layout_box = wlr_output_layout_get_box(
root_container.sway_root->output_layout, NULL);
- root_container.width = box->width;
- root_container.height = box->height;
+ root_container.width = layout_box->width;
+ root_container.height = layout_box->height;
+
+ for (int i = 0 ; i < root_container.children->length; ++i) {
+ swayc_t *output_container = root_container.children->items[i];
+ struct sway_output *output = output_container->sway_output;
+
+ struct wlr_box *output_box = wlr_output_layout_get_box(
+ root_container.sway_root->output_layout, output->wlr_output);
+ output_container->x = output_box->x;
+ output_container->y = output_box->y;
+ output_container->width = output_box->width;
+ output_container->height = output_box->height;
+ }
+
+ arrange_windows(&root_container, -1, -1);
}
void init_layout(void) {