aboutsummaryrefslogtreecommitdiff
path: root/client.h
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-03-18 01:31:28 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-03-18 01:31:28 -0600
commitd50bb97f56394cb998b96b6624342c3589828c10 (patch)
tree49fbeab145724f81832eac48b07bc3e3ef2df668 /client.h
parent475c13414479d1013c83309fcc4bb8a8707aa721 (diff)
parent1dfd867d9caa61d9f3fabf695a72b2fea35b6193 (diff)
Merge branch 'main' into scenegraph
Diffstat (limited to 'client.h')
-rw-r--r--client.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/client.h b/client.h
index c59b7a9..a5fc0d2 100644
--- a/client.h
+++ b/client.h
@@ -199,3 +199,24 @@ client_min_size(Client *c, int *width, int *height)
*width = state->min_width;
*height = state->min_height;
}
+
+static inline Client *
+client_from_popup(struct wlr_xdg_popup *popup)
+{
+ struct wlr_xdg_surface *surface = popup->base;
+
+ while (1) {
+ switch (surface->role) {
+ case WLR_XDG_SURFACE_ROLE_POPUP:
+ if (!wlr_surface_is_xdg_surface(surface->popup->parent))
+ return NULL;
+
+ surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent);
+ break;
+ case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
+ return surface->data;
+ case WLR_XDG_SURFACE_ROLE_NONE:
+ return NULL;
+ }
+ }
+}