mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 07:51:28 +00:00
Fix crash when showing scratchpad hidden split containers
This commit is contained in:
parent
f531e86f7c
commit
c52b1cf45a
|
@ -357,4 +357,6 @@ void container_raise_floating(struct sway_container *con);
|
||||||
|
|
||||||
bool container_is_scratchpad_hidden(struct sway_container *con);
|
bool container_is_scratchpad_hidden(struct sway_container *con);
|
||||||
|
|
||||||
|
bool container_is_scratchpad_hidden_or_child(struct sway_container *con);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -365,7 +365,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 0 && container) {
|
if (argc == 0 && container) {
|
||||||
if (container_is_scratchpad_hidden(container)) {
|
if (container_is_scratchpad_hidden_or_child(container)) {
|
||||||
root_scratchpad_show(container);
|
root_scratchpad_show(container);
|
||||||
}
|
}
|
||||||
seat_set_focus_container(seat, container);
|
seat_set_focus_container(seat, container);
|
||||||
|
|
|
@ -1527,3 +1527,10 @@ void container_raise_floating(struct sway_container *con) {
|
||||||
bool container_is_scratchpad_hidden(struct sway_container *con) {
|
bool container_is_scratchpad_hidden(struct sway_container *con) {
|
||||||
return con->scratchpad && !con->workspace;
|
return con->scratchpad && !con->workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool container_is_scratchpad_hidden_or_child(struct sway_container *con) {
|
||||||
|
while (con->parent) {
|
||||||
|
con = con->parent;
|
||||||
|
}
|
||||||
|
return con->scratchpad && !con->workspace;
|
||||||
|
}
|
||||||
|
|
|
@ -132,6 +132,11 @@ void root_scratchpad_show(struct sway_container *con) {
|
||||||
if (old_ws) {
|
if (old_ws) {
|
||||||
container_detach(con);
|
container_detach(con);
|
||||||
workspace_consider_destroy(old_ws);
|
workspace_consider_destroy(old_ws);
|
||||||
|
} else {
|
||||||
|
// Act on the ancestor of scratchpad hidden split containers
|
||||||
|
while (con->parent) {
|
||||||
|
con = con->parent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
workspace_add_floating(new_ws, con);
|
workspace_add_floating(new_ws, con);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue