wayland: Don't invent our own unstable protocol semantics

The gtk_shell protocol used some half baked unstable protocol semantics
that worked by only allowing binding the exact version of the
interface. This hack is a bit too confusing and it makes it impossible
to do any compatible changes without breaking things.

So, instead rename it to include a number in the interface names. This
way we can add requests and events without causing compatibility issues,
and we can later remove requests and events by bumping the number in
the interface names.

https://bugzilla.gnome.org/show_bug.cgi?id=763284
This commit is contained in:
Jonas Ådahl 2016-03-07 11:33:03 +08:00
parent 3b023ea994
commit fea1ddcd29
3 changed files with 17 additions and 28 deletions

View File

@ -2016,7 +2016,7 @@ gtk_surface_unset_modal (struct wl_client *client,
meta_window_set_type (surface->window, META_WINDOW_NORMAL);
}
static const struct gtk_surface_interface meta_wayland_gtk_surface_interface = {
static const struct gtk_surface1_interface meta_wayland_gtk_surface_interface = {
gtk_surface_set_dbus_properties,
gtk_surface_set_modal,
gtk_surface_unset_modal,
@ -2038,7 +2038,10 @@ get_gtk_surface (struct wl_client *client,
return;
}
surface->gtk_surface = wl_resource_create (client, &gtk_surface_interface, wl_resource_get_version (resource), id);
surface->gtk_surface = wl_resource_create (client,
&gtk_surface1_interface,
wl_resource_get_version (resource),
id);
wl_resource_set_implementation (surface->gtk_surface, &meta_wayland_gtk_surface_interface, surface, gtk_surface_destructor);
}
@ -2054,7 +2057,7 @@ set_startup_id (struct wl_client *client,
startup_id);
}
static const struct gtk_shell_interface meta_wayland_gtk_shell_interface = {
static const struct gtk_shell1_interface meta_wayland_gtk_shell_interface = {
get_gtk_surface,
set_startup_id
};
@ -2068,24 +2071,13 @@ bind_gtk_shell (struct wl_client *client,
struct wl_resource *resource;
uint32_t capabilities = 0;
resource = wl_resource_create (client, &gtk_shell_interface, version, id);
if (version < 2)
{
wl_resource_post_error (resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"Incompatible gtk-shell version "
"(supported version: %d)",
META_GTK_SHELL_VERSION);
return;
}
resource = wl_resource_create (client, &gtk_shell1_interface, version, id);
wl_resource_set_implementation (resource, &meta_wayland_gtk_shell_interface, data, NULL);
if (!meta_prefs_get_show_fallback_app_menu ())
capabilities = GTK_SHELL_CAPABILITY_GLOBAL_APP_MENU;
capabilities = GTK_SHELL1_CAPABILITY_GLOBAL_APP_MENU;
gtk_shell_send_capabilities (resource, capabilities);
gtk_shell1_send_capabilities (resource, capabilities);
}
static void
@ -2348,8 +2340,8 @@ meta_wayland_shell_init (MetaWaylandCompositor *compositor)
g_error ("Failed to register a global wl-shell object");
if (wl_global_create (compositor->wayland_display,
&gtk_shell_interface,
META_GTK_SHELL_VERSION,
&gtk_shell1_interface,
META_GTK_SHELL1_VERSION,
compositor, bind_gtk_shell) == NULL)
g_error ("Failed to register a global gtk-shell object");

View File

@ -42,7 +42,7 @@
#define META_WL_SEAT_VERSION 5
#define META_WL_OUTPUT_VERSION 2
#define META_XSERVER_VERSION 1
#define META_GTK_SHELL_VERSION 3
#define META_GTK_SHELL1_VERSION 1
#define META_WL_SUBCOMPOSITOR_VERSION 1
#define META_ZWP_POINTER_GESTURES_V1_VERSION 1

View File

@ -1,12 +1,9 @@
<protocol name="gtk">
<interface name="gtk_shell" version="3">
<interface name="gtk_shell1" version="1">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it. It is not backward compatible, and a client must
always only bind to the specific version it implements. If a client binds
to a version different from the version the server provides, an error will
be raised.
clients implementing it.
</description>
<enum name="capability">
@ -20,16 +17,16 @@
</event>
<request name="get_gtk_surface">
<arg name="gtk_surface" type="new_id" interface="gtk_surface"/>
<arg name="gtk_surface" type="new_id" interface="gtk_surface1"/>
<arg name="surface" type="object" interface="wl_surface"/>
</request>
<request name="set_startup_id" since="3">
<request name="set_startup_id">
<arg name="startup_id" type="string" allow-null="true"/>
</request>
</interface>
<interface name="gtk_surface" version="3">
<interface name="gtk_surface1" version="1">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>