From cac12e4d656ed06da022a107312092e4743651d4 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 10 Aug 2006 09:16:38 +0000 Subject: [PATCH] don't try to set the state of unmapped windows, call 2006-08-10 Michael Natterer * gdk/quartz/gdkwindow-quartz.c (gdk_window_maximize) (gdk_window_unmaximize) (gdk_window_iconify) (gdk_window_deiconify): don't try to set the state of unmapped windows, call gdk_synthesize_window_state() instead. Also added autorelease pools back, seems they are needed after all. * gdk/quartz/gdkwindow-quartz.c (show_window_internal): maximize and iconify windows here if the state says so. --- ChangeLog | 13 ++++++ ChangeLog.pre-2-10 | 13 ++++++ gdk/quartz/gdkwindow-quartz.c | 78 ++++++++++++++++++++++++++++++----- 3 files changed, 94 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb364b5f14..9b7691763e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-08-10 Michael Natterer + + * gdk/quartz/gdkwindow-quartz.c + (gdk_window_maximize) + (gdk_window_unmaximize) + (gdk_window_iconify) + (gdk_window_deiconify): don't try to set the state of unmapped + windows, call gdk_synthesize_window_state() instead. Also added + autorelease pools back, seems they are needed after all. + + * gdk/quartz/gdkwindow-quartz.c (show_window_internal): maximize + and iconify windows here if the state says so. + 2006-08-09 Michael Natterer * gdk/quartz/gdkwindow-quartz.c (gdk_window_set_geometry_hints): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index bb364b5f14..9b7691763e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +2006-08-10 Michael Natterer + + * gdk/quartz/gdkwindow-quartz.c + (gdk_window_maximize) + (gdk_window_unmaximize) + (gdk_window_iconify) + (gdk_window_deiconify): don't try to set the state of unmapped + windows, call gdk_synthesize_window_state() instead. Also added + autorelease pools back, seems they are needed after all. + + * gdk/quartz/gdkwindow-quartz.c (show_window_internal): maximize + and iconify windows here if the state says so. + 2006-08-09 Michael Natterer * gdk/quartz/gdkwindow-quartz.c (gdk_window_set_geometry_hints): diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index d70be11ac0..897a352ff9 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -754,7 +754,8 @@ all_parents_shown (GdkWindowObject *private) } static void -show_window_internal (GdkWindow *window, gboolean raise) +show_window_internal (GdkWindow *window, + gboolean raise) { GdkWindowObject *private; GdkWindowImplQuartz *impl; @@ -783,6 +784,12 @@ show_window_internal (GdkWindow *window, gboolean raise) gdk_synthesize_window_state (window, GDK_WINDOW_STATE_WITHDRAWN, 0); + if (private->state & GDK_WINDOW_STATE_MAXIMIZED) + gdk_window_maximize (window); + + if (private->state & GDK_WINDOW_STATE_ICONIFIED) + gdk_window_iconify (window); + GDK_QUARTZ_RELEASE_POOL; } @@ -1788,14 +1795,26 @@ gdk_window_maximize (GdkWindow *window) g_return_if_fail (GDK_IS_WINDOW (window)); - if (GDK_WINDOW_DESTROYED (window)) return; impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl); - if (impl->toplevel && ![impl->toplevel isZoomed]) - [impl->toplevel zoom:nil]; + if (GDK_WINDOW_IS_MAPPED (window)) + { + GDK_QUARTZ_ALLOC_POOL; + + if (impl->toplevel && ![impl->toplevel isZoomed]) + [impl->toplevel zoom:nil]; + + GDK_QUARTZ_RELEASE_POOL; + } + else + { + gdk_synthesize_window_state (window, + 0, + GDK_WINDOW_STATE_MAXIMIZED); + } } void @@ -1810,8 +1829,21 @@ gdk_window_unmaximize (GdkWindow *window) impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl); - if (impl->toplevel && [impl->toplevel isZoomed]) - [impl->toplevel zoom:nil]; + if (GDK_WINDOW_IS_MAPPED (window)) + { + GDK_QUARTZ_ALLOC_POOL; + + if (impl->toplevel && [impl->toplevel isZoomed]) + [impl->toplevel zoom:nil]; + + GDK_QUARTZ_RELEASE_POOL; + } + else + { + gdk_synthesize_window_state (window, + GDK_WINDOW_STATE_MAXIMIZED, + 0); + } } void @@ -1826,8 +1858,21 @@ gdk_window_iconify (GdkWindow *window) impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl); - if (impl->toplevel) - [impl->toplevel miniaturize:nil]; + if (GDK_WINDOW_IS_MAPPED (window)) + { + GDK_QUARTZ_ALLOC_POOL; + + if (impl->toplevel) + [impl->toplevel miniaturize:nil]; + + GDK_QUARTZ_RELEASE_POOL; + } + else + { + gdk_synthesize_window_state (window, + 0, + GDK_WINDOW_STATE_ICONIFIED); + } } void @@ -1842,8 +1887,21 @@ gdk_window_deiconify (GdkWindow *window) impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl); - if (impl->toplevel) - [impl->toplevel deminiaturize:nil]; + if (GDK_WINDOW_IS_MAPPED (window)) + { + GDK_QUARTZ_ALLOC_POOL; + + if (impl->toplevel) + [impl->toplevel deminiaturize:nil]; + + GDK_QUARTZ_RELEASE_POOL; + } + else + { + gdk_synthesize_window_state (window, + GDK_WINDOW_STATE_ICONIFIED, + 0); + } } void