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>
This commit is contained in:
Jonas Ådahl 2016-09-29 10:42:13 +08:00 committed by Adam Jackson
parent c14a8c6cc0
commit ca7b593fbe
4 changed files with 24 additions and 1 deletions

View File

@ -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

View File

@ -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 < $< > $@

View File

@ -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);
}
}

View File

@ -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;