From 3034da776bdba9ce60f7356ea01239f372d611bf Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Fri, 9 Jul 2021 21:43:27 +0100 Subject: [PATCH] xdg-shell: center view on first map ...and take into account output layout co-ordinates. Previously xdg-shell views were just positioned at (0, 0) on first map regardless of output co-ordinates. Fix issue #39 --- src/xdg.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/xdg.c b/src/xdg.c index 1a99b71b..1860b05f 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -224,11 +224,9 @@ static void position_xdg_toplevel_view(struct view *view) { if (istopmost(view)) { - /* - * For topmost xdg-toplevel, we just top/left align for the - * time being - */ - view->x = view->y = 0; + view->w = view->xdg_surface->geometry.width; + view->h = view->xdg_surface->geometry.height; + view_center(view); } else { /* * If child-toplevel-views, we center-align relative to their @@ -274,8 +272,8 @@ xdg_toplevel_view_map(struct view *view) parent_link) { subsurface_create(view, subsurface); } + view->been_mapped = true; } - view->been_mapped = true; view->commit.notify = handle_commit; wl_signal_add(&view->xdg_surface->surface->events.commit, -- 2.52.0