From e76c3ecb008ac079925b4cf4110c26e9f2f1a01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 20 Aug 2015 11:29:23 +0800 Subject: [PATCH] wayland/pointer-gestures: Send error on protocol version mismatch When a client binds an incompatible version, we should terminate it. This check should only be there for the unstable version, as once it is declared stable and renamed, future versions will be backward compatible. https://bugzilla.gnome.org/show_bug.cgi?id=753855 --- src/wayland/meta-wayland-pointer-gestures.c | 11 ++++++++++- src/wayland/meta-wayland-versions.h | 2 +- src/wayland/protocol/pointer-gestures.xml | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-wayland-pointer-gestures.c b/src/wayland/meta-wayland-pointer-gestures.c index 6fc1f1f54..17fae0fae 100644 --- a/src/wayland/meta-wayland-pointer-gestures.c +++ b/src/wayland/meta-wayland-pointer-gestures.c @@ -67,6 +67,15 @@ 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; + } + wl_resource_set_implementation (resource, &pointer_gestures_interface, NULL, NULL); } @@ -76,6 +85,6 @@ meta_wayland_pointer_gestures_init (MetaWaylandCompositor *compositor) { wl_global_create (compositor->wayland_display, &_wl_pointer_gestures_interface, - META_WL_POINTER_GESTURES_VERSION, + META__WL_POINTER_GESTURES_VERSION, NULL, bind_pointer_gestures); } diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h index e2030d6b2..9ca8def69 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__WL_POINTER_GESTURES_VERSION 1 #endif diff --git a/src/wayland/protocol/pointer-gestures.xml b/src/wayland/protocol/pointer-gestures.xml index 1bca8f7ed..041bf1401 100644 --- a/src/wayland/protocol/pointer-gestures.xml +++ b/src/wayland/protocol/pointer-gestures.xml @@ -16,6 +16,10 @@ name and the version will be reset to 1. + + + + Create a swipe gesture object. See the