Merge branch 'main' into scenegraph

This commit is contained in:
Leonardo Hernández Hernández 2022-03-18 01:31:28 -06:00
commit d50bb97f56
No known key found for this signature in database
GPG key ID: E538897EE11B9624
2 changed files with 28 additions and 0 deletions

View file

@ -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;
}
}
}