diff options
author | Tudor Brindus <me@tbrindus.ca> | 2020-11-03 00:16:15 -0500 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-11-11 20:43:58 -0500 |
commit | 07042486c3c4b8e7083405ba9b34b1b87f8d396d (patch) | |
tree | 5ec7b68db2acbc1c68538a08b0b039477e8f8858 /sway/tree/container.c | |
parent | Add missing includes for wlr_input_device.h (diff) | |
download | sway-07042486c3c4b8e7083405ba9b34b1b87f8d396d.tar.gz sway-07042486c3c4b8e7083405ba9b34b1b87f8d396d.tar.zst sway-07042486c3c4b8e7083405ba9b34b1b87f8d396d.zip |
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.)
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 8 |
1 files changed, 8 insertions, 0 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) { | |||
1609 | con = container_toplevel_ancestor(con); | 1609 | con = container_toplevel_ancestor(con); |
1610 | return con->scratchpad && !con->workspace; | 1610 | return con->scratchpad && !con->workspace; |
1611 | } | 1611 | } |
1612 | |||
1613 | bool container_is_sticky(struct sway_container *con) { | ||
1614 | return con->is_sticky && container_is_floating(con); | ||
1615 | } | ||
1616 | |||
1617 | bool container_is_sticky_or_child(struct sway_container *con) { | ||
1618 | return container_is_sticky(container_toplevel_ancestor(con)); | ||
1619 | } | ||