libweston: Position layers in an absolute way

Currently, layers’ order depends on the module loading order and it does
not survive runtime modifications (like shell locking/unlocking).
With this patch, modules can safely add their own layer at the expected
position in the stack, with runtime persistence.

v4 Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix three whitespace issues]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c
index 663734a..1b19e22 100644
--- a/libweston-desktop/xwayland.c
+++ b/libweston-desktop/xwayland.c
@@ -386,7 +386,11 @@
 	xwayland->desktop = desktop;
 	xwayland->client = weston_desktop_client_create(desktop, NULL, NULL, NULL, NULL, 0, 0);
 
-	weston_layer_init(&xwayland->layer, &compositor->cursor_layer.link);
+	weston_layer_init(&xwayland->layer, compositor);
+	/* We put this layer on top of regular shell surfaces, but hopefully
+	 * below any UI the shell would add */
+	weston_layer_set_position(&xwayland->layer,
+				  WESTON_LAYER_POSITION_NORMAL + 1);
 
 	compositor->xwayland = xwayland;
 	compositor->xwayland_interface = &weston_desktop_xwayland_interface;