Commit 912e79db authored by Jonas Ådahl's avatar Jonas Ådahl

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
parent 65b1ee5d
......@@ -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"
......
......@@ -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
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
<protocol name="pointer_gestures">
<interface name="_wl_pointer_gestures" version="1">
<description summary="touchpad gestures">
A global interface to provide semantic touchpad gestures for a given
pointer.
Two gestures are currently supported: swipe and zoom/rotate.
All gestures follow a three-stage cycle: begin, update, end and
are identified by a unique id.
Warning! The protocol described in this file is experimental. Each
version of this protocol should be considered incompatible with any
other version, and a client binding to a version different to the one
advertised will be terminated. Once the protocol is declared stable,
compatibility is guaranteed, the '_' prefix will be removed from the
name and the version will be reset to 1.
</description>
<request name="get_swipe_gesture">
<description summary="get swipe gesture">
Create a swipe gesture object. See the
wl_pointer_gesture_swipe interface for details.
</description>
<arg name="id" type="new_id" interface="_wl_pointer_gesture_swipe"/>
<arg name="pointer" type="object" interface="wl_pointer"/>
</request>
<request name="get_pinch_gesture">
<description summary="get pinch gesture">
Create a pinch gesture object. See the
wl_pointer_gesture_pinch interface for details.
</description>
<arg name="id" type="new_id" interface="_wl_pointer_gesture_pinch"/>
<arg name="pointer" type="object" interface="wl_pointer"/>
</request>
</interface>
<interface name="_wl_pointer_gesture_swipe" version="1">
<description summary="a swipe gesture object">
A swipe gesture object notifies a client about a multi-finger swipe
gesture detected on an indirect input device such as a touchpad.
The gesture is usually initiated by multiple fingers moving in the
same direction but once initiated the direction may change.
The precise conditions of when such a gesture is detected are
implementation-dependent.
A gesture consists of three stages: begin, update (optional) and end.
There cannot be multiple simultaneous pinch or swipe gestures on a
same pointer/seat, how compositors prevent these situations is
implementation-dependent.
A gesture may be cancelled by the compositor or the hardware.
Clients should not consider performing permanent or irreversible
actions until the end of a gesture has been received.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the pointer swipe gesture object"/>
</request>
<event name="begin">
<description summary="multi-finger swipe begin">
This event is sent when a multi-finger swipe gesture is detected
on the device.
</description>
<arg name="serial" type="uint"/>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="fingers" type="uint" summary="number of fingers"/>
</event>
<event name="update">
<description summary="multi-finger swipe motion">
This event is sent when a multi-finger swipe gesture changes the
position of the logical center.
The dx and dy coordinates are relative coordinates of the logical
center of the gesture compared to the previous event.
</description>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
<arg name="dx" type="fixed" summary="delta x coordinate in surface coordinate space"/>
<arg name="dy" type="fixed" summary="delta y coordinate in surface coordinate space"/>
</event>
<event name="end">
<description summary="multi-finger swipe end">
This event is sent when a multi-finger swipe gesture ceases to
be valid. This may happen when one or more finger is lifted or
the gesture is cancelled.
When a gesture is cancelled, the client should undo state changes
caused by this gesture. What causes a gesture to be cancelled is
implementation-dependent.
</description>
<arg name="serial" type="uint"/>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
<arg name="cancelled" type="int" summary="1 if the gesture was cancelled, 0 otherwise"/>
</event>
</interface>
<interface name="_wl_pointer_gesture_pinch" version="1">
<description summary="a pinch gesture object">
A pinch gesture object notifies a client about a multi-finger pinch
gesture detected on an indirect input device such as a touchpad.
The gesture is usually initiated by multiple fingers moving towards
each other or away from each other, or by two or more fingers rotating
around a logical center of gravity. The precise conditions of when
such a gesture is detected are implementation-dependent.
A gesture consists of three stages: begin, update (optional) and end.
There cannot be multiple simultaneous pinch or swipe gestures on a
same pointer/seat, how compositors prevent these situations is
implementation-dependent.
A gesture may be cancelled by the compositor or the hardware.
Clients should not consider performing permanent or irreversible
actions until the end of a gesture has been received.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the pinch gesture object"/>
</request>
<event name="begin">
<description summary="multi-finger pinch begin">
This event is sent when a multi-finger pinch gesture is detected
on the device.
</description>
<arg name="serial" type="uint"/>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="fingers" type="uint" summary="number of fingers"/>
</event>
<event name="update">
<description summary="multi-finger pinch motion">
This event is sent when a multi-finger pinch gesture changes the
position of the logical center, the rotation or the relative scale.
The dx and dy coordinates are relative coordinates in the
surface coordinate space of the logical center of the gesture.
The scale factor is an absolute scale compared to the
pointer_gesture_pinch.begin event, e.g. a scale of 2 means the fingers
are now twice as far apart as on pointer_gesture_pinch.begin.
The rotation is the relative angle in degrees clockwise compared to the previous
pointer_gesture_pinch.begin or pointer_gesture_pinch.update event.
</description>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
<arg name="dx" type="fixed" summary="delta x coordinate in surface coordinate space"/>
<arg name="dy" type="fixed" summary="delta y coordinate in surface coordinate space"/>
<arg name="scale" type="fixed" summary="scale relative to the initial finger position"/>
<arg name="rotation" type="fixed" summary="angle in degrees cw relative to the previous event"/>
</event>
<event name="end">
<description summary="multi-finger pinch end">
This event is sent when a multi-finger pinch gesture ceases to
be valid. This may happen when one or more finger is lifted or
the gesture is cancelled.
When a gesture is cancelled, the client should undo state changes
caused by this gesture. What causes a gesture to be cancelled is
implementation-dependent.
</description>
<arg name="serial" type="uint"/>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
<arg name="cancelled" type="int" summary="1 if the gesture was cancelled, 0 otherwise"/>
</event>
</interface>
</protocol>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment