From d1e16c503028952d5b3da0cef494b3e6e597fca6 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Mon, 6 Jun 2022 18:31:18 +0100 Subject: [PATCH] view: center correctly with scale != 1 Fixes issue #376 --- src/view.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view.c b/src/view.c index b8524253..6a6f295b 100644 --- a/src/view.c +++ b/src/view.c @@ -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; }