aboutsummaryrefslogtreecommitdiff
path: root/sway/layout.c
diff options
context:
space:
mode:
authorNicolas Cornu <nicolac76@yahoo.fr>2016-10-07 22:29:56 +0200
committerNicolas Cornu <nicolac76@yahoo.fr>2016-10-07 22:29:56 +0200
commit382d47e238afeb8edd02b97dc214748fa4a87036 (patch)
tree5f8815ab93e8417a55576b3cbd22a2915fcb154f /sway/layout.c
parent7d823fbcaeba35cf633d3d46a1eb178720cfce85 (diff)
Fix creating of sibling floating/children
If we want to add a sibling of different type than current container it failed. Because we add it to the wrong list
Diffstat (limited to 'sway/layout.c')
-rw-r--r--sway/layout.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sway/layout.c b/sway/layout.c
index 3629df24..4f2ea09a 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -99,11 +99,20 @@ void add_floating(swayc_t *ws, swayc_t *child) {
swayc_t *add_sibling(swayc_t *fixed, swayc_t *active) {
swayc_t *parent = fixed->parent;
- int i = index_child(fixed);
if (fixed->is_floating) {
- list_insert(parent->floating, i + 1, active);
+ if (active->is_floating) {
+ int i = index_child(fixed);
+ list_insert(parent->floating, i + 1, active);
+ } else {
+ list_add(parent->children, active);
+ }
} else {
- list_insert(parent->children, i + 1, active);
+ if (active->is_floating) {
+ list_add(parent->floating, active);
+ } else {
+ int i = index_child(fixed);
+ list_insert(parent->children, i + 1, active);
+ }
}
active->parent = parent;
// focus new child