aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2020-11-03 00:16:15 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-11-11 20:43:58 -0500
commit07042486c3c4b8e7083405ba9b34b1b87f8d396d (patch)
tree5ec7b68db2acbc1c68538a08b0b039477e8f8858 /include
parentAdd missing includes for wlr_input_device.h (diff)
downloadsway-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 'include')
-rw-r--r--include/sway/tree/container.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 136d618b..c9290108 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -78,6 +78,9 @@ struct sway_container {
78 enum sway_container_layout layout; 78 enum sway_container_layout layout;
79 enum sway_container_layout prev_split_layout; 79 enum sway_container_layout prev_split_layout;
80 80
81 // Whether stickiness has been enabled on this container. Use
82 // `container_is_sticky_[or_child]` rather than accessing this field
83 // directly; it'll also check that the container is floating.
81 bool is_sticky; 84 bool is_sticky;
82 85
83 // For C_ROOT, this has no meaning 86 // For C_ROOT, this has no meaning
@@ -367,4 +370,8 @@ bool container_is_scratchpad_hidden(struct sway_container *con);
367 370
368bool container_is_scratchpad_hidden_or_child(struct sway_container *con); 371bool container_is_scratchpad_hidden_or_child(struct sway_container *con);
369 372
373bool container_is_sticky(struct sway_container *con);
374
375bool container_is_sticky_or_child(struct sway_container *con);
376
370#endif 377#endif