[PATCH xserver 05/14 v2] xwayland: Bind the relative pointer manager
Jonas Ådahl
jadahl at gmail.com
Tue Sep 13 07:16:59 UTC 2016
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 at gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
No changes since v1.
configure.ac | 4 +++-
hw/xwayland/.gitignore | 2 ++
hw/xwayland/Makefile.am | 21 +++++++++++++++++----
hw/xwayland/xwayland-input.c | 11 +++++++++++
hw/xwayland/xwayland.h | 3 +++
5 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index e206e0f..443de35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2504,7 +2504,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
@@ -2533,6 +2533,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 c54ba2d..6e4e54d 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 34fd633..75b8ead 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 32cfb35..785f56b 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -907,6 +907,15 @@ 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);
+}
+
input_handler(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
{
@@ -915,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 db3dd0b..2d19133 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;
--
2.7.4
More information about the xorg-devel
mailing list