From 89d993b6ecb30c76df9b948b80444c871b20a253 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 14 May 2023 19:14:58 -0400 Subject: [PATCH] wayland: Try harder to be compatible We can keep the old unexport_handle api working in the case that there is only a single exported handle. --- gdk/wayland/gdktoplevel-wayland.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gdk/wayland/gdktoplevel-wayland.c b/gdk/wayland/gdktoplevel-wayland.c index efeb857b21..efe9ef86ce 100644 --- a/gdk/wayland/gdktoplevel-wayland.c +++ b/gdk/wayland/gdktoplevel-wayland.c @@ -2557,6 +2557,20 @@ gdk_wayland_toplevel_export_handle (GdkToplevel *toplevel, void gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel) { + GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel); + + if (wayland_toplevel->exported != NULL && + wayland_toplevel->exported->next == NULL) + { + GdkWaylandExported *exported = wayland_toplevel->exported->data; + + if (exported->handle) + { + gdk_toplevel_unexport_handle (toplevel, exported->handle); + return; + } + } + g_warning ("Use gdk_wayland_toplevel_drop_exported_handle()"); } -- 2.30.2