From a3144cc5ea5a9b4ea3db398dd08a28e656c6b38c Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Wed, 13 Mar 2024 20:01:16 +0900 Subject: [PATCH] src/xdg-popup.c: unconstrain popup within usable area --- src/xdg-popup.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/xdg-popup.c b/src/xdg-popup.c index 65c13e8d..0d1ed909 100644 --- a/src/xdg-popup.c +++ b/src/xdg-popup.c @@ -27,19 +27,16 @@ popup_unconstrain(struct xdg_popup *popup) struct view *view = popup->parent_view; struct server *server = view->server; struct wlr_box *popup_box = &popup->wlr_popup->current.geometry; - struct wlr_output_layout *output_layout = server->output_layout; - struct wlr_output *wlr_output = wlr_output_layout_output_at( - output_layout, view->current.x + popup_box->x, + struct output *output = output_nearest_to(server, + view->current.x + popup_box->x, view->current.y + popup_box->y); - - struct wlr_box output_box; - wlr_output_layout_get_box(output_layout, wlr_output, &output_box); + struct wlr_box usable = output_usable_area_in_layout_coords(output); struct wlr_box output_toplevel_box = { - .x = output_box.x - view->current.x, - .y = output_box.y - view->current.y, - .width = output_box.width, - .height = output_box.height, + .x = usable.x - view->current.x, + .y = usable.y - view->current.y, + .width = usable.width, + .height = usable.height, }; wlr_xdg_popup_unconstrain_from_box(popup->wlr_popup, &output_toplevel_box); }