[gtk+] wayland: Use pointer gestures protocol from wayland-protocols
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Use pointer gestures protocol from wayland-protocols
- Date: Thu, 26 Nov 2015 08:57:37 +0000 (UTC)
commit 912e79dbe290d6864acaf85174da9a5b6eec30e1
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Nov 18 11:38:28 2015 +0800
wayland: Use pointer gestures protocol from wayland-protocols
Instead of having our own copy of the pointer gestures XML file, use
the one installed by wayland-protocols.
Since pointer gestures is an unstable protocol, it went through the
unstable protocol naming convention changes, which is reflected in this
commit.
https://bugzilla.gnome.org/show_bug.cgi?id=758634
configure.ac | 4 +-
gdk/wayland/Makefile.am | 21 +++-
gdk/wayland/gdkdevice-wayland.c | 108 +++++++++---------
gdk/wayland/gdkdisplay-wayland.c | 8 +-
gdk/wayland/gdkdisplay-wayland.h | 4 +-
gdk/wayland/protocol/pointer-gestures.xml | 172 -----------------------------
6 files changed, 81 insertions(+), 236 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 32ae090..ba40360 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,7 @@ m4_define([cairo_required_version], [1.14.0])
m4_define([gdk_pixbuf_required_version], [2.30.0])
m4_define([introspection_required_version], [1.39.0])
m4_define([wayland_required_version], [1.5.91])
+m4_define([wayland_protocols_required_version], [1.0])
m4_define([mirclient_required_version], [0.11.0])
m4_define([mircookie_required_version], [0.17.0])
m4_define([epoxy_required_version], [1.0])
@@ -428,7 +429,7 @@ fi
PKG_PROG_PKG_CONFIG
-WAYLAND_DEPENDENCIES="wayland-client >= wayland_required_version xkbcommon >= 0.2.0 wayland-cursor >=
wayland_required_version wayland-egl"
+WAYLAND_DEPENDENCIES="wayland-client >= wayland_required_version wayland-protocols >=
wayland_protocols_required_version xkbcommon >= 0.2.0 wayland-cursor >= wayland_required_version wayland-egl"
if test "$enable_wayland_backend" = "maybe" ; then
AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no])
PKG_CHECK_EXISTS($WAYLAND_DEPENDENCIES, [have_wayland_deps=yes], [have_wayland_deps=no])
@@ -444,6 +445,7 @@ fi
if test "$enable_wayland_backend" = "yes"; then
# For the cairo image backend
cairo_backends="$cairo_backends cairo"
+ AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, `$PKG_CONFIG --variable=pkgdatadir wayland-protocols`)
GDK_BACKENDS="$GDK_BACKENDS wayland"
GDK_WINDOWING="$GDK_WINDOWING
#define GDK_WINDOWING_WAYLAND"
diff --git a/gdk/wayland/Makefile.am b/gdk/wayland/Makefile.am
index 93d099f..187bcfb 100644
--- a/gdk/wayland/Makefile.am
+++ b/gdk/wayland/Makefile.am
@@ -20,8 +20,8 @@ noinst_LTLIBRARIES = \
libgdk-wayland.la
BUILT_SOURCES = \
- pointer-gestures-client-protocol.h \
- pointer-gestures-protocol.c \
+ pointer-gestures-unstable-v1-client-protocol.h \
+ pointer-gestures-unstable-v1-protocol.c \
xdg-shell-client-protocol.h \
xdg-shell-protocol.c \
gtk-shell-client-protocol.h \
@@ -62,6 +62,22 @@ libgdkwaylandinclude_HEADERS = \
gdkwaylandselection.h \
gdkwaylandwindow.h
+.SECONDEXPANSION:
+
+define protostability
+$(shell echo $1 | sed 's/.*\(\<unstable\>\|\<stable\>\).*/\1/')
+endef
+
+define protoname
+$(shell echo $1 | sed 's/\([a-z\-]\+\)-[a-z]\+-v[0-9]\+/\1/')
+endef
+
+%-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+ $(AM_V_GEN)$(SED) -i -e 's/WL_EXPORT //' $@
+%-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
+
%-protocol.c : $(srcdir)/protocol/%.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
$(AM_V_GEN)$(SED) -i -e 's/WL_EXPORT //' $@
@@ -72,7 +88,6 @@ libgdkwaylandinclude_HEADERS = \
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
EXTRA_DIST += \
- protocol/pointer-gestures.xml \
protocol/xdg-shell.xml \
protocol/gtk-shell.xml
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index fb452c9..c8f4d08 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -29,7 +29,7 @@
#include "gdkkeysyms.h"
#include "gdkdeviceprivate.h"
#include "gdkdevicemanagerprivate.h"
-#include "pointer-gestures-client-protocol.h"
+#include "pointer-gestures-unstable-v1-client-protocol.h"
#include <xkbcommon/xkbcommon.h>
@@ -59,8 +59,8 @@ struct _GdkWaylandDeviceData
struct wl_pointer *wl_pointer;
struct wl_keyboard *wl_keyboard;
struct wl_touch *wl_touch;
- struct _wl_pointer_gesture_swipe *wl_pointer_gesture_swipe;
- struct _wl_pointer_gesture_pinch *wl_pointer_gesture_pinch;
+ struct zwp_pointer_gesture_swipe_v1 *wp_pointer_gesture_swipe;
+ struct zwp_pointer_gesture_pinch_v1 *wp_pointer_gesture_pinch;
GdkDisplay *display;
GdkDeviceManager *device_manager;
@@ -1808,12 +1808,12 @@ emit_gesture_swipe_event (GdkWaylandDeviceData *device,
}
static void
-gesture_swipe_begin (void *data,
- struct _wl_pointer_gesture_swipe *swipe,
- uint32_t serial,
- uint32_t time,
- struct wl_surface *surface,
- uint32_t fingers)
+gesture_swipe_begin (void *data,
+ struct zwp_pointer_gesture_swipe_v1 *swipe,
+ uint32_t serial,
+ uint32_t time,
+ struct wl_surface *surface,
+ uint32_t fingers)
{
GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
@@ -1827,11 +1827,11 @@ gesture_swipe_begin (void *data,
}
static void
-gesture_swipe_update (void *data,
- struct _wl_pointer_gesture_swipe *swipe,
- uint32_t time,
- wl_fixed_t dx,
- wl_fixed_t dy)
+gesture_swipe_update (void *data,
+ struct zwp_pointer_gesture_swipe_v1 *swipe,
+ uint32_t time,
+ wl_fixed_t dx,
+ wl_fixed_t dy)
{
GdkWaylandDeviceData *device = data;
@@ -1844,11 +1844,11 @@ gesture_swipe_update (void *data,
}
static void
-gesture_swipe_end (void *data,
- struct _wl_pointer_gesture_swipe *swipe,
- uint32_t serial,
- uint32_t time,
- int32_t cancelled)
+gesture_swipe_end (void *data,
+ struct zwp_pointer_gesture_swipe_v1 *swipe,
+ uint32_t serial,
+ uint32_t time,
+ int32_t cancelled)
{
GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
@@ -1912,12 +1912,12 @@ emit_gesture_pinch_event (GdkWaylandDeviceData *device,
}
static void
-gesture_pinch_begin (void *data,
- struct _wl_pointer_gesture_pinch *pinch,
- uint32_t serial,
- uint32_t time,
- struct wl_surface *surface,
- uint32_t fingers)
+gesture_pinch_begin (void *data,
+ struct zwp_pointer_gesture_pinch_v1 *pinch,
+ uint32_t serial,
+ uint32_t time,
+ struct wl_surface *surface,
+ uint32_t fingers)
{
GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
@@ -1930,13 +1930,13 @@ gesture_pinch_begin (void *data,
}
static void
-gesture_pinch_update (void *data,
- struct _wl_pointer_gesture_pinch *pinch,
- uint32_t time,
- wl_fixed_t dx,
- wl_fixed_t dy,
- wl_fixed_t scale,
- wl_fixed_t rotation)
+gesture_pinch_update (void *data,
+ struct zwp_pointer_gesture_pinch_v1 *pinch,
+ uint32_t time,
+ wl_fixed_t dx,
+ wl_fixed_t dy,
+ wl_fixed_t scale,
+ wl_fixed_t rotation)
{
GdkWaylandDeviceData *device = data;
@@ -1950,11 +1950,11 @@ gesture_pinch_update (void *data,
}
static void
-gesture_pinch_end (void *data,
- struct _wl_pointer_gesture_pinch *pinch,
- uint32_t serial,
- uint32_t time,
- int32_t cancelled)
+gesture_pinch_end (void *data,
+ struct zwp_pointer_gesture_pinch_v1 *pinch,
+ uint32_t serial,
+ uint32_t time,
+ int32_t cancelled)
{
GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
@@ -1996,13 +1996,13 @@ static const struct wl_touch_listener touch_listener = {
touch_handle_cancel
};
-static const struct _wl_pointer_gesture_swipe_listener gesture_swipe_listener = {
+static const struct zwp_pointer_gesture_swipe_v1_listener gesture_swipe_listener = {
gesture_swipe_begin,
gesture_swipe_update,
gesture_swipe_end
};
-static const struct _wl_pointer_gesture_pinch_listener gesture_pinch_listener = {
+static const struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_listener = {
gesture_pinch_begin,
gesture_pinch_update,
gesture_pinch_end
@@ -2046,21 +2046,21 @@ seat_handle_capabilities (void *data,
if (wayland_display->pointer_gestures)
{
- device->wl_pointer_gesture_swipe =
- _wl_pointer_gestures_get_swipe_gesture (wayland_display->pointer_gestures,
- device->wl_pointer);
- _wl_pointer_gesture_swipe_set_user_data (device->wl_pointer_gesture_swipe,
- device);
- _wl_pointer_gesture_swipe_add_listener (device->wl_pointer_gesture_swipe,
- &gesture_swipe_listener, device);
-
- device->wl_pointer_gesture_pinch =
- _wl_pointer_gestures_get_pinch_gesture (wayland_display->pointer_gestures,
- device->wl_pointer);
- _wl_pointer_gesture_pinch_set_user_data (device->wl_pointer_gesture_pinch,
- device);
- _wl_pointer_gesture_pinch_add_listener (device->wl_pointer_gesture_pinch,
- &gesture_pinch_listener, device);
+ device->wp_pointer_gesture_swipe =
+ zwp_pointer_gestures_v1_get_swipe_gesture (wayland_display->pointer_gestures,
+ device->wl_pointer);
+ zwp_pointer_gesture_swipe_v1_set_user_data (device->wp_pointer_gesture_swipe,
+ device);
+ zwp_pointer_gesture_swipe_v1_add_listener (device->wp_pointer_gesture_swipe,
+ &gesture_swipe_listener, device);
+
+ device->wp_pointer_gesture_pinch =
+ zwp_pointer_gestures_v1_get_pinch_gesture (wayland_display->pointer_gestures,
+ device->wl_pointer);
+ zwp_pointer_gesture_pinch_v1_set_user_data (device->wp_pointer_gesture_pinch,
+ device);
+ zwp_pointer_gesture_pinch_v1_add_listener (device->wp_pointer_gesture_pinch,
+ &gesture_pinch_listener, device);
}
g_signal_emit_by_name (device_manager, "device-added", device->pointer);
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 64529fb..287662b 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -35,7 +35,7 @@
#include "gdkkeysprivate.h"
#include "gdkprivate-wayland.h"
#include "gdkglcontext-wayland.h"
-#include "pointer-gestures-client-protocol.h"
+#include "pointer-gestures-unstable-v1-client-protocol.h"
/**
* SECTION:wayland_interaction
@@ -358,12 +358,12 @@ gdk_registry_handle_global (void *data,
display_wayland->subcompositor =
wl_registry_bind (display_wayland->wl_registry, id, &wl_subcompositor_interface, 1);
}
- else if (strcmp (interface, "_wl_pointer_gestures") == 0 &&
- version == GDK__WL_POINTER_GESTURES_VERSION)
+ else if (strcmp (interface, "zwp_pointer_gestures_v1") == 0 &&
+ version == GDK_ZWP_POINTER_GESTURES_V1_VERSION)
{
display_wayland->pointer_gestures =
wl_registry_bind (display_wayland->wl_registry,
- id, &_wl_pointer_gestures_interface, version);
+ id, &zwp_pointer_gestures_v1_interface, version);
}
else
handled = FALSE;
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index 4156bc6..0fb87ee 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -45,7 +45,7 @@ G_BEGIN_DECLS
#define GDK_WAYLAND_MAX_THEME_SCALE 2
#define GDK_WAYLAND_THEME_SCALES_COUNT GDK_WAYLAND_MAX_THEME_SCALE
-#define GDK__WL_POINTER_GESTURES_VERSION 1
+#define GDK_ZWP_POINTER_GESTURES_V1_VERSION 1
typedef struct _GdkWaylandSelection GdkWaylandSelection;
@@ -73,7 +73,7 @@ struct _GdkWaylandDisplay
struct wl_input_device *input_device;
struct wl_data_device_manager *data_device_manager;
struct wl_subcompositor *subcompositor;
- struct _wl_pointer_gestures *pointer_gestures;
+ struct zwp_pointer_gestures_v1 *pointer_gestures;
GList *async_roundtrips;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]