diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 655d0a5535..6f72793a82 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -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 (); }