From 0f2261395235c5b19cb30a63789162bebaf65d0e Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Mon, 6 Jun 2022 18:33:40 +0100 Subject: [PATCH] view: take into account top-margin for xwayland views ...in order to center accurately. --- src/view.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/view.c b/src/view.c index 6a6f295b..31b73855 100644 --- a/src/view.c +++ b/src/view.c @@ -154,6 +154,15 @@ view_compute_centered_position(struct view *view, int w, int h, int *x, int *y) int height = h + view->margin.top + view->margin.bottom; *x = usable.x + (usable.width - width) / 2; *y = usable.y + (usable.height - height) / 2; + +#if HAVE_XWAYLAND + /* TODO: refactor xwayland.c functions to get rid of this */ + if (view->type == LAB_XWAYLAND_VIEW) { + *x += view->margin.left; + *y += view->margin.top; + } +#endif + return true; }