Fix (de)miniaturizing transient windows, by (un)setting the parent before

2007-07-06  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkwindow-quartz.c:
	* gdk/quartz/GdkQuartzWindow.c: Fix (de)miniaturizing transient
	windows, by (un)setting the parent before and after miniaturizing.

svn path=/trunk/; revision=18388
This commit is contained in:
Richard Hult 2007-07-06 19:49:42 +00:00 committed by Richard Hult
parent 9ba84faa5a
commit 5a4ed10fae
4 changed files with 63 additions and 21 deletions

View File

@ -1,3 +1,10 @@
2007-07-06 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkprivate-quartz.h:
* gdk/quartz/gdkwindow-quartz.c:
* gdk/quartz/GdkQuartzWindow.c: Fix (de)miniaturizing transient
windows, by (un)setting the parent before and after miniaturizing.
2007-07-06 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkkeys-quartz.c (gdk_keymap_have_bidi_layouts): Add

View File

@ -39,6 +39,13 @@
return NO;
}
-(void)windowWillMiniaturize:(NSNotification *)aNotification
{
GdkWindow *window = [[self contentView] gdkWindow];
_gdk_quartz_window_detach_from_parent (window);
}
-(void)windowDidMiniaturize:(NSNotification *)aNotification
{
GdkWindow *window = [[self contentView] gdkWindow];
@ -51,6 +58,8 @@
{
GdkWindow *window = [[self contentView] gdkWindow];
_gdk_quartz_window_attach_to_parent (window);
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_ICONIFIED, 0);
}

View File

@ -138,6 +138,9 @@ gint _gdk_quartz_window_get_inverted_screen_y (gint y);
GdkWindow *_gdk_quartz_window_find_child (GdkWindow *window,
gint x,
gint y);
void _gdk_quartz_window_attach_to_parent (GdkWindow *window);
void _gdk_quartz_window_detach_from_parent (GdkWindow *window);
/* Events */
void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,

View File

@ -834,6 +834,47 @@ show_window_internal (GdkWindow *window,
if (private->state & GDK_WINDOW_STATE_ICONIFIED)
gdk_window_iconify (window);
if (impl->transient_for && !GDK_WINDOW_DESTROYED (impl->transient_for))
_gdk_quartz_window_attach_to_parent (window);
GDK_QUARTZ_RELEASE_POOL;
}
/* Temporarily unsets the parent window, if the window is a
* transient.
*/
void
_gdk_quartz_window_detach_from_parent (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
g_return_if_fail (GDK_IS_WINDOW (window));
impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
g_return_if_fail (impl->toplevel != NULL);
if (impl->transient_for && !GDK_WINDOW_DESTROYED (impl->transient_for))
{
GdkWindowImplQuartz *parent_impl;
parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (impl->transient_for)->impl);
[parent_impl->toplevel removeChildWindow:impl->toplevel];
}
}
/* Re-sets the parent window, if the window is a transient. */
void
_gdk_quartz_window_attach_to_parent (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
g_return_if_fail (GDK_IS_WINDOW (window));
impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
g_return_if_fail (impl->toplevel != NULL);
if (impl->transient_for && !GDK_WINDOW_DESTROYED (impl->transient_for))
{
GdkWindowImplQuartz *parent_impl;
@ -841,8 +882,6 @@ show_window_internal (GdkWindow *window,
parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (impl->transient_for)->impl);
[parent_impl->toplevel addChildWindow:impl->toplevel ordered:NSWindowAbove];
}
GDK_QUARTZ_RELEASE_POOL;
}
void
@ -883,19 +922,8 @@ gdk_window_hide (GdkWindow *window)
if (impl->toplevel)
{
/* We must unset the transient while it is hidden, otherwise
* quartz won't hide the window.
*/
if (impl->transient_for)
{
if (!GDK_WINDOW_DESTROYED (impl->transient_for))
{
GdkWindowImplQuartz *parent_impl;
parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (impl->transient_for)->impl);
[parent_impl->toplevel removeChildWindow:impl->toplevel];
}
}
_gdk_quartz_window_detach_from_parent (window);
[impl->toplevel orderOut:nil];
}
@ -955,7 +983,6 @@ move_resize_window_internal (GdkWindow *window,
NSRect frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
frame_rect.origin.y -= frame_rect.size.height;
[impl->toplevel setFrame:frame_rect display:YES];
}
else
@ -1563,11 +1590,7 @@ gdk_window_set_transient_for (GdkWindow *window,
if (window_impl->transient_for)
{
if (!GDK_WINDOW_DESTROYED (window_impl->transient_for))
{
parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window_impl->transient_for)->impl);
[parent_impl->toplevel removeChildWindow:window_impl->toplevel];
}
_gdk_quartz_window_detach_from_parent (window);
g_object_unref (window_impl->transient_for);
window_impl->transient_for = NULL;
@ -1594,7 +1617,7 @@ gdk_window_set_transient_for (GdkWindow *window,
* window will be added in show() instead.
*/
if (!(GDK_WINDOW_OBJECT (window)->state & GDK_WINDOW_STATE_WITHDRAWN))
[parent_impl->toplevel addChildWindow:window_impl->toplevel ordered:NSWindowAbove];
_gdk_quartz_window_attach_to_parent (window);
}
}