aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/tree/container.h
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-17 19:48:34 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-18 23:38:54 +1000
commitd6cd79c342495738fc23fbfbf19a01e73cdc42dc (patch)
tree7a5ebeae1d5e15f047f09698978fa84f61756faa /include/sway/tree/container.h
parentMerge pull request #2460 from RyanDwyer/implement-mousedown (diff)
downloadsway-d6cd79c342495738fc23fbfbf19a01e73cdc42dc.tar.gz
sway-d6cd79c342495738fc23fbfbf19a01e73cdc42dc.tar.zst
sway-d6cd79c342495738fc23fbfbf19a01e73cdc42dc.zip
Implement iterators per container type
This introduces the following `for_each` functions: * root_for_each_workspace * root_for_each_container * output_for_each_workspace * output_for_each_container * workspace_for_each_container And introduces the following `find` functions: * root_find_output * root_find_workspace * root_find_container * output_find_workspace * output_find_container * workspace_find_container * container_find_child And removes the following functions: * container_descendants * container_for_each_descendant * container_find This change is preparing the way for demoting sway_container. Eventually these functions will accept and return sway_outputs, sway_workspaces and sway_containers (meaning a C_CONTAINER or C_VIEW). This change also makes it easy to handle abnormalities like the workspace floating list, root's scratchpad list and (once implemented) root's saved workspaces list for when there's no connected outputs.
Diffstat (limited to 'include/sway/tree/container.h')
-rw-r--r--include/sway/tree/container.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index d866ec03..c8410801 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -214,15 +214,11 @@ struct sway_container *container_destroy(struct sway_container *container);
214 214
215struct sway_container *container_close(struct sway_container *container); 215struct sway_container *container_close(struct sway_container *container);
216 216
217void container_descendants(struct sway_container *root,
218 enum sway_container_type type,
219 void (*func)(struct sway_container *item, void *data), void *data);
220
221/** 217/**
222 * Search a container's descendants a container based on test criteria. Returns 218 * Search a container's descendants a container based on test criteria. Returns
223 * the first container that passes the test. 219 * the first container that passes the test.
224 */ 220 */
225struct sway_container *container_find(struct sway_container *container, 221struct sway_container *container_find_child(struct sway_container *container,
226 bool (*test)(struct sway_container *view, void *data), void *data); 222 bool (*test)(struct sway_container *view, void *data), void *data);
227 223
228/** 224/**
@@ -244,10 +240,7 @@ struct sway_container *tiling_container_at(
244 struct sway_container *con, double lx, double ly, 240 struct sway_container *con, double lx, double ly,
245 struct wlr_surface **surface, double *sx, double *sy); 241 struct wlr_surface **surface, double *sx, double *sy);
246 242
247/** 243void container_for_each_child(struct sway_container *container,
248 * Apply the function for each child of the container depth first.
249 */
250void container_for_each_descendant(struct sway_container *container,
251 void (*f)(struct sway_container *container, void *data), void *data); 244 void (*f)(struct sway_container *container, void *data), void *data);
252 245
253/** 246/**