]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: center correctly with scale != 1
authorJohan Malm <jgm323@gmail.com>
Mon, 6 Jun 2022 17:31:18 +0000 (18:31 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 6 Jun 2022 18:46:29 +0000 (20:46 +0200)
Fixes issue #376

src/view.c

index b852425355794f8308e39cb5d360e140eb6d2c3c..6a6f295bc78188383017e5861685abc3f0687792 100644 (file)
@@ -152,8 +152,8 @@ view_compute_centered_position(struct view *view, int w, int h, int *x, int *y)
        struct wlr_box usable = output_usable_area_in_layout_coords(output);
        int width = w + view->margin.left + view->margin.right;
        int height = h + view->margin.top + view->margin.bottom;
-       *x = usable.x + usable.width / wlr_output->scale / 2 - width / 2;
-       *y = usable.y + usable.height / wlr_output->scale / 2 - height / 2;
+       *x = usable.x + (usable.width - width) / 2;
+       *y = usable.y + (usable.height - height) / 2;
        return true;
 }