mirror of
https://github.com/swaywm/sway.git
synced 2026-04-17 06:46:32 -04:00
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.)
This commit is contained in:
parent
a56098a24e
commit
07042486c3
7 changed files with 25 additions and 14 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue