view: take into account top-margin for xwayland views

...in order to center accurately.
This commit is contained in:
Johan Malm 2022-06-06 18:33:40 +01:00 committed by Consolatis
parent d1e16c5030
commit 0f22613952

View file

@ -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; int height = h + view->margin.top + view->margin.bottom;
*x = usable.x + (usable.width - width) / 2; *x = usable.x + (usable.width - width) / 2;
*y = usable.y + (usable.height - height) / 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; return true;
} }