Take into account deco on initial window positioning

This commit is contained in:
Johan Malm 2020-05-12 22:24:18 +01:00
parent 9597aeffec
commit 7a5ebbe402
5 changed files with 38 additions and 14 deletions

20
xwl.c
View file

@ -16,14 +16,32 @@ int xwl_nr_parents(struct view *view)
return i;
}
static void position(struct view *view)
{
struct wlr_box box;
if (!view_want_deco(view))
return;
if (view->x || view->y)
return;
box = deco_box(view, LAB_DECO_PART_TOP);
view->y = box.height;
box = deco_box(view, LAB_DECO_PART_LEFT);
view->x = box.width;
wlr_xwayland_surface_configure(view->xwayland_surface, view->x, view->y,
view->xwayland_surface->width,
view->xwayland_surface->height);
}
void xwl_surface_map(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, map);
view->mapped = true;
view->been_mapped = true;
view->x = view->xwayland_surface->x;
view->y = view->xwayland_surface->y;
view->surface = view->xwayland_surface->surface;
if (!view->been_mapped)
position(view);
view->been_mapped = true;
focus_view(view, view->xwayland_surface->surface);
}