aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/swap.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-10-16 10:50:56 +0100
committerLibravatar GitHub <noreply@github.com>2018-10-16 10:50:56 +0100
commitac20690945f1cd44c4c22267c9e7a172ebcf5ba5 (patch)
tree994739d4ba8388d7a336ac825a618daf2274ec66 /sway/commands/swap.c
parentPrevent duplicate workspace::focus events (diff)
parentMerge pull request #2845 from colemickens/posix_clock (diff)
downloadsway-ac20690945f1cd44c4c22267c9e7a172ebcf5ba5.tar.gz
sway-ac20690945f1cd44c4c22267c9e7a172ebcf5ba5.tar.zst
sway-ac20690945f1cd44c4c22267c9e7a172ebcf5ba5.zip
Merge branch 'master' into set-set-raw-focus
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r--sway/commands/swap.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index 22e3927d..9cc0d5c2 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -22,6 +22,7 @@ static void swap_places(struct sway_container *con1,
22 temp->width = con1->width; 22 temp->width = con1->width;
23 temp->height = con1->height; 23 temp->height = con1->height;
24 temp->parent = con1->parent; 24 temp->parent = con1->parent;
25 temp->workspace = con1->workspace;
25 26
26 con1->x = con2->x; 27 con1->x = con2->x;
27 con1->y = con2->y; 28 con1->y = con2->y;
@@ -34,8 +35,18 @@ static void swap_places(struct sway_container *con1,
34 con2->height = temp->height; 35 con2->height = temp->height;
35 36
36 int temp_index = container_sibling_index(con1); 37 int temp_index = container_sibling_index(con1);
37 container_insert_child(con2->parent, con1, container_sibling_index(con2)); 38 if (con2->parent) {
38 container_insert_child(temp->parent, con2, temp_index); 39 container_insert_child(con2->parent, con1,
40 container_sibling_index(con2));
41 } else {
42 workspace_insert_tiling(con2->workspace, con1,
43 container_sibling_index(con2));
44 }
45 if (temp->parent) {
46 container_insert_child(temp->parent, con2, temp_index);
47 } else {
48 workspace_insert_tiling(temp->workspace, con2, temp_index);
49 }
39 50
40 free(temp); 51 free(temp);
41} 52}