Merge branch 'set-transient-for-offscreen-windows' into 'gtk-3-24'

GdkWindow: Check for offscreen windows in set_transient_for ()

See merge request GNOME/gtk!6184
This commit is contained in:
Matthias Clasen
2023-07-22 23:43:37 +00:00
2 changed files with 25 additions and 0 deletions

View File

@@ -10542,6 +10542,13 @@ void
gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
if (!gdk_window_is_offscreen (window) &&
parent != NULL &&
gdk_window_is_offscreen (parent))
{
return;
}
window->transient_for = parent;
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_transient_for (window, parent);

View File

@@ -5263,6 +5263,24 @@ gtk_menu_position (GtkMenu *menu,
}
}
if (rect_window != NULL &&
GDK_WINDOW_TYPE (rect_window) == GDK_WINDOW_OFFSCREEN)
{
GdkWindow *effective = gdk_offscreen_window_get_embedder (rect_window);
if (effective)
{
double x = rect.x, y = rect.y;
gdk_window_coords_to_parent (rect_window, x, y, &x, &y);
rect.x = x;
rect.y = y;
}
rect_window = effective;
}
if (!rect_window)
{
gtk_window_set_unlimited_guessed_size (GTK_WINDOW (priv->toplevel),