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 @@ -1142,6 +1142,16 @@ 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) @@ -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 #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;