[gtk+] wayland: Don't invent our own unstable protocol semantics
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Don't invent our own unstable protocol semantics
- Date: Thu, 10 Mar 2016 05:04:28 +0000 (UTC)
commit f68cf698fc1476c7d8e8c6a394cf1eb495a0e297
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Mar 7 11:49:35 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=763001
gdk/wayland/gdkdisplay-wayland.c | 21 +++++++++------------
gdk/wayland/gdkdisplay-wayland.h | 2 +-
gdk/wayland/gdkprivate-wayland.h | 4 ----
gdk/wayland/gdkscreen-wayland.c | 23 ++++++++++++++---------
gdk/wayland/gdkwindow-wayland.c | 27 ++++++++++++++-------------
gdk/wayland/protocol/gtk-shell.xml | 13 +++++--------
6 files changed, 43 insertions(+), 47 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index c811f19..d80c2ae 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -262,17 +262,14 @@ gdk_registry_handle_global (void *data,
xdg_shell_use_unstable_version (display_wayland->xdg_shell, XDG_SHELL_VERSION_CURRENT);
xdg_shell_add_listener (display_wayland->xdg_shell, &xdg_shell_listener, display_wayland);
}
- else if (strcmp (interface, "gtk_shell") == 0)
+ else if (strcmp (interface, "gtk_shell1") == 0)
{
- if (version >= MINIMUM_GTK_SHELL_VERSION)
- {
- version = MIN (version, SUPPORTED_GTK_SHELL_VERSION);
- display_wayland->gtk_shell =
- wl_registry_bind(display_wayland->wl_registry, id,
- >k_shell_interface, version);
- _gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen);
- display_wayland->gtk_shell_version = version;
- }
+ display_wayland->gtk_shell =
+ wl_registry_bind(display_wayland->wl_registry, id,
+ >k_shell1_interface,
+ 1);
+ _gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen);
+ display_wayland->gtk_shell_version = version;
}
else if (strcmp (interface, "wl_output") == 0)
{
@@ -666,8 +663,8 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
return;
}
- if (display_wayland->gtk_shell_version >= GTK_SHELL_HAS_SET_STARTUP_ID)
- gtk_shell_set_startup_id (display_wayland->gtk_shell, startup_id);
+ if (display_wayland->gtk_shell)
+ gtk_shell1_set_startup_id (display_wayland->gtk_shell, startup_id);
g_free (free_this);
}
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index 297150e..5410cf3 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -66,7 +66,7 @@ struct _GdkWaylandDisplay
struct wl_compositor *compositor;
struct wl_shm *shm;
struct xdg_shell *xdg_shell;
- struct gtk_shell *gtk_shell;
+ struct gtk_shell1 *gtk_shell;
struct wl_input_device *input_device;
struct wl_data_device_manager *data_device_manager;
struct wl_subcompositor *subcompositor;
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index a60c4c3..cb2c29a 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -44,10 +44,6 @@
#define WL_SURFACE_HAS_BUFFER_SCALE 3
#define WL_POINTER_HAS_FRAME 5
-#define SUPPORTED_GTK_SHELL_VERSION 3
-#define MINIMUM_GTK_SHELL_VERSION 2
-#define GTK_SHELL_HAS_SET_STARTUP_ID 3
-
#define GDK_WINDOW_IS_WAYLAND(win) (GDK_IS_WINDOW_IMPL_WAYLAND (((GdkWindow *)win)->impl))
GdkKeymap *_gdk_wayland_keymap_new (void);
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 0ee0f54..c146cd3 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -647,9 +647,9 @@ init_settings (GdkScreen *screen)
}
static void
-gtk_shell_handle_capabilities (void *data,
- struct gtk_shell *shell,
- uint32_t capabilities)
+gtk_shell_handle_capabilities (void *data,
+ struct gtk_shell1 *shell,
+ uint32_t capabilities)
{
GdkScreen *screen = data;
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (data);
@@ -661,7 +661,7 @@ gtk_shell_handle_capabilities (void *data,
notify_setting (screen, "gtk-shell-shows-desktop");
}
-struct gtk_shell_listener gdk_screen_gtk_shell_listener = {
+struct gtk_shell1_listener gdk_screen_gtk_shell_listener = {
gtk_shell_handle_capabilities
};
@@ -670,7 +670,9 @@ _gdk_wayland_screen_set_has_gtk_shell (GdkScreen *screen)
{
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (GDK_WAYLAND_SCREEN (screen)->display);
- gtk_shell_add_listener (wayland_display->gtk_shell, &gdk_screen_gtk_shell_listener, screen);
+ gtk_shell1_add_listener (wayland_display->gtk_shell,
+ &gdk_screen_gtk_shell_listener,
+ screen);
}
static void
@@ -764,7 +766,7 @@ set_decoration_layout_from_entry (GdkScreen *screen,
static gboolean
set_capability_setting (GdkScreen *screen,
GValue *value,
- enum gtk_shell_capability test)
+ enum gtk_shell1_capability test)
{
GdkWaylandScreen *wayland_screen = GDK_WAYLAND_SCREEN (screen);
@@ -793,13 +795,16 @@ gdk_wayland_screen_get_setting (GdkScreen *screen,
}
if (strcmp (name, "gtk-shell-shows-app-menu") == 0)
- return set_capability_setting (screen, value, GTK_SHELL_CAPABILITY_GLOBAL_APP_MENU);
+ return set_capability_setting (screen, value,
+ GTK_SHELL1_CAPABILITY_GLOBAL_APP_MENU);
if (strcmp (name, "gtk-shell-shows-menubar") == 0)
- return set_capability_setting (screen, value, GTK_SHELL_CAPABILITY_GLOBAL_MENU_BAR);
+ return set_capability_setting (screen, value,
+ GTK_SHELL1_CAPABILITY_GLOBAL_MENU_BAR);
if (strcmp (name, "gtk-shell-shows-desktop") == 0)
- return set_capability_setting (screen, value, GTK_SHELL_CAPABILITY_DESKTOP_ICONS);
+ return set_capability_setting (screen, value,
+ GTK_SHELL1_CAPABILITY_DESKTOP_ICONS);
if (strcmp (name, "gtk-dialogs-use-header") == 0)
{
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 750975a..78295e5 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -102,7 +102,7 @@ struct _GdkWindowImplWayland
struct wl_surface *wl_surface;
struct xdg_surface *xdg_surface;
struct xdg_popup *xdg_popup;
- struct gtk_surface *gtk_surface;
+ struct gtk_surface1 *gtk_surface;
struct wl_subsurface *wl_subsurface;
struct wl_egl_window *egl_window;
struct wl_egl_window *dummy_egl_window;
@@ -1779,7 +1779,7 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
if (impl->display_server.gtk_surface)
{
- gtk_surface_destroy (impl->display_server.gtk_surface);
+ gtk_surface1_destroy (impl->display_server.gtk_surface);
impl->display_server.gtk_surface = NULL;
}
@@ -2120,8 +2120,9 @@ gdk_wayland_window_init_gtk_surface (GdkWindow *window)
if (display->gtk_shell == NULL)
return;
- impl->display_server.gtk_surface = gtk_shell_get_gtk_surface (display->gtk_shell,
- impl->display_server.wl_surface);
+ impl->display_server.gtk_surface =
+ gtk_shell1_get_gtk_surface (display->gtk_shell,
+ impl->display_server.wl_surface);
}
static void
@@ -2134,9 +2135,9 @@ maybe_set_gtk_surface_modal (GdkWindow *window)
return;
if (window->modal_hint)
- gtk_surface_set_modal (impl->display_server.gtk_surface);
+ gtk_surface1_set_modal (impl->display_server.gtk_surface);
else
- gtk_surface_unset_modal (impl->display_server.gtk_surface);
+ gtk_surface1_unset_modal (impl->display_server.gtk_surface);
}
@@ -3024,13 +3025,13 @@ maybe_set_gtk_surface_dbus_properties (GdkWindow *window)
if (impl->display_server.gtk_surface == NULL)
return;
- gtk_surface_set_dbus_properties (impl->display_server.gtk_surface,
- impl->application.application_id,
- impl->application.app_menu_path,
- impl->application.menubar_path,
- impl->application.window_object_path,
- impl->application.application_object_path,
- impl->application.unique_bus_name);
+ gtk_surface1_set_dbus_properties (impl->display_server.gtk_surface,
+ impl->application.application_id,
+ impl->application.app_menu_path,
+ impl->application.menubar_path,
+ impl->application.window_object_path,
+ impl->application.application_object_path,
+ impl->application.unique_bus_name);
impl->application.was_set = TRUE;
}
diff --git a/gdk/wayland/protocol/gtk-shell.xml b/gdk/wayland/protocol/gtk-shell.xml
index 258442c..1dc06a0 100644
--- a/gdk/wayland/protocol/gtk-shell.xml
+++ b/gdk/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]