From a4c9f3c4797ef7712e37a6628bb26acd21546743 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 7 Oct 2003 12:34:10 +0000 Subject: [PATCH] (-miniaturize:, -deminiaturize:): Check that the window can be miniaturized/deminiaturized before doing anything. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17788 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Source/NSWindow.m | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d6547581..65f54ea70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-10-07 14:32 Alexander Malmberg + + * Source/NSWindow.m (-miniaturize:): Check that the window is + miniaturizable, visible, and not already miniaturized before + trying to miniaturize it. + (-deminiaturize:): Do nothing if the window isn't miniaturized. + (Based on patch from Matt Rice.) + 2003-10-05 Adam Fedor * Source/DocMakefile: Remove dependencies file when cleaning. diff --git a/Source/NSWindow.m b/Source/NSWindow.m index ac6892888..a737b8ff7 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2218,9 +2218,13 @@ resetCursorRectsForView(NSView *theView) /** Causes the window to deminiaturize. Normally you would not call this method directly. A window is automatically deminiaturized by the - user via a mouse click event. */ + user via a mouse click event. Does nothing it the window isn't + miniaturized. */ - (void) deminiaturize: sender { + if (!_f.is_miniaturized) + return; + if (_counterpart != 0) { NSWindow *mini = GSWindowWithNumber(_counterpart); @@ -2244,10 +2248,19 @@ resetCursorRectsForView(NSView *theView) /** Causes the window to miniaturize, that is the window is removed from - the screen and it's counterpart (mini)window is displayed. */ + the screen and it's counterpart (mini)window is displayed. Does + nothing if the window can't be miniaturized (eg. because it's already + miniaturized). */ - (void) miniaturize: (id)sender { GSDisplayServer *srv = GSServerForWindow(self); + + if (_f.is_miniaturized + || (!(_styleMask & NSMiniaturizableWindowMask)) + || (_styleMask & (NSIconWindowMask | NSMiniWindowMask)) + || (![self isVisible])) + return; + [nc postNotificationName: NSWindowWillMiniaturizeNotification object: self];