From 982a696311ed44add2b4a3c54f59a658928fea11 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 14 May 2023 17:37:41 -0400 Subject: wayland: Give toplevels a destroy hook We will need to do some cleanup before the wl_surface is destroyed, so add a hook for that. --- gdk/wayland/gdksurface-wayland.c | 5 ++++- gdk/wayland/gdktoplevel-wayland-private.h | 1 + gdk/wayland/gdktoplevel-wayland.c | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 5663a42d38..9d92737f83 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -1148,7 +1148,10 @@ gdk_wayland_surface_destroy (GdkSurface *surface, gdk_wayland_surface_hide_surface (surface); - gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE(surface)); + if (GDK_IS_TOPLEVEL (surface)) + gdk_wayland_toplevel_destroy (GDK_TOPLEVEL (surface)); + + gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE (surface)); frame_clock = gdk_surface_get_frame_clock (surface); g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, surface); diff --git a/gdk/wayland/gdktoplevel-wayland-private.h b/gdk/wayland/gdktoplevel-wayland-private.h index 9b06101371..bd0836c0a0 100644 --- a/gdk/wayland/gdktoplevel-wayland-private.h +++ b/gdk/wayland/gdktoplevel-wayland-private.h @@ -39,3 +39,4 @@ void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel); gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel); void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel); +void gdk_wayland_toplevel_destroy (GdkToplevel *toplevel); diff --git a/gdk/wayland/gdktoplevel-wayland.c b/gdk/wayland/gdktoplevel-wayland.c index 7b968e5c16..459462485a 100644 --- a/gdk/wayland/gdktoplevel-wayland.c +++ b/gdk/wayland/gdktoplevel-wayland.c @@ -2250,6 +2250,11 @@ gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel, maybe_set_gtk_surface_dbus_properties (wayland_toplevel); } +void +gdk_wayland_toplevel_destroy (GdkToplevel *toplevel) +{ +} + /* }}} */ /* {{{ Toplevel API */ -- cgit v1.2.1