From 804dd18cd0a5a14ba9c59c86c7f9cebc5b625a19 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 8 Mar 2022 08:35:52 -0500 Subject: [PATCH] arrange: Don't try to arrange a fullscreen container as a tiling/floating container Causes the container to appear in random places in fullscreen view. See: https://github.com/swaywm/sway/pull/6844#issuecomment-1061392867 See: https://github.com/swaywm/sway/pull/6844#issuecomment-1061691809 --- sway/tree/arrange.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index 9c1a11e5..3cee1e01 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -209,6 +209,34 @@ static void arrange_floating(list_t *floating) { static void arrange_children(list_t *children, enum sway_container_layout layout, struct wlr_box *parent) { + + // Don't include fullscreen containers. If we do, we run the risk + // of overwriting properties as if this container was tiled/floating + // but should still be fullscreen. + bool has_fullscreen = false; + for (int i = 0; i < children->length; ++i) { + struct sway_container *child = children->items[i]; + + if (child->pending.fullscreen_mode != FULLSCREEN_NONE) { + has_fullscreen = true; + break; + } + } + + if (has_fullscreen) { + list_t *fs_purged = create_list(); + + for (int i = 0; i < children->length; ++i) { + struct sway_container *child = children->items[i]; + + if (child->pending.fullscreen_mode == FULLSCREEN_NONE) { + list_add(fs_purged, child); + } + } + + children = fs_purged; + } + // Calculate x, y, width and height of children switch (layout) { case L_HORIZ: @@ -233,6 +261,10 @@ static void arrange_children(list_t *children, struct sway_container *child = children->items[i]; arrange_container(child); } + + if (has_fullscreen) { + list_free(children); + } } void arrange_container(struct sway_container *container) {