summaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-11-24 20:58:02 +0100
committerLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-11-24 21:34:41 +0100
commitb5ddad4bf64c3541ab765c56f84a90842c2d4512 (patch)
tree44aa7ea7df57cad8e9c966dce1d1f822164fe1d9 /sway
parentlayout: replace_child: Handle floating views. (diff)
downloadsway-b5ddad4bf64c3541ab765c56f84a90842c2d4512.tar.gz
sway-b5ddad4bf64c3541ab765c56f84a90842c2d4512.tar.zst
sway-b5ddad4bf64c3541ab765c56f84a90842c2d4512.zip
layout: swap_container: Handle floating views.
Diffstat (limited to 'sway')
-rw-r--r--sway/layout.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sway/layout.c b/sway/layout.c
index 23d99e35..ac56f7b2 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -174,7 +174,6 @@ swayc_t *remove_child(swayc_t *child) {
174} 174}
175 175
176void swap_container(swayc_t *a, swayc_t *b) { 176void swap_container(swayc_t *a, swayc_t *b) {
177 //TODO doesnt handle floating <-> tiling swap
178 if (!sway_assert(a&&b, "parameters must be non null") || 177 if (!sway_assert(a&&b, "parameters must be non null") ||
179 !sway_assert(a->parent && b->parent, "containers must have parents")) { 178 !sway_assert(a->parent && b->parent, "containers must have parents")) {
180 return; 179 return;
@@ -184,8 +183,16 @@ void swap_container(swayc_t *a, swayc_t *b) {
184 swayc_t *a_parent = a->parent; 183 swayc_t *a_parent = a->parent;
185 swayc_t *b_parent = b->parent; 184 swayc_t *b_parent = b->parent;
186 // Swap the pointers 185 // Swap the pointers
187 a_parent->children->items[a_index] = b; 186 if (a->is_floating) {
188 b_parent->children->items[b_index] = a; 187 a_parent->floating->items[a_index] = b;
188 } else {
189 a_parent->children->items[a_index] = b;
190 }
191 if (b->is_floating) {
192 b_parent->floating->items[b_index] = a;
193 } else {
194 b_parent->children->items[b_index] = a;
195 }
189 a->parent = b_parent; 196 a->parent = b_parent;
190 b->parent = a_parent; 197 b->parent = a_parent;
191 if (a_parent->focused == a) { 198 if (a_parent->focused == a) {