]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: when centering, top/left align if view is bigger than usable area
authorJohan Malm <jgm323@gmail.com>
Mon, 6 Jun 2022 17:38:04 +0000 (18:38 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 6 Jun 2022 18:46:29 +0000 (20:46 +0200)
src/view.c

index 31b73855aebdc4f3bc11f7cc73735f49f02b201f..c8ee96a43fbca0c50793dca952ecf060fbebe2d4 100644 (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;
        *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
        /* TODO: refactor xwayland.c functions to get rid of this */
        if (view->type == LAB_XWAYLAND_VIEW) {