[mutter] wayland: Don't invent our own unstable protocol semantics



commit fea1ddcd29d5067f8bda52bf32f167c3d11ed2c9
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Mar 7 11:33:03 2016 +0800

    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 43c3483..ec8ac2d 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, &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");
 
diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h
index 6813547..9d36130 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 258442c..1dc06a0 100644
--- a/src/wayland/protocol/gtk-shell.xml
+++ b/src/wayland/protocol/gtk-shell.xml
@@ -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"/>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]