When using MS Windows style menus terminate an application by default

when its last window is closed.
In addition, fix a bug where the application was not terminated when
the last window is closed while the application is in the background.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28834 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2009-10-17 17:09:36 +00:00
parent 65f8f0a588
commit d2f51e9cde
2 changed files with 22 additions and 3 deletions

View file

@ -1,4 +1,13 @@
2009-10-17 Wolfgang Lux <wlux@uni-muenster.de>
2009-10-17 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSApplication.m (-_windowWillClose:): When using MS
Windows style menus terminate an application by default when its
last window is closed.
In addition, fix a bug where the application was not terminated
when the last window is closed while the application is in the
background.
2009-10-17 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSApplication.m (-finishLaunching): Open a new document
by default when a document based application is started and there

View file

@ -3903,7 +3903,6 @@ struct _DelegateWrapper
- (void) _windowWillClose: (NSNotification*) notification
{
NSWindow *win = [notification object];
BOOL wasMain = [win isMainWindow];
if (_app_is_running)
{
@ -3928,7 +3927,7 @@ struct _DelegateWrapper
/* If there's only one window left, and that's the one being closed,
then we ask the delegate if the app is to be terminated. */
if (wasMain && count == 0)
if (count == 0)
{
if ([_delegate respondsToSelector:
@selector(applicationShouldTerminateAfterLastWindowClosed:)])
@ -3939,6 +3938,17 @@ struct _DelegateWrapper
[self terminate: self];
}
}
/*
wlux 2009-10-17: If we use MS Windows style menus, we terminate
the application by default if the last window is closed.
FIXME: I think we should send [self interfaceStyle] here, but
this does not return a meaningful result at present.
*/
else if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil) ==
NSWindows95InterfaceStyle)
{
[self terminate: self];
}
}
}
}