]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/xdg-popup.c: unconstrain popup within usable area
authortokyo4j <hrak1529@gmail.com>
Wed, 13 Mar 2024 11:01:16 +0000 (20:01 +0900)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 19 Mar 2024 09:20:03 +0000 (10:20 +0100)
src/xdg-popup.c

index 65c13e8df544cb2ff8ba76b1f8ae25ebb59b86e1..0d1ed909aa32be2e396f3402a1d170c6b0eaf98d 100644 (file)
@@ -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);
 }