summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-09-29 10:42:13 +0800
committerAdam Jackson <ajax@redhat.com>2016-10-05 13:50:46 -0400
commitca7b593fbe54bc9a0b44037e62e4b4401cbd375e (patch)
tree6bec2f04c3c5ca600ffc227ffe4e258440d28807
parentc14a8c6cc0fcd56c380d1220c2a8f04b74edee93 (diff)
xwayland: Bind pointer constraints global
Will be used by the pointer warp emulator. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--hw/xwayland/.gitignore2
-rw-r--r--hw/xwayland/Makefile.am9
-rw-r--r--hw/xwayland/xwayland-input.c12
-rw-r--r--hw/xwayland/xwayland.h2
4 files changed, 24 insertions, 1 deletions
diff --git a/hw/xwayland/.gitignore b/hw/xwayland/.gitignore
index 6e4e54d19..38ada56d1 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 75b8eadde..a3c9fce48 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 48f129431..ef3699dbf 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1143,6 +1143,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)
{
@@ -1153,6 +1163,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 e07b850c9..e95559ce9 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;