Will be used by the pointer warp emulator.
Signed-off-by: Jonas Ådahl <[email protected]>
Reviewed-by: Peter Hutterer <[email protected]>
---
Changes since v2:
Fix git history rewrite fail (return type of previous patch added in this one).
hw/xwayland/.gitignore | 2 ++
hw/xwayland/Makefile.am | 9 ++++++++-
hw/xwayland/xwayland-input.c | 12 ++++++++++++
hw/xwayland/xwayland.h | 2 ++
4 files changed, 24 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 1753eb0..1fe9ece 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1144,6 +1144,16 @@ init_relative_pointer_manager(struct xwl_screen
*xwl_screen,
}
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)
{
@@ -1154,6 +1164,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
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel