xwayland: Introduce a private struct for XWayland interface
libweston-desktop implements this private struct.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Differential Revision: https://phabricator.freedesktop.org/D1208
diff --git a/xwayland/launcher.c b/xwayland/launcher.c
index 8972319..dcc4b97 100644
--- a/xwayland/launcher.c
+++ b/xwayland/launcher.c
@@ -341,6 +341,7 @@
weston_xwayland_xserver_loaded,
weston_xwayland_xserver_exited,
};
+extern const struct weston_xwayland_surface_api surface_api;
WL_EXPORT int
module_init(struct weston_compositor *compositor,
@@ -357,6 +358,13 @@
wxs->wl_display = display;
wxs->compositor = compositor;
+ if (weston_xwayland_get_api(compositor) != NULL ||
+ weston_xwayland_surface_get_api(compositor) != NULL) {
+ weston_log("The xwayland module APIs are already loaded.\n");
+ free(wxs);
+ return -1;
+ }
+
ret = weston_plugin_api_register(compositor, WESTON_XWAYLAND_API_NAME,
&api, sizeof(api));
if (ret < 0) {
@@ -365,6 +373,15 @@
return -1;
}
+ ret = weston_plugin_api_register(compositor,
+ WESTON_XWAYLAND_SURFACE_API_NAME,
+ &surface_api, sizeof(surface_api));
+ if (ret < 0) {
+ weston_log("Failed to register the xwayland surface API.\n");
+ free(wxs);
+ return -1;
+ }
+
wxs->destroy_listener.notify = weston_xserver_destroy;
wl_signal_add(&compositor->destroy_signal, &wxs->destroy_listener);