]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: take into account top-margin for xwayland views
authorJohan Malm <jgm323@gmail.com>
Mon, 6 Jun 2022 17:33:40 +0000 (18:33 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 6 Jun 2022 18:46:29 +0000 (20:46 +0200)
...in order to center accurately.

src/view.c

index 6a6f295bc78188383017e5861685abc3f0687792..31b73855aebdc4f3bc11f7cc73735f49f02b201f 100644 (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;
        *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;
 }