xdg: only position topmost view

This commit is contained in:
Johan Malm 2020-09-25 20:22:18 +01:00
parent 33d02aa83e
commit 5351299cdd

View file

@ -142,6 +142,11 @@ static struct border xdg_shell_border(struct view *view)
return border; return border;
} }
static bool istopmost(struct view *view)
{
return view->xdg_surface->toplevel->parent == NULL;
}
static void xdg_toplevel_view_map(struct view *view) static void xdg_toplevel_view_map(struct view *view)
{ {
view->mapped = true; view->mapped = true;
@ -154,10 +159,12 @@ static void xdg_toplevel_view_map(struct view *view)
view->margin = xdg_shell_border(view); view->margin = xdg_shell_border(view);
view->xdg_grab_offset = -view->margin.left; view->xdg_grab_offset = -view->margin.left;
} }
if (istopmost(view)) {
/* align to edge of screen */ /* align to edge of screen */
view->x += view->margin.left; view->x += view->margin.left;
view->y += view->margin.top; view->y += view->margin.top;
} }
}
view->been_mapped = true; view->been_mapped = true;
wl_signal_add(&view->xdg_surface->surface->events.commit, wl_signal_add(&view->xdg_surface->surface->events.commit,