Index: Source/NSWindow.m =================================================================== --- Source/NSWindow.m (revision 31886) +++ Source/NSWindow.m (working copy) @@ -1818,14 +1818,6 @@ if (_f.is_main == YES) { _f.is_main = NO; - - //We close the menu if the app will be hide - if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self) == - NSWindows95InterfaceStyle) - { - [[[self menu] attachedMenu] close]; - } - if (_f.is_key == YES) { [_wv setInputState: GSTitleBarKey]; Index: Source/NSApplication.m =================================================================== --- Source/NSApplication.m (revision 31886) +++ Source/NSApplication.m (working copy) @@ -1293,18 +1293,17 @@ [_hidden_key makeKeyWindow]; _hidden_key = nil; } + + if ([self mainWindow] == nil && _hidden_main != nil + && [[self windows] indexOfObjectIdenticalTo: _hidden_main] != NSNotFound) + { + [_hidden_main makeMainWindow]; + _hidden_main = nil; + } if ([self keyWindow] != nil) { [[self keyWindow] orderFront: self]; - - /* If menu is in window, we need a main window, in other way - the menu can't respond */ - if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self) == - NSWindows95InterfaceStyle && [[self keyWindow] canBecomeMainWindow]) - { - [[self keyWindow] becomeMainWindow]; - } } else if ([self mainWindow] != nil) { @@ -1354,10 +1353,13 @@ _hidden_key = [self keyWindow]; [_hidden_key resignKeyWindow]; } - // FIXME: main window is not saved for when the app is activated again. - // This is not a problem if it is also key, and I'm not sure if it - // is a problem at all. May be annoying in the case of workspace switch. - [[self mainWindow] resignMainWindow]; + // The main window is saved for when the app is activated again. + // This is necessary for menu in window. + if ([self mainWindow] != nil) + { + _hidden_main = [self mainWindow]; + [_hidden_main resignMainWindow]; + } windows_list = GSOrderedWindows(); iter = [windows_list reverseObjectEnumerator]; @@ -2395,6 +2397,14 @@ _hidden_key = [self keyWindow]; [_hidden_key resignKeyWindow]; } + + // The main window is saved for when the app is activated again. + // This is necessary for menu in window. + if ([self mainWindow] != nil) + { + _hidden_main = [self mainWindow]; + [_hidden_main resignMainWindow]; + } windows_list = GSOrderedWindows(); iter = [windows_list reverseObjectEnumerator]; Index: Source/NSSavePanel.m =================================================================== --- Source/NSSavePanel.m (revision 31886) +++ Source/NSSavePanel.m (working copy) @@ -50,7 +50,6 @@ #import "AppKit/NSImage.h" #import "AppKit/NSImageView.h" #import "AppKit/NSMatrix.h" -#import "AppKit/NSMenu.h" #import "AppKit/NSPasteboard.h" #import "AppKit/NSDragging.h" #import "AppKit/NSSavePanel.h" @@ -183,7 +182,6 @@ NSImage *image; NSRect r; id lastKeyView; - NSInterfaceStyle style = NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil); // Track window resizing so we can change number of browser columns. [[NSNotificationCenter defaultCenter] addObserver: self @@ -375,12 +373,6 @@ [self registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, nil]]; - - if (style == NSWindows95InterfaceStyle) - { - [[[[NSApp mainWindow] menu] attachedMenu] close]; - } - return self; } Index: Source/NSMenuView.m =================================================================== --- Source/NSMenuView.m (revision 31886) +++ Source/NSMenuView.m (working copy) @@ -1389,14 +1389,21 @@ - (BOOL) _executeItemAtIndex: (int)indexOfActionToExecute removeSubmenu: (BOOL)subMenusNeedRemoving { + NSInterfaceStyle style = + NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self); + + /*If we have menu in window, close the menu after select + an option*/ + if (style == NSWindows95InterfaceStyle) + { + [[[[NSApp mainWindow] menu] attachedMenu] close]; + } + if (indexOfActionToExecute >= 0 && [_attachedMenu attachedMenu] != nil && [_attachedMenu attachedMenu] == [[_items_link objectAtIndex: indexOfActionToExecute] submenu]) { - NSInterfaceStyle style = - NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self); - if (style == NSMacintoshInterfaceStyle || - style == NSWindows95InterfaceStyle) + if (style == NSMacintoshInterfaceStyle) { // On Macintosh, clicking on or releasing the mouse over a // submenu item always closes the menu (if it is open) and @@ -1405,6 +1412,11 @@ return YES; } + if (style == NSWindows95InterfaceStyle) + { + return YES; + } + if (subMenusNeedRemoving) { [self detachSubmenu]; Index: Headers/AppKit/NSApplication.h =================================================================== --- Headers/AppKit/NSApplication.h (revision 31886) +++ Headers/AppKit/NSApplication.h (working copy) @@ -145,6 +145,7 @@ NSMutableArray *_hidden; NSMutableArray *_inactive; NSWindow *_hidden_key; + NSWindow *_hidden_main; GSInfoPanel *_infoPanel; /* This autorelease pool should only be created and used by -run, with