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.
This commit is contained in:
Luca Bacci 2023-12-13 12:23:43 +01:00
parent 9b9560c76a
commit 0c72ce94ea

View File

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