From fea1ddcd29d5067f8bda52bf32f167c3d11ed2c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 7 Mar 2016 11:33:03 +0800 Subject: 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 --- src/wayland/meta-wayland-surface.c | 30 +++++++++++------------------- src/wayland/meta-wayland-versions.h | 2 +- src/wayland/protocol/gtk-shell.xml | 13 +++++-------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 43c3483b1..ec8ac2ddf 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -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, >k_surface_interface, wl_resource_get_version (resource), id); + surface->gtk_surface = wl_resource_create (client, + >k_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, >k_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, >k_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, - >k_shell_interface, - META_GTK_SHELL_VERSION, + >k_shell1_interface, + META_GTK_SHELL1_VERSION, compositor, bind_gtk_shell) == NULL) g_error ("Failed to register a global gtk-shell object"); diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h index 68135479e..9d3613008 100644 --- a/src/wayland/meta-wayland-versions.h +++ b/src/wayland/meta-wayland-versions.h @@ -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 diff --git a/src/wayland/protocol/gtk-shell.xml b/src/wayland/protocol/gtk-shell.xml index 258442c62..1dc06a0a9 100644 --- a/src/wayland/protocol/gtk-shell.xml +++ b/src/wayland/protocol/gtk-shell.xml @@ -1,12 +1,9 @@ - + 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. @@ -20,16 +17,16 @@ - + - + - + -- cgit v1.2.1