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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1307>
This commit is contained in:
Sebastian Keller 2020-06-09 04:22:31 +02:00 committed by Marge Bot
parent b41c4aec26
commit c9aa43aa7a
3 changed files with 14 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
<protocol name="gtk">
<interface name="gtk_shell1" version="3">
<interface name="gtk_shell1" version="4">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it.
@ -35,7 +35,7 @@
</request>
</interface>
<interface name="gtk_surface1" version="3">
<interface name="gtk_surface1" version="4">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>
@ -82,6 +82,9 @@
<request name="request_focus" since="3">
<arg name="startup_id" type="string" allow-null="true"/>
</request>
<!-- Version 4 additions -->
<request name="release" type="destructor" since="4"/>
</interface>
</protocol>