tree/container: introduce container_toplevel_ancestor helper

This allows us to not have to explicitly write the same while loop
everywhere.
This commit is contained in:
Tudor Brindus 2020-06-04 14:28:43 -04:00 committed by Simon Ser
parent d7900c6e5e
commit 53dc83fb68
3 changed files with 19 additions and 17 deletions

View file

@ -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.