libweston-desktop: add set_xwayland_position API
X11 applications expect -geometry command line option to work for
setting the initial window position, but currently this does not work.
Add provision to relay the initial position through libweston-desktop:
- weston_desktop_api gains a new entry set_xwayland_position
- implement set_toplevel_with_position() in xwayland internal interface
Once xwayland plugin starts calling set_toplevel_with_position(),
libweston-desktop can relay that information to a shell if the shell
wants to hear it.
If a shell does not implement the set_xwayland_position hook, the
old behaviour remains: the shell positions xwayland toplevels like any
other.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c
index 1b19e22..b984385 100644
--- a/libweston-desktop/xwayland.c
+++ b/libweston-desktop/xwayland.c
@@ -258,6 +258,16 @@
}
static void
+set_toplevel_with_position(struct weston_desktop_xwayland_surface *surface,
+ int32_t x, int32_t y)
+{
+ weston_desktop_xwayland_surface_change_state(surface, TOPLEVEL, NULL,
+ 0, 0);
+ weston_desktop_api_set_xwayland_position(surface->desktop,
+ surface->surface, x, y);
+}
+
+static void
set_parent(struct weston_desktop_xwayland_surface *surface,
struct weston_surface *wparent)
{
@@ -361,6 +371,7 @@
static const struct weston_desktop_xwayland_interface weston_desktop_xwayland_interface = {
.create_surface = create_surface,
.set_toplevel = set_toplevel,
+ .set_toplevel_with_position = set_toplevel_with_position,
.set_parent = set_parent,
.set_transient = set_transient,
.set_fullscreen = set_fullscreen,