Merge Thomas Holder's raise transient window into gtk-3-24.

This commit is contained in:
John Ralls 2020-04-05 14:20:27 -07:00
commit 26c75f31f4

View File

@ -743,15 +743,38 @@ _gdk_quartz_window_find_child (GdkWindow *window,
return NULL;
}
/* Raises a transient window.
*/
static void
raise_transient (GdkWindowImplQuartz *impl)
{
/* In quartz the transient-for behavior is implemented by
* attaching the transient-for GdkNSWindows to the parent's
* GdkNSWindow. Stacking is managed by Quartz and the order
* is that of the parent's childWindows array. The only way
* to change that order is to remove the child from the
* parent and then add it back in.
*/
GdkWindowImplQuartz *parent_impl =
GDK_WINDOW_IMPL_QUARTZ (impl->transient_for->impl);
[parent_impl->toplevel removeChildWindow:impl->toplevel];
[parent_impl->toplevel addChildWindow:impl->toplevel
ordered:NSWindowAbove];
}
void
_gdk_quartz_window_did_become_main (GdkWindow *window)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
main_window_stack = g_slist_remove (main_window_stack, window);
if (window->window_type != GDK_WINDOW_TEMP)
main_window_stack = g_slist_prepend (main_window_stack, window);
if (impl->transient_for)
raise_transient (impl);
clear_toplevel_order ();
}
@ -1510,7 +1533,11 @@ gdk_window_quartz_raise (GdkWindow *window)
GdkWindowImplQuartz *impl;
impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
[impl->toplevel orderFront:impl->toplevel];
if (impl->transient_for)
raise_transient (impl);
else
[impl->toplevel orderFront:impl->toplevel];
clear_toplevel_order ();
}