(-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
This commit is contained in:
alexm 2003-10-07 12:34:10 +00:00
parent dbf0a9092d
commit a4c9f3c479
2 changed files with 23 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2003-10-07 14:32 Alexander Malmberg <alexander@malmberg.org>
* 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 <fedor@gnu.org> 2003-10-05 Adam Fedor <fedor@gnu.org>
* Source/DocMakefile: Remove dependencies file when cleaning. * Source/DocMakefile: Remove dependencies file when cleaning.

View file

@ -2218,9 +2218,13 @@ resetCursorRectsForView(NSView *theView)
/** /**
Causes the window to deminiaturize. Normally you would not call this Causes the window to deminiaturize. Normally you would not call this
method directly. A window is automatically deminiaturized by the 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 - (void) deminiaturize: sender
{ {
if (!_f.is_miniaturized)
return;
if (_counterpart != 0) if (_counterpart != 0)
{ {
NSWindow *mini = GSWindowWithNumber(_counterpart); NSWindow *mini = GSWindowWithNumber(_counterpart);
@ -2244,10 +2248,19 @@ resetCursorRectsForView(NSView *theView)
/** /**
Causes the window to miniaturize, that is the window is removed from 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 - (void) miniaturize: (id)sender
{ {
GSDisplayServer *srv = GSServerForWindow(self); GSDisplayServer *srv = GSServerForWindow(self);
if (_f.is_miniaturized
|| (!(_styleMask & NSMiniaturizableWindowMask))
|| (_styleMask & (NSIconWindowMask | NSMiniWindowMask))
|| (![self isVisible]))
return;
[nc postNotificationName: NSWindowWillMiniaturizeNotification [nc postNotificationName: NSWindowWillMiniaturizeNotification
object: self]; object: self];