[PATCH xserver 10/12] xwayland: Bind pointer constraints global

Jonas Ådahl jadahl at gmail.com
Thu Sep 8 10:46:39 UTC 2016


Will be used by the pointer warp emulator.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 hw/xwayland/.gitignore       |  2 ++
 hw/xwayland/Makefile.am      |  9 ++++++++-
 hw/xwayland/xwayland-input.c | 13 +++++++++++++
 hw/xwayland/xwayland.h       |  2 ++
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/.gitignore b/hw/xwayland/.gitignore
index 6e4e54d..38ada56 100644
--- a/hw/xwayland/.gitignore
+++ b/hw/xwayland/.gitignore
@@ -1,5 +1,7 @@
 Xwayland
 drm-client-protocol.h
 drm-protocol.c
+pointer-constraints-unstable-v1-client-protocol.h
+pointer-constraints-unstable-v1-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 75b8ead..a3c9fce 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -54,7 +54,9 @@ endif
 
 Xwayland_built_sources +=					\
 	relative-pointer-unstable-v1-client-protocol.h		\
-	relative-pointer-unstable-v1-protocol.c
+	relative-pointer-unstable-v1-protocol.c			\
+	pointer-constraints-unstable-v1-client-protocol.h	\
+	pointer-constraints-unstable-v1-protocol.c
 
 nodist_Xwayland_SOURCES = $(Xwayland_built_sources)
 CLEANFILES = $(Xwayland_built_sources)
@@ -72,6 +74,11 @@ relative-pointer-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/
 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 < $< > $@
 
+pointer-constraints-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
+	$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+pointer-constraints-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/pointer-constraints/pointer-constraints-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 e1d751c..e3d6608 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1128,6 +1128,17 @@ init_relative_pointer_manager(struct xwl_screen *xwl_screen,
                          1);
 }
 
+static void
+init_pointer_constraints(struct xwl_screen *xwl_screen,
+                         uint32_t id, uint32_t version)
+{
+    xwl_screen->pointer_constraints =
+        wl_registry_bind(xwl_screen->registry, id,
+                         &zwp_pointer_constraints_v1_interface,
+                         1);
+}
+
+static void
 input_handler(void *data, struct wl_registry *registry, uint32_t id,
               const char *interface, uint32_t version)
 {
@@ -1138,6 +1149,8 @@ input_handler(void *data, struct wl_registry *registry, uint32_t id,
         xwl_screen->expecting_event++;
     } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
         init_relative_pointer_manager(xwl_screen, id, version);
+    } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
+        init_pointer_constraints(xwl_screen, id, version);
     }
 }
 
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 24b3e91..a5d5d91 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -43,6 +43,7 @@
 #include <exevents.h>
 
 #include "relative-pointer-unstable-v1-client-protocol.h"
+#include "pointer-constraints-unstable-v1-client-protocol.h"
 
 struct xwl_screen {
     int width;
@@ -78,6 +79,7 @@ struct xwl_screen {
     struct wl_shm *shm;
     struct wl_shell *shell;
     struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
+    struct zwp_pointer_constraints_v1 *pointer_constraints;
 
     uint32_t serial;
 
-- 
2.7.4



More information about the xorg-devel mailing list