From 6d009268ebb7e6d855a516c60a0e2bbedd537153 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Sat, 9 Feb 2002 08:58:37 +0000 Subject: [PATCH] Patch to check style mask when miniaturising git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12462 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/NSWindow.m | 22 +++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a572efdf3..2acd764b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-02-09 Richard Frith-Macdonald + + * Source/NSWindow.m: ([performMiniaturize:]) patch to check style + mask by Jeff Teunissen added. + Method documented. + Fri Feb 8 02:46:15 2002 Nicola Pero * Source/NSTextView.m ([-moveWordBackward:]): Simplified. diff --git a/Source/NSWindow.m b/Source/NSWindow.m index f1c2ffffb..b0aed3204 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2095,7 +2095,7 @@ resetCursorRectsForView(NSView *theView) _f.is_miniaturized = YES; /* Make sure we're not defered */ - if(_windowNum == 0) + if (_windowNum == 0) { [self _initBackendWindow: _frame]; } @@ -2187,17 +2187,25 @@ resetCursorRectsForView(NSView *theView) return NO; } +/** + * Miniaturize the receiver ... as long as its style mask includes + * NSMiniaturizableWindowMask (and as long as the receiver is not an + * icon or mini window itsself). Calls -miniaturize to do this.
+ * Beeps if the window can't be miniaturised.
+ * Should ideally provide visual feedback (highlighting the miniaturize + * button as if it had been clicked) first ... but that's not yet implemented. + */ - (void) performMiniaturize: (id)sender { - if (!(_styleMask & (NSIconWindowMask | NSMiniWindowMask))) - { - // FIXME: The button should be highlighted - [self miniaturize: sender]; - } - else + if ((!(_styleMask & NSMiniaturizableWindowMask)) + || (_styleMask & (NSIconWindowMask | NSMiniWindowMask))) { NSBeep(); + return; } + + // FIXME: The button should be highlighted + [self miniaturize: sender]; } - (int) resizeFlags