aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 3e99aa75..2fbd0d38 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1108,11 +1108,17 @@ void container_set_fullscreen(struct sway_container *con,
1108 } 1108 }
1109} 1109}
1110 1110
1111bool container_is_floating_or_child(struct sway_container *container) { 1111struct sway_container *container_toplevel_ancestor(
1112 struct sway_container *container) {
1112 while (container->parent) { 1113 while (container->parent) {
1113 container = container->parent; 1114 container = container->parent;
1114 } 1115 }
1115 return container_is_floating(container); 1116
1117 return container;
1118}
1119
1120bool container_is_floating_or_child(struct sway_container *container) {
1121 return container_is_floating(container_toplevel_ancestor(container));
1116} 1122}
1117 1123
1118bool container_is_fullscreen_or_child(struct sway_container *container) { 1124bool container_is_fullscreen_or_child(struct sway_container *container) {
@@ -1537,10 +1543,7 @@ void container_update_marks_textures(struct sway_container *con) {
1537 1543
1538void container_raise_floating(struct sway_container *con) { 1544void container_raise_floating(struct sway_container *con) {
1539 // Bring container to front by putting it at the end of the floating list. 1545 // Bring container to front by putting it at the end of the floating list.
1540 struct sway_container *floater = con; 1546 struct sway_container *floater = container_toplevel_ancestor(con);
1541 while (floater->parent) {
1542 floater = floater->parent;
1543 }
1544 if (container_is_floating(floater) && floater->workspace) { 1547 if (container_is_floating(floater) && floater->workspace) {
1545 list_move_to_end(floater->workspace->floating, floater); 1548 list_move_to_end(floater->workspace->floating, floater);
1546 node_set_dirty(&floater->workspace->node); 1549 node_set_dirty(&floater->workspace->node);
@@ -1552,8 +1555,6 @@ bool container_is_scratchpad_hidden(struct sway_container *con) {
1552} 1555}
1553 1556
1554bool container_is_scratchpad_hidden_or_child(struct sway_container *con) { 1557bool container_is_scratchpad_hidden_or_child(struct sway_container *con) {
1555 while (con->parent) { 1558 con = container_toplevel_ancestor(con);
1556 con = con->parent;
1557 }
1558 return con->scratchpad && !con->workspace; 1559 return con->scratchpad && !con->workspace;
1559} 1560}