diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-06-29 09:43:56 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-03-27 09:31:58 -0400 |
commit | 3ea5194c1b3467fb8a6c07b5320857be1f44326d (patch) | |
tree | dcaa50feb212737a36137c587a960ab1faa0d70f | |
parent | 1d81034e55e518f21b8c18c9850a60020d564066 (diff) |
xwayland: Receive client and listen fds over wayland protocol
-rw-r--r-- | hw/xfree86/xwayland/Makefile.am | 8 | ||||
-rw-r--r-- | hw/xfree86/xwayland/xwayland-private.h | 1 | ||||
-rw-r--r-- | hw/xfree86/xwayland/xwayland.c | 37 |
3 files changed, 43 insertions, 3 deletions
diff --git a/hw/xfree86/xwayland/Makefile.am b/hw/xfree86/xwayland/Makefile.am index 999bf7b53..9993a7e12 100644 --- a/hw/xfree86/xwayland/Makefile.am +++ b/hw/xfree86/xwayland/Makefile.am @@ -21,7 +21,9 @@ libxwayland_la_SOURCES = \ xwayland-input.c \ xwayland-private.h \ drm-client-protocol.h \ - drm-protocol.c + drm-protocol.c \ + xserver-client-protocol.h \ + xserver-protocol.c if DRM libxwayland_la_SOURCES += xwayland-drm.c @@ -31,7 +33,9 @@ sdk_HEADERS = xwayland.h BUILT_SOURCES = \ drm-client-protocol.h \ - drm-protocol.c + drm-protocol.c \ + xserver-client-protocol.h \ + xserver-protocol.c CLEANFILES = $(BUILT_SOURCES) diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h index 83f0a561d..a08c2dfed 100644 --- a/hw/xfree86/xwayland/xwayland-private.h +++ b/hw/xfree86/xwayland/xwayland-private.h @@ -56,6 +56,7 @@ struct xwl_screen { struct wl_visual *argb_visual; struct wl_visual *rgb_visual; struct wl_visual *premultiplied_argb_visual; + struct xserver *xorg_server; uint32_t mask; uint32_t flags; char *device_name; diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c index e58a9eaea..d61e11d02 100644 --- a/hw/xfree86/xwayland/xwayland.c +++ b/hw/xfree86/xwayland/xwayland.c @@ -36,6 +36,7 @@ #include <wayland-client.h> #include <X11/extensions/compositeproto.h> +#include <xorg-server.h> #include <compositeext.h> #include <selection.h> #include <extinit.h> @@ -44,9 +45,11 @@ #include <xf86Crtc.h> #include <xf86Priv.h> #include <mipointrst.h> +#include <os.h> #include "xwayland.h" #include "xwayland-private.h" +#include "xserver-client-protocol.h" /* * TODO: @@ -368,6 +371,9 @@ xwl_realize_window(WindowPtr window) return FALSE; } + xserver_set_window_id(xwl_screen->xorg_server, + xwl_window->surface, window->drawable.id); + visual = wVisual(window); for (i = 0; i < screen->numVisuals; i++) if (screen->visuals[i].vid == visual) @@ -391,6 +397,7 @@ xwl_realize_window(WindowPtr window) list_add(&xwl_window->link, &xwl_screen->window_list); list_init(&xwl_window->link_damage); + return ret; } @@ -652,15 +659,43 @@ static miPointerSpriteFuncRec xwl_pointer_sprite_funcs = xwl_device_cursor_cleanup }; +static void +xserver_client(void *data, struct xserver *xserver, int fd) +{ + AddClientOnOpenFD(fd); +} + +static void +xserver_listen_socket(void *data, struct xserver *xserver, int fd) +{ + ListenOnOpenFD(fd, TRUE); +} + +static const struct xserver_listener xserver_listener = { + xserver_client, + xserver_listen_socket +}; + static CARD32 xwl_input_delayed_init(OsTimerPtr timer, CARD32 time, pointer data) { struct xwl_screen *xwl_screen = data; + uint32_t id; xwl_input_init(xwl_screen); TimerFree(timer); - return 0; + id = wl_display_get_global(xwl_screen->display, "xserver", 1); + if (id == 0) { + ErrorF("No xserver interface"); + return Success; + } + + xwl_screen->xorg_server = xserver_create (xwl_screen->display, id, 1); + xserver_add_listener(xwl_screen->xorg_server, + &xserver_listener, xwl_screen); + + return Success; } static void |