From 53dc83fb68d2da079f2595994af41cc6b9acbeea Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Thu, 4 Jun 2020 14:28:43 -0400 Subject: tree/container: introduce `container_toplevel_ancestor` helper This allows us to not have to explicitly write the same while loop everywhere. --- include/sway/tree/container.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 8d2d8827..fd028131 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -272,6 +272,13 @@ void container_set_fullscreen(struct sway_container *con, */ void container_fullscreen_disable(struct sway_container *con); +/** + * Walk up the container tree branch starting at the given container, and return + * its earliest ancestor. + */ +struct sway_container *container_toplevel_ancestor( + struct sway_container *container); + /** * Return true if the container is floating, or a child of a floating split * container. -- cgit v1.2.3