aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-13 14:32:47 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-02-18 15:11:48 -0500
commit1d4b995c0f290c392c8a0d3e1e293c76bf82c3d9 (patch)
treefb4135e4bf815cc1f5a5771a93ac81aeb736cd1e
parentsubsurface_get_root_coords: break on NULL (diff)
downloadsway-1d4b995c0f290c392c8a0d3e1e293c76bf82c3d9.tar.gz
sway-1d4b995c0f290c392c8a0d3e1e293c76bf82c3d9.tar.zst
sway-1d4b995c0f290c392c8a0d3e1e293c76bf82c3d9.zip
seatop_move_tiling: use tab/stack parent not self
When moving a descendant of a tabbed or stacked container, it is possible for the target node to be the node being moved. This causes a segfault in `handle_finish` since the node will be detached and then attempted to be attached to it own parent, which is NULL due to the detach. In this case, the target node should not be set to the node being moved, but the parent of the node. This also allows for a descendant of a tabbed or stacked container to be dragged out of the tabs/stacks and to be a sibling of the tabbbed/stacked container, which was not previously possible.
-rw-r--r--sway/input/seatop_move_tiling.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c
index 8b541f80..422a4aa2 100644
--- a/sway/input/seatop_move_tiling.c
+++ b/sway/input/seatop_move_tiling.c
@@ -150,6 +150,9 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
150 } 150 }
151 if (edge) { 151 if (edge) {
152 e->target_node = node_get_parent(&con->node); 152 e->target_node = node_get_parent(&con->node);
153 if (e->target_node == &e->con->node) {
154 e->target_node = node_get_parent(e->target_node);
155 }
153 e->target_edge = edge; 156 e->target_edge = edge;
154 node_get_box(e->target_node, &e->drop_box); 157 node_get_box(e->target_node, &e->drop_box);
155 resize_box(&e->drop_box, edge, DROP_LAYOUT_BORDER); 158 resize_box(&e->drop_box, edge, DROP_LAYOUT_BORDER);