From 07042486c3c4b8e7083405ba9b34b1b87f8d396d Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Tue, 3 Nov 2020 00:16:15 -0500 Subject: tree/container: introduce `container_is_sticky[_or_child]` functions To query whether a container is sticky, checking `con->is_sticky` is insufficient. `container_is_floating_or_child` must also return true; this led to a lot of repetition. This commit introduces `container_is_sticky[_or_child]` functions, and switches all stickiness checks to use them. (Including ones where the container is already known to be floating, for consistency.) --- sway/tree/view.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'sway/tree/view.c') 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 -- cgit v1.2.3