From 294fb324d8f67c33552b15d3f1f79fe524d5f8fd Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Wed, 16 Mar 2022 23:08:17 -0600 Subject: constraint popups to its parent client Closes: #146 Closes: #155 --- dwl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index 09ddc9a..58f1b36 100644 --- a/dwl.c +++ b/dwl.c @@ -880,7 +880,14 @@ createnotify(struct wl_listener *listener, void *data) struct wlr_xdg_surface *xdg_surface = data; Client *c; - if (xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) + if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { + struct wlr_box box; + if (!(c = client_from_popup(xdg_surface->popup))) + return; + client_get_geometry(c, &box); + wlr_xdg_popup_unconstrain_from_box(xdg_surface->popup, &box); + return; + } else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE) return; /* Allocate a Client for this surface */ -- cgit v1.2.3 From 1dfd867d9caa61d9f3fabf695a72b2fea35b6193 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 17 Mar 2022 17:02:03 -0600 Subject: fix crash of Firefox when opening a popup larger than its size --- dwl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index 58f1b36..8e0a399 100644 --- a/dwl.c +++ b/dwl.c @@ -882,9 +882,11 @@ createnotify(struct wl_listener *listener, void *data) if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { struct wlr_box box; - if (!(c = client_from_popup(xdg_surface->popup))) + if (!(c = client_from_popup(xdg_surface->popup)) || !c->mon) return; - client_get_geometry(c, &box); + 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; } else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE) -- cgit v1.2.3