mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Applied changes in menuInWindow.patch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31895 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
74eeac62d6
commit
f999016f34
6 changed files with 50 additions and 32 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2011-01-15 German Arias <german@xelalug.org>
|
||||
|
||||
* Source/NSWindow.m:
|
||||
* Source/NSSavePanel.m: Reverted latest changes.
|
||||
* Source/NSMenuView.m: Added the appropriate code to close
|
||||
the menu after select an option, but before do the
|
||||
instructions of the selected option.
|
||||
* Headers/AppKit/NSApplication.h:
|
||||
* Source/NSApplication.m: Save the main window when the
|
||||
app is hidden or when is deactivated.
|
||||
|
||||
2011-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSColorWell.m (-activate:): Deactivate an activate color
|
||||
|
|
|
@ -145,6 +145,7 @@ APPKIT_EXPORT NSString *NSEventTrackingRunLoopMode;
|
|||
NSMutableArray *_hidden;
|
||||
NSMutableArray *_inactive;
|
||||
NSWindow *_hidden_key;
|
||||
NSWindow *_hidden_main;
|
||||
GSInfoPanel *_infoPanel;
|
||||
|
||||
/* This autorelease pool should only be created and used by -run, with
|
||||
|
|
|
@ -1315,18 +1315,17 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
|||
[_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)
|
||||
{
|
||||
|
@ -1376,10 +1375,13 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
|||
_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];
|
||||
|
@ -2418,6 +2420,14 @@ image.</p><p>See Also: -applicationIconImage</p>
|
|||
[_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];
|
||||
|
||||
|
|
|
@ -1389,14 +1389,21 @@ static NSMapTable *viewInfo = 0;
|
|||
- (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 @@ static NSMapTable *viewInfo = 0;
|
|||
return YES;
|
||||
}
|
||||
|
||||
if (style == NSWindows95InterfaceStyle)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (subMenusNeedRemoving)
|
||||
{
|
||||
[self detachSubmenu];
|
||||
|
|
|
@ -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 @@ setPath(NSBrowser *browser, NSString *path)
|
|||
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 @@ setPath(NSBrowser *browser, NSString *path)
|
|||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||
NSFilenamesPboardType, nil]];
|
||||
|
||||
|
||||
if (style == NSWindows95InterfaceStyle)
|
||||
{
|
||||
[[[[NSApp mainWindow] menu] attachedMenu] close];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -1818,14 +1818,6 @@ many times.
|
|||
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];
|
||||
|
|
Loading…
Reference in a new issue