aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/root.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-01-28 19:06:42 +1000
committerLibravatar emersion <contact@emersion.fr>2019-01-28 10:35:40 +0100
commit6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a (patch)
tree61a9e61c64fd1b88a79b06a6f9dafeb84e4f8c35 /sway/tree/root.c
parentAdd note about required scdoc version to README. (diff)
downloadsway-6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a.tar.gz
sway-6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a.tar.zst
sway-6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a.zip
Introduce container_is_scratchpad_hidden
Just a convenience function that improves readability of the code. Other things worth noting: * container_get_siblings and container_sibling_index no longer use the const keyword * container_handle_fullscreen_reparent is only ever called after attaching the container to a workspace, so its con->workspace check has been changed to an assertion
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r--sway/tree/root.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 476e47a3..6e13d6ce 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -310,10 +310,7 @@ void root_for_each_container(void (*f)(struct sway_container *con, void *data),
310 // Scratchpad 310 // Scratchpad
311 for (int i = 0; i < root->scratchpad->length; ++i) { 311 for (int i = 0; i < root->scratchpad->length; ++i) {
312 struct sway_container *container = root->scratchpad->items[i]; 312 struct sway_container *container = root->scratchpad->items[i];
313 // If the container has a workspace then it's visible on a workspace 313 if (container_is_scratchpad_hidden(container)) {
314 // and will have been iterated in the previous for loop. So we only
315 // iterate the hidden scratchpad containers here.
316 if (!container->workspace) {
317 f(container, data); 314 f(container, data);
318 container_for_each_child(container, f, data); 315 container_for_each_child(container, f, data);
319 } 316 }
@@ -362,7 +359,7 @@ struct sway_container *root_find_container(
362 // Scratchpad 359 // Scratchpad
363 for (int i = 0; i < root->scratchpad->length; ++i) { 360 for (int i = 0; i < root->scratchpad->length; ++i) {
364 struct sway_container *container = root->scratchpad->items[i]; 361 struct sway_container *container = root->scratchpad->items[i];
365 if (!container->workspace) { 362 if (container_is_scratchpad_hidden(container)) {
366 if (test(container, data)) { 363 if (test(container, data)) {
367 return container; 364 return container;
368 } 365 }