view: center correctly with scale != 1

Fixes issue #376
This commit is contained in:
Johan Malm 2022-06-06 18:31:18 +01:00 committed by Consolatis
parent 71f8aca66b
commit d1e16c5030

View 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;
}