xwayland: make the plugin usable by libweston compositors
This patch follows a similar approach taken to detach the backends from
weston. But instead of passing a configuration struct when loading the
plugin, we use the plugin API registry to register an API, and to get it
in the compositor side. This API allows to spawn the Xwayland process
in the compositor side, and to deal with signal handling. A new
function is added in compositor.c to load and init the xwayland.so
plugin.
Also make sure to re-arm the SIGUSR1 when the X server quits.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
[Pekka: moved xwayland/weston-xwayland.c -> compositor/xwayland.c]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/xwayland/xwayland.h b/xwayland/xwayland.h
index 5606d12..b1225f5 100644
--- a/xwayland/xwayland.h
+++ b/xwayland/xwayland.h
@@ -31,6 +31,7 @@
#include "compositor.h"
#include "compositor/weston.h"
+#include "xwayland-api.h"
#define SEND_EVENT_MASK (0x80)
#define EVENT_TYPE(event) ((event)->response_type & ~SEND_EVENT_MASK)
@@ -38,20 +39,18 @@
struct weston_xserver {
struct wl_display *wl_display;
struct wl_event_loop *loop;
- struct wl_event_source *sigchld_source;
int abstract_fd;
struct wl_event_source *abstract_source;
int unix_fd;
struct wl_event_source *unix_source;
- int wm_fd;
int display;
- struct wl_event_source *sigusr1_source;
- struct weston_process process;
- struct wl_resource *resource;
+ pid_t pid;
struct wl_client *client;
struct weston_compositor *compositor;
struct weston_wm *wm;
struct wl_listener destroy_listener;
+ weston_xwayland_spawn_xserver_func_t spawn_func;
+ void *user_data;
};
struct weston_wm {