From c9aa43aa7a40bb0a74c9d98836599825441fc154 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Tue, 9 Jun 2020 04:22:31 +0200 Subject: [PATCH] wayland/gtk-shell: Add an explicit gtk-shell surface release request Previously the wl_resource and MetaWaylandGtkSurface corresponding to any client gtk_surface have been kept around until the exit of the client due to the client side destroy method not signaling the destruction to the server. Ideally the protocol would have specified a destroy request marked as destructor to handle this automatically, however this is no longer possible due to the destroy method being implicitly generated in the absence of an explicit request in the protocol. Adding a destroy request marked as destructor now would generate a new destroy method that unconditionally would send the request to the server, which would break clients running on servers not supporting that request. So instead of modifying the destroy request add a new "release" destructor, that indicates to the server that it can release the resource. This can be optionally be used by clients depending on the server protocol version. Part-of: --- src/wayland/meta-wayland-gtk-shell.c | 8 ++++++++ src/wayland/meta-wayland-versions.h | 2 +- src/wayland/protocol/gtk-shell.xml | 7 +++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c index 1fc74787b..12e1b0e4a 100644 --- a/src/wayland/meta-wayland-gtk-shell.c +++ b/src/wayland/meta-wayland-gtk-shell.c @@ -208,12 +208,20 @@ gtk_surface_request_focus (struct wl_client *client, } } +static void +gtk_surface_release (struct wl_client *client, + struct wl_resource *resource) +{ + wl_resource_destroy (resource); +} + static const struct gtk_surface1_interface meta_wayland_gtk_surface_interface = { gtk_surface_set_dbus_properties, gtk_surface_set_modal, gtk_surface_unset_modal, gtk_surface_present, gtk_surface_request_focus, + gtk_surface_release }; static void diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h index 7a750413f..bf891d99a 100644 --- a/src/wayland/meta-wayland-versions.h +++ b/src/wayland/meta-wayland-versions.h @@ -43,7 +43,7 @@ #define META_WL_SEAT_VERSION 5 #define META_WL_OUTPUT_VERSION 2 #define META_XSERVER_VERSION 1 -#define META_GTK_SHELL1_VERSION 3 +#define META_GTK_SHELL1_VERSION 4 #define META_WL_SUBCOMPOSITOR_VERSION 1 #define META_ZWP_POINTER_GESTURES_V1_VERSION 1 #define META_ZXDG_EXPORTER_V1_VERSION 1 diff --git a/src/wayland/protocol/gtk-shell.xml b/src/wayland/protocol/gtk-shell.xml index fb91940b3..1aab593c4 100644 --- a/src/wayland/protocol/gtk-shell.xml +++ b/src/wayland/protocol/gtk-shell.xml @@ -1,6 +1,6 @@ - + gtk_shell is a protocol extension providing additional features for clients implementing it. @@ -35,7 +35,7 @@ - + @@ -82,6 +82,9 @@ + + +