From 2ee1c5fa6113055ecc4abe1c0ca2a00efa708354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 9 Nov 2015 15:28:14 +0800 Subject: [PATCH] wayland: Use pointer gestures protocol from wayand-protocols Remove our own copy of the pointer gestures protocol, and us the one installed by wayland-protocols. This also means the new fixed unstable naming conventions are used for the new version of the protocol, which is reflected in the change. No functional changes were made, it is only a rename. https://bugzilla.gnome.org/show_bug.cgi?id=758633 --- .gitignore | 4 +- configure.ac | 5 + src/Makefile.am | 19 +- .../meta-wayland-pointer-gesture-pinch.c | 32 ++-- .../meta-wayland-pointer-gesture-swipe.c | 28 +-- src/wayland/meta-wayland-pointer-gestures.c | 20 +- src/wayland/meta-wayland-versions.h | 2 +- src/wayland/protocol/pointer-gestures.xml | 176 ------------------ 8 files changed, 60 insertions(+), 226 deletions(-) delete mode 100644 src/wayland/protocol/pointer-gestures.xml diff --git a/.gitignore b/.gitignore index e1610a5f6..84909133c 100644 --- a/.gitignore +++ b/.gitignore @@ -66,8 +66,8 @@ src/gtk-shell-protocol.c src/gtk-shell-server-protocol.h src/xdg-shell-protocol.c src/xdg-shell-server-protocol.h -src/pointer-gestures-protocol.c -src/pointer-gestures-server-protocol.h +src/pointer-gestures-unstable-v1-protocol.c +src/pointer-gestures-unstable-v1-server-protocol.h src/xserver-protocol.c src/xserver-server-protocol.h src/meta/meta-version.h diff --git a/configure.ac b/configure.ac index 711e8c7bd..1ee3d09bf 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,7 @@ IT_PROG_INTLTOOL([0.41]) AC_PROG_CC AC_PROG_CC_C_O AC_PROG_INSTALL +AC_PROG_SED AC_HEADER_STDC PKG_PROG_PKG_CONFIG([0.21]) @@ -219,6 +220,10 @@ AS_IF([test "$have_wayland" = "yes"], [ [AC_MSG_ERROR([Could not find wayland-scanner in your PATH, required for parsing wayland extension protocols])]) AC_SUBST([WAYLAND_SCANNER]) AC_DEFINE([HAVE_WAYLAND],[1],[Define if you want to enable Wayland support]) + + PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, [wayland-protocols >= 1.0], + [ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`]) + AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir) ]) AM_CONDITIONAL([HAVE_WAYLAND],[test "$have_wayland" = "yes"]) diff --git a/src/Makefile.am b/src/Makefile.am index 3e48bd038..ce4665ed2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,8 +45,8 @@ mutter_built_sources = \ if HAVE_WAYLAND mutter_built_sources += \ - pointer-gestures-protocol.c \ - pointer-gestures-server-protocol.h \ + pointer-gestures-unstable-v1-protocol.c \ + pointer-gestures-unstable-v1-server-protocol.h \ gtk-shell-protocol.c \ gtk-shell-server-protocol.h \ xdg-shell-protocol.c \ @@ -55,7 +55,6 @@ mutter_built_sources += \ endif wayland_protocols = \ - wayland/protocol/pointer-gestures.xml \ wayland/protocol/gtk-shell.xml \ wayland/protocol/xdg-shell.xml \ $(NULL) @@ -481,6 +480,20 @@ $(dbus_login1_built_sources) : Makefile.am org.freedesktop.login1.xml --generate-c-code meta-dbus-login1 \ $(srcdir)/org.freedesktop.login1.xml +.SECONDEXPANSION: + +define protostability +$(shell echo $1 | sed 's/.*\(\\|\\).*/\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 < $< > $@ +%-server-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@ %-protocol.c : $(srcdir)/wayland/protocol/%.xml $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ %-server-protocol.h : $(srcdir)/wayland/protocol/%.xml diff --git a/src/wayland/meta-wayland-pointer-gesture-pinch.c b/src/wayland/meta-wayland-pointer-gesture-pinch.c index 37022c9d1..fa1371937 100644 --- a/src/wayland/meta-wayland-pointer-gesture-pinch.c +++ b/src/wayland/meta-wayland-pointer-gesture-pinch.c @@ -30,7 +30,7 @@ #include "meta-wayland-pointer-gesture-pinch.h" #include "meta-wayland-pointer.h" #include "meta-wayland-surface.h" -#include "pointer-gestures-server-protocol.h" +#include "pointer-gestures-unstable-v1-server-protocol.h" static void handle_pinch_begin (MetaWaylandPointer *pointer, @@ -45,10 +45,10 @@ handle_pinch_begin (MetaWaylandPointer *pointer, wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources) { - _wl_pointer_gesture_pinch_send_begin (resource, serial, - clutter_event_get_time (event), - pointer->focus_surface->resource, - 2); + zwp_pointer_gesture_pinch_v1_send_begin (resource, serial, + clutter_event_get_time (event), + pointer->focus_surface->resource, + 2); } } @@ -67,12 +67,12 @@ handle_pinch_update (MetaWaylandPointer *pointer, wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources) { - _wl_pointer_gesture_pinch_send_update (resource, - clutter_event_get_time (event), - wl_fixed_from_double (dx), - wl_fixed_from_double (dy), - wl_fixed_from_double (scale), - wl_fixed_from_double (rotation)); + zwp_pointer_gesture_pinch_v1_send_update (resource, + clutter_event_get_time (event), + wl_fixed_from_double (dx), + wl_fixed_from_double (dy), + wl_fixed_from_double (scale), + wl_fixed_from_double (rotation)); } } @@ -93,9 +93,9 @@ handle_pinch_end (MetaWaylandPointer *pointer, wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources) { - _wl_pointer_gesture_pinch_send_end (resource, serial, - clutter_event_get_time (event), - cancelled); + zwp_pointer_gesture_pinch_v1_send_end (resource, serial, + clutter_event_get_time (event), + cancelled); } } @@ -135,7 +135,7 @@ pointer_gesture_pinch_destroy (struct wl_client *client, wl_resource_destroy (resource); } -static const struct _wl_pointer_gesture_pinch_interface pointer_gesture_pinch_interface = { +static const struct zwp_pointer_gesture_pinch_v1_interface pointer_gesture_pinch_interface = { pointer_gesture_pinch_destroy }; @@ -151,7 +151,7 @@ meta_wayland_pointer_gesture_pinch_create_new_resource (MetaWaylandPointer *poin pointer_client = meta_wayland_pointer_get_pointer_client (pointer, client); g_return_if_fail (pointer_client != NULL); - res = wl_resource_create (client, &_wl_pointer_gesture_pinch_interface, + res = wl_resource_create (client, &zwp_pointer_gesture_pinch_v1_interface, wl_resource_get_version (gestures_resource), id); wl_resource_set_implementation (res, &pointer_gesture_pinch_interface, pointer, meta_wayland_pointer_unbind_pointer_client_resource); diff --git a/src/wayland/meta-wayland-pointer-gesture-swipe.c b/src/wayland/meta-wayland-pointer-gesture-swipe.c index 990ad89b3..a1921289c 100644 --- a/src/wayland/meta-wayland-pointer-gesture-swipe.c +++ b/src/wayland/meta-wayland-pointer-gesture-swipe.c @@ -30,7 +30,7 @@ #include "meta-wayland-pointer-gesture-swipe.h" #include "meta-wayland-pointer.h" #include "meta-wayland-surface.h" -#include "pointer-gestures-server-protocol.h" +#include "pointer-gestures-unstable-v1-server-protocol.h" static void handle_swipe_begin (MetaWaylandPointer *pointer, @@ -46,10 +46,10 @@ handle_swipe_begin (MetaWaylandPointer *pointer, wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources) { - _wl_pointer_gesture_swipe_send_begin (resource, serial, - clutter_event_get_time (event), - pointer->focus_surface->resource, - fingers); + zwp_pointer_gesture_swipe_v1_send_begin (resource, serial, + clutter_event_get_time (event), + pointer->focus_surface->resource, + fingers); } } @@ -66,10 +66,10 @@ handle_swipe_update (MetaWaylandPointer *pointer, wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources) { - _wl_pointer_gesture_swipe_send_update (resource, - clutter_event_get_time (event), - wl_fixed_from_double (dx), - wl_fixed_from_double (dy)); + zwp_pointer_gesture_swipe_v1_send_update (resource, + clutter_event_get_time (event), + wl_fixed_from_double (dx), + wl_fixed_from_double (dy)); } } @@ -90,9 +90,9 @@ handle_swipe_end (MetaWaylandPointer *pointer, wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources) { - _wl_pointer_gesture_swipe_send_end (resource, serial, - clutter_event_get_time (event), - cancelled); + zwp_pointer_gesture_swipe_v1_send_end (resource, serial, + clutter_event_get_time (event), + cancelled); } } @@ -131,7 +131,7 @@ pointer_gesture_swipe_release (struct wl_client *client, wl_resource_destroy (resource); } -static const struct _wl_pointer_gesture_swipe_interface pointer_gesture_swipe_interface = { +static const struct zwp_pointer_gesture_swipe_v1_interface pointer_gesture_swipe_interface = { pointer_gesture_swipe_release }; @@ -147,7 +147,7 @@ meta_wayland_pointer_gesture_swipe_create_new_resource (MetaWaylandPointer *poin pointer_client = meta_wayland_pointer_get_pointer_client (pointer, client); g_return_if_fail (pointer_client != NULL); - res = wl_resource_create (client, &_wl_pointer_gesture_swipe_interface, + res = wl_resource_create (client, &zwp_pointer_gesture_swipe_v1_interface, wl_resource_get_version (pointer_resource), id); wl_resource_set_implementation (res, &pointer_gesture_swipe_interface, pointer, meta_wayland_pointer_unbind_pointer_client_resource); diff --git a/src/wayland/meta-wayland-pointer-gestures.c b/src/wayland/meta-wayland-pointer-gestures.c index 17fae0fae..82cfb43a1 100644 --- a/src/wayland/meta-wayland-pointer-gestures.c +++ b/src/wayland/meta-wayland-pointer-gestures.c @@ -27,7 +27,7 @@ #include #include "meta-wayland-pointer-gestures.h" -#include "pointer-gestures-server-protocol.h" +#include "pointer-gestures-unstable-v1-server-protocol.h" #include "meta-wayland-versions.h" #include "meta-wayland-private.h" @@ -53,7 +53,7 @@ gestures_get_pinch (struct wl_client *client, meta_wayland_pointer_gesture_pinch_create_new_resource (pointer, client, resource, id); } -static const struct _wl_pointer_gestures_interface pointer_gestures_interface = { +static const struct zwp_pointer_gestures_v1_interface pointer_gestures_interface = { gestures_get_swipe, gestures_get_pinch }; @@ -66,16 +66,8 @@ bind_pointer_gestures (struct wl_client *client, { struct wl_resource *resource; - resource = wl_resource_create (client, &_wl_pointer_gestures_interface, version, id); - - if (version != META__WL_POINTER_GESTURES_VERSION) - { - wl_resource_post_error (resource, - _WL_POINTER_GESTURES_ERROR_VERSION_MISMATCH, - "The client bound a non-supported version"); - return; - } - + resource = wl_resource_create (client, &zwp_pointer_gestures_v1_interface, + version, id); wl_resource_set_implementation (resource, &pointer_gestures_interface, NULL, NULL); } @@ -84,7 +76,7 @@ void meta_wayland_pointer_gestures_init (MetaWaylandCompositor *compositor) { wl_global_create (compositor->wayland_display, - &_wl_pointer_gestures_interface, - META__WL_POINTER_GESTURES_VERSION, + &zwp_pointer_gestures_v1_interface, + META_ZWP_POINTER_GESTURES_V1_VERSION, NULL, bind_pointer_gestures); } diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h index 9ca8def69..a6de27b31 100644 --- a/src/wayland/meta-wayland-versions.h +++ b/src/wayland/meta-wayland-versions.h @@ -44,6 +44,6 @@ #define META_XSERVER_VERSION 1 #define META_GTK_SHELL_VERSION 2 #define META_WL_SUBCOMPOSITOR_VERSION 1 -#define META__WL_POINTER_GESTURES_VERSION 1 +#define META_ZWP_POINTER_GESTURES_V1_VERSION 1 #endif diff --git a/src/wayland/protocol/pointer-gestures.xml b/src/wayland/protocol/pointer-gestures.xml deleted file mode 100644 index 041bf1401..000000000 --- a/src/wayland/protocol/pointer-gestures.xml +++ /dev/null @@ -1,176 +0,0 @@ - - - - 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. - - - - - - - - - Create a swipe gesture object. See the - wl_pointer_gesture_swipe interface for details. - - - - - - - - Create a pinch gesture object. See the - wl_pointer_gesture_pinch interface for details. - - - - - - - - - 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. - - - - - - - - - This event is sent when a multi-finger swipe gesture is detected - on the device. - - - - - - - - - - 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. - - - - - - - - - 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. - - - - - - - - - - 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. - - - - - - - - - This event is sent when a multi-finger pinch gesture is detected - on the device. - - - - - - - - - - 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. - - - - - - - - - - - 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. - - - - - - -