]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xdg: Just call view_center() now that it uses pending width/height
authorJohn Lindgren <john@jlindgren.net>
Thu, 9 Feb 2023 06:16:24 +0000 (01:16 -0500)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 9 Feb 2023 17:26:44 +0000 (18:26 +0100)
include/view.h
src/view.c
src/xdg.c

index 158234fefd831cc087cc3f5c3b81215f286a99dc..2adf0269ea2bad75a245794004e52a54d9bfba1b 100644 (file)
@@ -169,9 +169,6 @@ void view_reload_ssd(struct view *view);
 void view_impl_map(struct view *view);
 void view_adjust_size(struct view *view, int *w, int *h);
 
-bool view_compute_centered_position(struct view *view, int w, int h,
-       int *x, int *y);
-
 void view_on_output_destroy(struct view *view);
 void view_destroy(struct view *view);
 
index 2e2a19d8c889f0fd248afd36d9042a76bf98065d..a42cde25454010db3e6433ead47e99a6969c455b 100644 (file)
@@ -243,7 +243,7 @@ view_output(struct view *view)
        return output_from_wlr_output(view->server, wlr_output);
 }
 
-bool
+static bool
 view_compute_centered_position(struct view *view, int w, int h, int *x, int *y)
 {
        struct output *output = view_output(view);
index b320e0497e39ab3fa48185d8512c113cfe5bbaa1..8d39a03fd4704e0e00e2783597b8566e01b23fd2 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -284,20 +284,7 @@ position_xdg_toplevel_view(struct view *view)
                        output_usable_area_from_cursor_coords(view->server);
                view->current.x = box.x;
                view->current.y = box.y;
-
-               /* Center the view without touching its w and h fields. This means we
-                * can't simply set w/h and call view_center().  w and h fields should
-                * only be modified at commit, or they will not be in sync with the
-                * scene tree
-                */
-               int w = xdg_surface->current.geometry.width;
-               int h = xdg_surface->current.geometry.height;
-               if (w && h) {
-                       int x, y;
-                       if (view_compute_centered_position(view, w, h, &x, &y)) {
-                               view_move(view, x, y);
-                       }
-               }
+               view_center(view);
        } else {
                /*
                 * If child-toplevel-views, we center-align relative to their