view: adjust position according to declared top left corner

The XDG surface geometry includes an (x,y) coordinate indicating the top
left corner of the window. Use this information to correctly set the
view position.
This commit is contained in:
Jonathan GUILLOT 2024-01-15 15:50:46 +01:00
parent 6f20285555
commit e8c038cc8a
4 changed files with 26 additions and 18 deletions

View file

@ -125,13 +125,12 @@ get_title(struct cg_view *view)
}
static void
get_geometry(struct cg_view *view, int *width_out, int *height_out)
get_geometry(struct cg_view *view, struct wlr_box *view_box)
{
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
struct wlr_xdg_surface *xdg_surface = xdg_shell_view->xdg_toplevel->base;
*width_out = xdg_surface->geometry.width;
*height_out = xdg_surface->geometry.height;
memcpy(view_box, &xdg_surface->geometry, sizeof(*view_box));
}
static bool