diff options
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sway/layout.c b/sway/layout.c index c7c5c477..875115e7 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -26,10 +26,20 @@ void init_layout(void) { int index_child(const swayc_t *child) { swayc_t *parent = child->parent; - int i, len = parent->children->length; - for (i = 0; i < len; ++i) { - if (parent->children->items[i] == child) { - break; + int i, len; + if (!child->is_floating) { + len = parent->children->length; + for (i = 0; i < len; ++i) { + if (parent->children->items[i] == child) { + break; + } + } + } else { + len = parent->floating->length; + for (i = 0; i < len; ++i) { + if (parent->floating->items[i] == child) { + break; + } } } if (!sway_assert(i < len, "Stray container")) { |