view: when centering, top/left align if view is bigger than usable area

This commit is contained in:
Johan Malm 2022-06-06 18:38:04 +01:00 committed by Consolatis
parent 0f22613952
commit fb1af5f68e

View file

@ -155,6 +155,14 @@ view_compute_centered_position(struct view *view, int w, int h, int *x, int *y)
*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 view is bigger than usable area, just top/left align it */
if (*x < rc.gap) {
*x = rc.gap;
}
if (*y < rc.gap) {
*y = rc.gap;
}
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
/* TODO: refactor xwayland.c functions to get rid of this */ /* TODO: refactor xwayland.c functions to get rid of this */
if (view->type == LAB_XWAYLAND_VIEW) { if (view->type == LAB_XWAYLAND_VIEW) {