aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/root.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-12-29 14:34:34 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-12-29 14:45:42 +1000
commitdd8d2dedf79ef1000ec0495e1c1c27210be8919f (patch)
treeca60bdc856420faf46f552424c3838bcf779b6fe /sway/tree/root.c
parentadded fullscreen_mode to get_tree output (diff)
downloadsway-dd8d2dedf79ef1000ec0495e1c1c27210be8919f.tar.gz
sway-dd8d2dedf79ef1000ec0495e1c1c27210be8919f.tar.zst
sway-dd8d2dedf79ef1000ec0495e1c1c27210be8919f.zip
Fix crash when scratchpad contains split containers
To reproduce: * Launch two terminals in a workspace * `focus parent` to select both terminals * `move scratchpad` * `scratchpad show` to show the terminals * `scratchpad show` to hide the terminals * `scratchpad show` - crash When hiding the terminals, it should be moving focus to whatever is in the workspace, but this wasn't happening because the focus check didn't consider split containers. So the terminals were hidden in the scratchpad while still having focus. This confused the next invocation of scratchpad show, causing it to attempt to hide them instead of show them, and the hide-related code caused a crash when it tried to arrange the workspace which was NULL. This patch corrects the focus check.
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r--sway/tree/root.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 22c46aba..e1624863 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -145,7 +145,7 @@ void root_scratchpad_hide(struct sway_container *con) {
145 145
146 container_detach(con); 146 container_detach(con);
147 arrange_workspace(ws); 147 arrange_workspace(ws);
148 if (&con->node == focus) { 148 if (&con->node == focus || node_has_ancestor(focus, &con->node)) {
149 seat_set_focus(seat, seat_get_focus_inactive(seat, &ws->node)); 149 seat_set_focus(seat, seat_get_focus_inactive(seat, &ws->node));
150 } 150 }
151 list_move_to_end(root->scratchpad, con); 151 list_move_to_end(root->scratchpad, con);