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
This commit is contained in:
Alexander Orzechowski 2022-03-08 08:35:52 -05:00
parent 9f98c38d3e
commit 804dd18cd0

View file

@ -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) {