Merge branch 'main' into scenegraph
This commit is contained in:
commit
d50bb97f56
21
client.h
21
client.h
|
@ -199,3 +199,24 @@ client_min_size(Client *c, int *width, int *height)
|
||||||
*width = state->min_width;
|
*width = state->min_width;
|
||||||
*height = state->min_height;
|
*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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
7
dwl.c
7
dwl.c
|
@ -874,8 +874,15 @@ createnotify(struct wl_listener *listener, void *data)
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
||||||
|
struct wlr_box box;
|
||||||
xdg_surface->surface->data = wlr_scene_xdg_surface_create(
|
xdg_surface->surface->data = wlr_scene_xdg_surface_create(
|
||||||
xdg_surface->popup->parent->data, xdg_surface);
|
xdg_surface->popup->parent->data, xdg_surface);
|
||||||
|
if (!(c = client_from_popup(xdg_surface->popup)) || !c->mon)
|
||||||
|
return;
|
||||||
|
box = c->mon->m;
|
||||||
|
box.x -= c->geom.x;
|
||||||
|
box.y -= c->geom.y;
|
||||||
|
wlr_xdg_popup_unconstrain_from_box(xdg_surface->popup, &box);
|
||||||
return;
|
return;
|
||||||
} else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE)
|
} else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue