aboutsummaryrefslogtreecommitdiff
path: root/sway/layout.c
diff options
context:
space:
mode:
authorS. Christoffer Eliesen <christoffer@eliesen.no>2015-11-24 20:58:02 +0100
committerS. Christoffer Eliesen <christoffer@eliesen.no>2015-11-24 21:34:41 +0100
commitb5ddad4bf64c3541ab765c56f84a90842c2d4512 (patch)
tree44aa7ea7df57cad8e9c966dce1d1f822164fe1d9 /sway/layout.c
parented1b0bffbce318327fd00987bc0a075d6ebbc10a (diff)
layout: swap_container: Handle floating views.
Diffstat (limited to 'sway/layout.c')
-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) {
}
void swap_container(swayc_t *a, swayc_t *b) {
- //TODO doesnt handle floating <-> tiling swap
if (!sway_assert(a&&b, "parameters must be non null") ||
!sway_assert(a->parent && b->parent, "containers must have parents")) {
return;
@@ -184,8 +183,16 @@ void swap_container(swayc_t *a, swayc_t *b) {
swayc_t *a_parent = a->parent;
swayc_t *b_parent = b->parent;
// Swap the pointers
- a_parent->children->items[a_index] = b;
- b_parent->children->items[b_index] = a;
+ if (a->is_floating) {
+ a_parent->floating->items[a_index] = b;
+ } else {
+ a_parent->children->items[a_index] = b;
+ }
+ if (b->is_floating) {
+ b_parent->floating->items[b_index] = a;
+ } else {
+ b_parent->children->items[b_index] = a;
+ }
a->parent = b_parent;
b->parent = a_parent;
if (a_parent->focused == a) {