summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-09-29 10:40:01 +0800
committerAdam Jackson <ajax@redhat.com>2016-10-05 13:46:29 -0400
commit9037ba736a0424feee2fb6ac20cf7687613dc452 (patch)
tree9f256ffa36c518f4c783caf1a2798137b98ee3e3
parent0fae3be0686cae746e03d6e4592f97278cc2275d (diff)
downloadxserver-9037ba736a0424feee2fb6ac20cf7687613dc452.tar.gz
xwayland: Bind the relative pointer manager
Will be used for getting unaccelerated motion events and later for relative motions used by a pointer warp emulator. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--configure.ac4
-rw-r--r--hw/xwayland/.gitignore2
-rw-r--r--hw/xwayland/Makefile.am21
-rw-r--r--hw/xwayland/xwayland-input.c12
-rw-r--r--hw/xwayland/xwayland.h3
5 files changed, 37 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 4fff76990..329dc5b3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2533,7 +2533,7 @@ AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
dnl Xwayland DDX
-XWAYLANDMODULES="wayland-client >= 1.3.0 libdrm epoxy"
+XWAYLANDMODULES="wayland-client >= 1.3.0 wayland-protocols >= 1.1 libdrm epoxy"
if test "x$XF86VIDMODE" = xyes; then
XWAYLANDMODULES="$XWAYLANDMODULES $VIDMODEPROTO"
fi
@@ -2562,6 +2562,8 @@ if test "x$XWAYLAND" = xyes; then
WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
[${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
+
+ AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, `$PKG_CONFIG --variable=pkgdatadir wayland-protocols`)
fi
diff --git a/hw/xwayland/.gitignore b/hw/xwayland/.gitignore
index c54ba2de9..6e4e54d19 100644
--- a/hw/xwayland/.gitignore
+++ b/hw/xwayland/.gitignore
@@ -1,3 +1,5 @@
Xwayland
drm-client-protocol.h
drm-protocol.c
+relative-pointer-unstable-v1-client-protocol.h
+relative-pointer-unstable-v1-protocol.c
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index 34fd6336e..75b8eadde 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -30,6 +30,7 @@ Xwayland_LDADD = \
$(XSERVER_SYS_LIBS)
Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xwayland_built_sources =
if GLAMOR_EGL
Xwayland_SOURCES += \
@@ -39,13 +40,11 @@ Xwayland_SOURCES += \
xwayland-glamor-xv.c
endif
-nodist_Xwayland_SOURCES = \
+glamor_built_sources = \
drm-client-protocol.h \
drm-protocol.c
-CLEANFILES = $(nodist_Xwayland_SOURCES)
-
-xwayland-glamor.c : $(nodist_Xwayland_SOURCES)
+Xwayland_built_sources += $(glamor_built_sources)
glamor_lib = $(top_builddir)/glamor/libglamor.la
@@ -53,12 +52,26 @@ Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
Xwayland_DEPENDENCIES = $(glamor_lib) $(XWAYLAND_LIBS)
endif
+Xwayland_built_sources += \
+ relative-pointer-unstable-v1-client-protocol.h \
+ relative-pointer-unstable-v1-protocol.c
+
+nodist_Xwayland_SOURCES = $(Xwayland_built_sources)
+CLEANFILES = $(Xwayland_built_sources)
+
EXTRA_DIST = drm.xml
+$(Xwayland_SOURCES): $(Xwayland_built_sources)
+
relink:
$(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT)
+relative-pointer-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/relative-pointer/relative-pointer-unstable-v1.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+relative-pointer-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/relative-pointer/relative-pointer-unstable-v1.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
+
%-protocol.c : %.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index d3a8e504e..177cf44e3 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -906,6 +906,16 @@ xwl_seat_destroy(struct xwl_seat *xwl_seat)
}
static void
+init_relative_pointer_manager(struct xwl_screen *xwl_screen,
+ uint32_t id, uint32_t version)
+{
+ xwl_screen->relative_pointer_manager =
+ wl_registry_bind(xwl_screen->registry, id,
+ &zwp_relative_pointer_manager_v1_interface,
+ 1);
+}
+
+static void
input_handler(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
{
@@ -914,6 +924,8 @@ input_handler(void *data, struct wl_registry *registry, uint32_t id,
if (strcmp(interface, "wl_seat") == 0 && version >= 3) {
create_input_device(xwl_screen, id, version);
xwl_screen->expecting_event++;
+ } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
+ init_relative_pointer_manager(xwl_screen, id, version);
}
}
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 3ce7a633a..49284359b 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -42,6 +42,8 @@
#include <randrstr.h>
#include <exevents.h>
+#include "relative-pointer-unstable-v1-client-protocol.h"
+
struct xwl_screen {
int width;
int height;
@@ -75,6 +77,7 @@ struct xwl_screen {
struct wl_compositor *compositor;
struct wl_shm *shm;
struct wl_shell *shell;
+ struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
uint32_t serial;