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
This commit is contained in:
Jonas Ådahl 2015-08-20 11:29:23 +08:00
parent 637be80c86
commit e76c3ecb00
3 changed files with 15 additions and 2 deletions

View File

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

View File

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

View File

@ -16,6 +16,10 @@
name and the version will be reset to 1.
</description>
<enum name="error">
<entry name="version_mismatch" value="0"/>
</enum>
<request name="get_swipe_gesture">
<description summary="get swipe gesture">
Create a swipe gesture object. See the