From 04cf5044dad4c223437423076fa757a3d8a838d2 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Thu, 28 Jan 2021 22:31:03 +0100 Subject: [PATCH] wayland: Signal gtk-shell surface destruction to the server This adds a "release" destructor for the gtk_surface1 interface which signals to the server that a surface has been destroyed on the client side, which the current "destroy" does not do. 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. --- gdk/wayland/gdkdisplay-wayland.c | 2 +- gdk/wayland/gdksurface-wayland.c | 6 +++++- gdk/wayland/protocol/gtk-shell.xml | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 3acc10ed50..b261c77fae 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -94,7 +94,7 @@ #define MIN_SYSTEM_BELL_DELAY_MS 20 -#define GTK_SHELL1_VERSION 3 +#define GTK_SHELL1_VERSION 4 #define OUTPUT_VERSION_WITH_DONE 2 #define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3 diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 0fd1b82a9b..d31e4ae6ee 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -2967,7 +2967,11 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface) if (impl->display_server.gtk_surface) { - gtk_surface1_destroy (impl->display_server.gtk_surface); + if (display_wayland->gtk_shell_version >= + GTK_SURFACE1_RELEASE_SINCE_VERSION) + gtk_surface1_release (impl->display_server.gtk_surface); + else + gtk_surface1_destroy (impl->display_server.gtk_surface); impl->display_server.gtk_surface = NULL; impl->application.was_set = FALSE; } diff --git a/gdk/wayland/protocol/gtk-shell.xml b/gdk/wayland/protocol/gtk-shell.xml index fb91940b30..1aab593c42 100644 --- a/gdk/wayland/protocol/gtk-shell.xml +++ b/gdk/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 @@ + + +