mirror of
https://github.com/swaywm/sway.git
synced 2026-07-03 00:06:04 -04:00
tree/root: fix scratchpad hide with no focus
Avoid calling node_has_ancestor() with a NULL focus when hiding a scratchpad container. This can happen when the scratchpad window is the only focused node under root.
This commit is contained in:
parent
9727113c60
commit
4b44a84671
1 changed files with 4 additions and 1 deletions
|
|
@ -218,13 +218,16 @@ void root_scratchpad_hide(struct sway_container *con) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool restore_focus = !focus || focus == &con->node ||
|
||||||
|
node_has_ancestor(focus, &con->node);
|
||||||
|
|
||||||
set_container_transform(con->pending.workspace, con);
|
set_container_transform(con->pending.workspace, con);
|
||||||
|
|
||||||
disable_fullscreen(con, NULL);
|
disable_fullscreen(con, NULL);
|
||||||
container_for_each_child(con, disable_fullscreen, NULL);
|
container_for_each_child(con, disable_fullscreen, NULL);
|
||||||
container_detach(con);
|
container_detach(con);
|
||||||
arrange_workspace(ws);
|
arrange_workspace(ws);
|
||||||
if (&con->node == focus || node_has_ancestor(focus, &con->node)) {
|
if (restore_focus) {
|
||||||
seat_set_focus(seat, seat_get_focus_inactive(seat, &ws->node));
|
seat_set_focus(seat, seat_get_focus_inactive(seat, &ws->node));
|
||||||
}
|
}
|
||||||
list_move_to_end(root->scratchpad, con);
|
list_move_to_end(root->scratchpad, con);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue