summaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c8
-rw-r--r--sway/tree/view.c10
-rw-r--r--sway/tree/workspace.c4
3 files changed, 13 insertions, 9 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 8557210f..10d621b4 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1609,3 +1609,11 @@ bool container_is_scratchpad_hidden_or_child(struct sway_container *con) {
con = container_toplevel_ancestor(con);
return con->scratchpad && !con->workspace;
}
+
+bool container_is_sticky(struct sway_container *con) {
+ return con->is_sticky && container_is_floating(con);
+}
+
+bool container_is_sticky_or_child(struct sway_container *con) {
+ return container_is_sticky(container_toplevel_ancestor(con));
+}
diff --git a/sway/tree/view.c b/sway/tree/view.c
index d699b01e..354f2d34 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -1244,13 +1244,9 @@ bool view_is_visible(struct sway_view *view) {
return false;
}
}
- // Determine if view is nested inside a floating container which is sticky
- struct sway_container *floater = view->container;
- while (floater->parent) {
- floater = floater->parent;
- }
- bool is_sticky = container_is_floating(floater) && floater->is_sticky;
- if (!is_sticky && workspace && !workspace_is_visible(workspace)) {
+
+ if (!container_is_sticky_or_child(view->container) && workspace &&
+ !workspace_is_visible(workspace)) {
return false;
}
// Check view isn't in a tabbed or stacked container on an inactive tab
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 476c2568..ffcbe933 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -498,7 +498,7 @@ bool workspace_is_empty(struct sway_workspace *ws) {
// Sticky views are not considered to be part of this workspace
for (int i = 0; i < ws->floating->length; ++i) {
struct sway_container *floater = ws->floating->items[i];
- if (!floater->is_sticky) {
+ if (!container_is_sticky(floater)) {
return false;
}
}
@@ -819,7 +819,7 @@ size_t workspace_num_tiling_views(struct sway_workspace *ws) {
}
static void count_sticky_containers(struct sway_container *con, void *data) {
- if (container_is_floating(con) && con->is_sticky) {
+ if (container_is_sticky(con)) {
size_t *count = data;
*count += 1;
}