mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 13:30:37 +00:00
Menu location save/restore fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5685 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
16976fdfb4
commit
662ef633d3
4 changed files with 176 additions and 219 deletions
|
@ -1,3 +1,10 @@
|
|||
Fri Jan 7 16:40:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSWindow.m: Removed spurious code for setting menu window
|
||||
locations.
|
||||
* Source/NSMenu.m: Implemented 'correct' save/restore of menu locations
|
||||
conforming to MacOS-X implementation details.
|
||||
|
||||
Fri Jan 7 10:32:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/Functions.m: NSApplicationMain() added suggestions from
|
||||
|
|
217
Source/NSMenu.m
217
Source/NSMenu.m
|
@ -55,6 +55,42 @@ static NSZone *menuZone = NULL;
|
|||
|
||||
static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
||||
|
||||
@interface NSMenu (GNUstepPrivate)
|
||||
- (NSString*) _locationKey;
|
||||
@end
|
||||
|
||||
@implementation NSMenu (GNUstepPrivate)
|
||||
- (NSString*) _locationKey
|
||||
{
|
||||
if (menu_is_beholdenToPopUpButton == YES)
|
||||
{
|
||||
return nil; /* Can't save */
|
||||
}
|
||||
if (menu_supermenu == nil)
|
||||
{
|
||||
if ([NSApp mainMenu] == self)
|
||||
{
|
||||
return @"\033"; /* Root menu. */
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil; /* Unused menu. */
|
||||
}
|
||||
}
|
||||
else if (menu_supermenu->menu_supermenu == nil)
|
||||
{
|
||||
return [NSString stringWithFormat: @"\033%@", [self title]];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [[menu_supermenu _locationKey] stringByAppendingFormat: @"\033%@",
|
||||
[self title]];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSMenu
|
||||
|
||||
/*
|
||||
|
@ -119,7 +155,6 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
- (id) initWithTitle: (NSString*)aTitle
|
||||
{
|
||||
NSNotificationCenter *theCenter = [NSNotificationCenter defaultCenter];
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
NSRect winRect = {{0,0},{20,23}};
|
||||
|
||||
[super init];
|
||||
|
@ -167,7 +202,7 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
[theCenter addObserver: self
|
||||
selector: @selector(_showTornOffMenuIfAny:)
|
||||
name: NSApplicationWillFinishLaunchingNotification
|
||||
object: theApp];
|
||||
object: NSApp];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -571,7 +606,6 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
if ([self autoenablesItems])
|
||||
{
|
||||
unsigned i, count;
|
||||
id theApp = [NSApplication sharedApplication];
|
||||
|
||||
count = [menu_items count];
|
||||
|
||||
|
@ -604,7 +638,7 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
}
|
||||
else
|
||||
{
|
||||
validator = [theApp targetForAction: action];
|
||||
validator = [NSApp targetForAction: action];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -807,17 +841,17 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
menu_changed = NO;
|
||||
}
|
||||
|
||||
//
|
||||
// Displaying Context Sensitive Help
|
||||
//
|
||||
/*
|
||||
* Displaying Context Sensitive Help
|
||||
*/
|
||||
- (void) helpRequested: (NSEvent *)event
|
||||
{
|
||||
// TODO: Won't be implemented until we have NSHelp*
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding Protocol
|
||||
//
|
||||
/*
|
||||
* NSCoding Protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)encoder
|
||||
{
|
||||
[encoder encodeObject: menu_title];
|
||||
|
@ -834,7 +868,6 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
- (id) initWithCoder: (NSCoder*)decoder
|
||||
{
|
||||
NSNotificationCenter *theCenter = [NSNotificationCenter defaultCenter];
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
NSRect winRect = {{0,0},{20,23}};
|
||||
|
||||
menu_title = [[decoder decodeObject] retain];
|
||||
|
@ -881,14 +914,14 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
[theCenter addObserver: self
|
||||
selector: @selector(_showTornOffMenuIfAny:)
|
||||
name: NSApplicationWillFinishLaunchingNotification
|
||||
object: theApp];
|
||||
object: NSApp];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCopying Protocol
|
||||
//
|
||||
/*
|
||||
* NSCopying Protocol
|
||||
*/
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
return self;
|
||||
|
@ -902,30 +935,33 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
- (void) _setTornOff: (BOOL)flag
|
||||
{
|
||||
NSMenu *supermenu = [self supermenu];
|
||||
NSMenu *supermenu;
|
||||
|
||||
menu_is_tornoff = flag;
|
||||
|
||||
[[supermenu menuRepresentation] setHighlightedItemIndex: -1];
|
||||
supermenu->menu_attachedMenu = nil;
|
||||
supermenu = [self supermenu];
|
||||
if (supermenu != nil)
|
||||
{
|
||||
[[supermenu menuRepresentation] setHighlightedItemIndex: -1];
|
||||
supermenu->menu_attachedMenu = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_showTornOffMenuIfAny: (NSNotification*)notification
|
||||
- (void) _showTornOffMenuIfAny: (NSNotification*)notification
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary *menuLocations = [defaults objectForKey: NSMenuLocationsKey];
|
||||
NSString *key;
|
||||
NSArray *array;
|
||||
|
||||
if ([[NSApplication sharedApplication] mainMenu] == self)
|
||||
key = nil; // Ignore the main menu.
|
||||
else
|
||||
key = [self title];
|
||||
|
||||
if (key)
|
||||
if ([NSApp mainMenu] != self)
|
||||
{
|
||||
array = [menuLocations objectForKey: key];
|
||||
if (array && [array isKindOfClass: [NSArray class]])
|
||||
NSString *key;
|
||||
NSString *location;
|
||||
NSUserDefaults *defaults;
|
||||
NSDictionary *menuLocations;
|
||||
|
||||
key = [self _locationKey];
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
menuLocations = [defaults objectForKey: NSMenuLocationsKey];
|
||||
|
||||
location = [menuLocations objectForKey: key];
|
||||
if (location && [location isKindOfClass: [NSString class]])
|
||||
{
|
||||
[titleView windowBecomeTornOff];
|
||||
[self _setTornOff: YES];
|
||||
|
@ -955,30 +991,29 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
- (void) _performMenuClose: (id)sender
|
||||
{
|
||||
NSUserDefaults* defaults;
|
||||
NSMutableDictionary* menuLocations;
|
||||
NSString* key;
|
||||
NSString *key;
|
||||
|
||||
if (menu_attachedMenu)
|
||||
[menu_view detachSubmenu];
|
||||
|
||||
[menu_view setHighlightedItemIndex: -1];
|
||||
key = [self _locationKey];
|
||||
if (key != nil)
|
||||
{
|
||||
NSUserDefaults *defaults;
|
||||
NSMutableDictionary *menuLocations;
|
||||
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
menuLocations = [[defaults objectForKey: NSMenuLocationsKey] mutableCopy];
|
||||
[menuLocations removeObjectForKey: key];
|
||||
[defaults setObject: menuLocations forKey: NSMenuLocationsKey];
|
||||
RELEASE(menuLocations);
|
||||
[defaults synchronize];
|
||||
}
|
||||
|
||||
[menu_view setHighlightedItemIndex: -1];
|
||||
[self _setTornOff: NO];
|
||||
[self close];
|
||||
[titleView _releaseCloseButton];
|
||||
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
menuLocations = [[[defaults objectForKey: NSMenuLocationsKey]
|
||||
mutableCopy] autorelease];
|
||||
|
||||
key = [self title]; // Remove window's position$
|
||||
if (key) // info from defaults db
|
||||
{
|
||||
[menuLocations removeObjectForKey: key];
|
||||
[defaults setObject: menuLocations forKey: NSMenuLocationsKey];
|
||||
[defaults synchronize];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _rightMouseDisplay
|
||||
|
@ -1005,30 +1040,24 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
}
|
||||
else
|
||||
{
|
||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary* menuLocations = [defaults
|
||||
objectForKey: NSMenuLocationsKey];
|
||||
NSString* key;
|
||||
NSArray* array;
|
||||
NSPoint origin;
|
||||
NSString *key = [self _locationKey];
|
||||
|
||||
if ([[NSApplication sharedApplication] mainMenu] == self)
|
||||
key = @"Main menu";
|
||||
else
|
||||
key = [self title];
|
||||
|
||||
if (key)
|
||||
if (key != nil)
|
||||
{
|
||||
array = [menuLocations objectForKey: key];
|
||||
if (array && [array isKindOfClass: [NSArray class]])
|
||||
NSUserDefaults *defaults;
|
||||
NSDictionary *menuLocations;
|
||||
NSString *location;
|
||||
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
menuLocations = [defaults objectForKey: NSMenuLocationsKey];
|
||||
location = [menuLocations objectForKey: key];
|
||||
if (location && [location isKindOfClass: [NSString class]])
|
||||
{
|
||||
origin.x = [[array objectAtIndex: 0] floatValue];
|
||||
origin.y = [[array objectAtIndex: 1] floatValue];
|
||||
[aWindow setFrameOrigin: origin];
|
||||
[aWindow setFrameFromString: location];
|
||||
}
|
||||
else
|
||||
{
|
||||
float aPoint = [[NSScreen mainScreen] frame].size.height
|
||||
float aPoint = [[NSScreen mainScreen] frame].size.height
|
||||
- [aWindow frame].size.height;
|
||||
|
||||
[aWindow setFrameOrigin: NSMakePoint(0,aPoint)];
|
||||
|
@ -1039,7 +1068,7 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
menu_is_visible = YES;
|
||||
|
||||
[aWindow orderFront: nil];
|
||||
[aWindow orderFrontRegardless];
|
||||
|
||||
menu_isPartlyOffScreen = IS_OFFSCREEN(aWindow);
|
||||
|
||||
|
@ -1277,17 +1306,18 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
@end
|
||||
|
||||
@implementation NSMenuWindowTitleView
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)setMenu: (NSMenu*)aMenu
|
||||
- (void) setMenu: (NSMenu*)aMenu
|
||||
{
|
||||
menu = aMenu;
|
||||
}
|
||||
|
||||
- (NSMenu*)menu
|
||||
- (NSMenu*) menu
|
||||
{
|
||||
return menu;
|
||||
}
|
||||
|
@ -1332,19 +1362,15 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
- (void) mouseDown: (NSEvent*)theEvent
|
||||
{
|
||||
NSUserDefaults *defaults;
|
||||
NSMutableDictionary *menuLocations;
|
||||
NSMenu *appMainMenu;
|
||||
NSPoint origin;
|
||||
NSArray* array;
|
||||
NSString* key;
|
||||
|
||||
NSPoint lastLocation;
|
||||
NSPoint location;
|
||||
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask;
|
||||
BOOL done = NO;
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
NSDate *theDistantFuture = [NSDate distantFuture];
|
||||
NSUserDefaults *defaults;
|
||||
NSMutableDictionary *menuLocations;
|
||||
NSString *key;
|
||||
NSString *locString;
|
||||
NSPoint lastLocation;
|
||||
NSPoint location;
|
||||
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask;
|
||||
BOOL done = NO;
|
||||
NSDate *theDistantFuture = [NSDate distantFuture];
|
||||
|
||||
lastLocation = [theEvent locationInWindow];
|
||||
|
||||
|
@ -1356,7 +1382,7 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
while (!done)
|
||||
{
|
||||
theEvent = [theApp nextEventMatchingMask: eventMask
|
||||
theEvent = [NSApp nextEventMatchingMask: eventMask
|
||||
untilDate: theDistantFuture
|
||||
inMode: NSEventTrackingRunLoopMode
|
||||
dequeue: YES];
|
||||
|
@ -1384,25 +1410,18 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
}
|
||||
}
|
||||
|
||||
// Save position code goes here. FIXME.
|
||||
appMainMenu = [NSApp mainMenu];
|
||||
/*
|
||||
* Same current menu frame in defaults database.
|
||||
*/
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
menuLocations = [[[defaults objectForKey: NSMenuLocationsKey] mutableCopy] autorelease];
|
||||
|
||||
if (!menuLocations)
|
||||
menuLocations = [[defaults objectForKey: NSMenuLocationsKey] mutableCopy];
|
||||
if (menuLocations == nil)
|
||||
menuLocations = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||
origin = [[menu window] frame].origin;
|
||||
array = [NSArray arrayWithObjects:
|
||||
[[NSNumber numberWithInt: origin.x] stringValue],
|
||||
[[NSNumber numberWithInt: origin.y] stringValue], nil];
|
||||
|
||||
if (menu == appMainMenu)
|
||||
key = @"Main menu";
|
||||
else
|
||||
key = [menu title]; // Save menu window pos
|
||||
|
||||
[menuLocations setObject: array forKey: key]; // in defaults databa
|
||||
locString = [[menu window] stringWithSavedFrame];
|
||||
key = [menu _locationKey];
|
||||
[menuLocations setObject: locString forKey: key];
|
||||
[defaults setObject: menuLocations forKey: NSMenuLocationsKey];
|
||||
RELEASE(menuLocations);
|
||||
[defaults synchronize];
|
||||
}
|
||||
|
||||
|
|
|
@ -52,24 +52,26 @@ _screen_numbers(void)
|
|||
|
||||
@implementation NSScreen
|
||||
|
||||
//
|
||||
// Class variables
|
||||
//
|
||||
/*
|
||||
* Class variables
|
||||
*/
|
||||
static NSScreen *mainScreen = nil;
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
+ (void)initialize
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSScreen class])
|
||||
[self setVersion:1];
|
||||
if (self == [NSScreen class])
|
||||
{
|
||||
[self setVersion:1];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Creating NSScreen Instances
|
||||
//
|
||||
+ (NSScreen *)mainScreen
|
||||
/*
|
||||
* Creating NSScreen Instances
|
||||
*/
|
||||
+ (NSScreen*) mainScreen
|
||||
{
|
||||
NSMutableDictionary *dict;
|
||||
|
||||
|
@ -82,20 +84,20 @@ static NSScreen *mainScreen = nil;
|
|||
return mainScreen;
|
||||
}
|
||||
|
||||
+ (NSScreen *)deepestScreen
|
||||
+ (NSScreen*) deepestScreen
|
||||
{
|
||||
return [self mainScreen];
|
||||
}
|
||||
|
||||
+ (NSArray *)screens
|
||||
+ (NSArray*) screens
|
||||
{
|
||||
return [NSArray arrayWithObject: [self mainScreen]];
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
- initWithDeviceDescription: (NSDictionary *)dict
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
- (id) initWithDeviceDescription: (NSDictionary*)dict
|
||||
{
|
||||
int screen;
|
||||
float x, y, w, h;
|
||||
|
@ -145,29 +147,29 @@ static NSScreen *mainScreen = nil;
|
|||
return self;
|
||||
}
|
||||
|
||||
- init
|
||||
- (id) init
|
||||
{
|
||||
return [self initWithDeviceDescription: NULL];
|
||||
}
|
||||
|
||||
//
|
||||
// Reading Screen Information
|
||||
//
|
||||
- (NSWindowDepth)depth
|
||||
/*
|
||||
* Reading Screen Information
|
||||
*/
|
||||
- (NSWindowDepth) depth
|
||||
{
|
||||
return depth;
|
||||
return depth;
|
||||
}
|
||||
|
||||
- (NSRect)frame
|
||||
- (NSRect) frame
|
||||
{
|
||||
return frame;
|
||||
return frame;
|
||||
}
|
||||
|
||||
- (NSDictionary *)deviceDescription // Make a copy of device
|
||||
{ // dictionary and return it
|
||||
NSDictionary *d = [[NSDictionary alloc] initWithDictionary: device_desc];
|
||||
- (NSDictionary*) deviceDescription
|
||||
{
|
||||
NSDictionary *d = [[NSDictionary alloc] initWithDictionary: device_desc];
|
||||
|
||||
return d;
|
||||
return d;
|
||||
}
|
||||
|
||||
// Mac OS X methods
|
||||
|
@ -180,20 +182,21 @@ NSDictionary *d = [[NSDictionary alloc] initWithDictionary: device_desc];
|
|||
return retval;
|
||||
}
|
||||
|
||||
-(NSRect) visibleFrame
|
||||
- (NSRect) visibleFrame
|
||||
{
|
||||
NSRect visFrame = frame;
|
||||
|
||||
switch ([NSApp interfaceStyle])
|
||||
{
|
||||
case NSMacintoshInterfaceStyle:
|
||||
// What is the size of the Mac menubar?
|
||||
visFrame.size.height -= 25;
|
||||
return visFrame;
|
||||
case NSWindows95InterfaceStyle:
|
||||
case NSNextStepInterfaceStyle:
|
||||
case NSNoInterfaceStyle:
|
||||
default:
|
||||
return frame;
|
||||
case NSMacintoshInterfaceStyle:
|
||||
// What is the size of the Mac menubar?
|
||||
visFrame.size.height -= 25;
|
||||
return visFrame;
|
||||
case NSWindows95InterfaceStyle:
|
||||
case NSNextStepInterfaceStyle:
|
||||
case NSNoInterfaceStyle:
|
||||
default:
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,6 @@
|
|||
#include <AppKit/NSGraphicsContext.h>
|
||||
#include <AppKit/GSWraps.h>
|
||||
|
||||
@class NSMenuWindow;
|
||||
|
||||
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
|
||||
|
||||
@interface GSWindowView : NSView
|
||||
|
@ -2311,32 +2309,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
[windowsLock lock];
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
obj = [self stringWithSavedFrame];
|
||||
if ([self isKindOfClass: [NSMenuWindow class]])
|
||||
{
|
||||
id dict;
|
||||
|
||||
key = @"NSMenuLocations";
|
||||
dict = [defs objectForKey: key];
|
||||
if (dict == nil)
|
||||
{
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: 1];
|
||||
}
|
||||
else if ([dict isKindOfClass: [NSDictionary class]] == NO)
|
||||
{
|
||||
NSLog(@"NSMenuLocations default is not a dictionary - overwriting");
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
dict = AUTORELEASE([dict mutableCopy]);
|
||||
}
|
||||
[dict setObject: obj forKey: name];
|
||||
obj = dict;
|
||||
}
|
||||
else
|
||||
{
|
||||
key = [NSString stringWithFormat: @"NSWindow Frame %@", name];
|
||||
}
|
||||
key = [NSString stringWithFormat: @"NSWindow Frame %@", name];
|
||||
[defs setObject: obj forKey: key];
|
||||
[windowsLock unlock];
|
||||
}
|
||||
|
@ -2381,33 +2354,8 @@ resetCursorRectsForView(NSView *theView)
|
|||
* Autosave name cleared - remove from defaults database.
|
||||
*/
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
if ([self isKindOfClass: [NSMenuWindow class]])
|
||||
{
|
||||
id dict;
|
||||
|
||||
key = @"NSMenuLocations";
|
||||
dict = [defs objectForKey: key];
|
||||
if (dict == nil)
|
||||
{
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: 1];
|
||||
}
|
||||
else if ([dict isKindOfClass: [NSDictionary class]] == NO)
|
||||
{
|
||||
NSLog(@"NSMenuLocations is not a dictionary - overwriting");
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
dict = AUTORELEASE([dict mutableCopy]);
|
||||
}
|
||||
[dict removeObjectForKey: nameToRemove];
|
||||
[defs setObject: dict forKey: key];
|
||||
}
|
||||
else
|
||||
{
|
||||
key = [NSString stringWithFormat: @"NSWindow Frame %@", nameToRemove];
|
||||
[defs removeObjectForKey: key];
|
||||
}
|
||||
key = [NSString stringWithFormat: @"NSWindow Frame %@", nameToRemove];
|
||||
[defs removeObjectForKey: key];
|
||||
RELEASE(nameToRemove);
|
||||
}
|
||||
[windowsLock unlock];
|
||||
|
@ -2531,32 +2479,12 @@ resetCursorRectsForView(NSView *theView)
|
|||
{
|
||||
NSUserDefaults *defs;
|
||||
id obj;
|
||||
NSString *key;
|
||||
|
||||
[windowsLock lock];
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
if ([self isKindOfClass: [NSMenuWindow class]] == YES)
|
||||
{
|
||||
obj = [defs objectForKey: @"NSMenuLocations"];
|
||||
if (obj != nil)
|
||||
{
|
||||
if ([obj isKindOfClass: [NSDictionary class]] == YES)
|
||||
{
|
||||
obj = [obj objectForKey: name];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"NSMenuLocations default is not a dictionary");
|
||||
obj = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *key;
|
||||
|
||||
key = [NSString stringWithFormat: @"NSWindow Frame %@", name];
|
||||
obj = [defs objectForKey: key];
|
||||
}
|
||||
key = [NSString stringWithFormat: @"NSWindow Frame %@", name];
|
||||
obj = [defs objectForKey: key];
|
||||
[windowsLock unlock];
|
||||
if (obj == nil)
|
||||
return NO;
|
||||
|
@ -2564,7 +2492,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (NSString *) stringWithSavedFrame
|
||||
- (NSString*) stringWithSavedFrame
|
||||
{
|
||||
NSRect fRect;
|
||||
NSRect sRect;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue