From 0c72ce94ead36cbf61acb3962f4ea74aab77c4e4 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Wed, 13 Dec 2023 12:23:43 +0100 Subject: [PATCH] GdkWindow: check for same impl class in set_transient_for () Checking for offscreen windows with gdk_window_is_offscreen () is not enough in this case. What we want here is that the impl classes match, as backends are meant to know only about their windows. Instead gdk_window_is_offscreen () checks whether the GdkWindow.window_type field is GDK_WINDOW_OFFSCREEN. In the case of child windows in offscreen windows, the window type is GDK_WINDOW_CHILD, even though their impl is still GdkOffscreenWindow. So actually check whether GDK_WINDOW_IMPL_GET_CLASS (window) matches GDK_WINDOW_IMPL_GET_CLASS (parent). We may also consider getting the toplevels from child windows, as transient-for relationships are really about toplevels, but child windows doesn't seem to cause problems in practice. --- gdk/gdkwindow.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 62d488d759..62e0cf816f 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -10542,9 +10542,8 @@ void gdk_window_set_transient_for (GdkWindow *window, GdkWindow *parent) { - if (!gdk_window_is_offscreen (window) && - parent != NULL && - gdk_window_is_offscreen (parent)) + if (parent != NULL && + GDK_WINDOW_IMPL_GET_CLASS (window->impl) != GDK_WINDOW_IMPL_GET_CLASS (parent->impl)) { return; }