Commit e278f389 authored by Thomas Holder's avatar Thomas Holder
Browse files

macOS: fix #2436 raise transient window on focus

parent f5b393fe
......@@ -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 ();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment