diff --git a/darwin/menu.m b/darwin/menu.m index 4080ad2c..e02f28cc 100644 --- a/darwin/menu.m +++ b/darwin/menu.m @@ -93,20 +93,20 @@ enum { // therefore, we have to handle enabling of the other options ourselves - (BOOL)validateMenuItem:(NSMenuItem *)item { - struct menuItem *item; + struct menuItem *smi; NSValue *v; // disable the special items if they aren't present - if (item == self.quitItem && !self.hasQuit) + if (item == self.quitItem && !self->hasQuit) return NO; - if (item == self.prefsItem && !self.hasPreferences) + if (item == self.preferencesItem && !self->hasPreferences) return NO; - if (item == self.aboutItem && !self.hasAbout) + if (item == self.aboutItem && !self->hasAbout) return NO; // then poll the item's enabled/disabled state - v = (NSValue *) [self->items objectForKey:sender]; - item = (struct menuItem *) [v pointerValue]; - return !item->disabled; + v = (NSValue *) [self->items objectForKey:item]; + smi = (struct menuItem *) [v pointerValue]; + return !smi->disabled; } // Cocoa constructs the default application menu by hand for each program; that's what MainMenu.[nx]ib does diff --git a/darwin/uipriv_darwin.h b/darwin/uipriv_darwin.h index f3ab3814..c948be9f 100644 --- a/darwin/uipriv_darwin.h +++ b/darwin/uipriv_darwin.h @@ -15,7 +15,7 @@ #define macYMargin 20 // menu.m -@interface menuManager : NSObject { +@interface menuManager : NSObject { // unfortunately NSMutableDictionary copies its keys, meaning we can't use it for pointers NSMapTable *items; BOOL hasQuit; @@ -25,6 +25,8 @@ @property (strong) NSMenuItem *quitItem; @property (strong) NSMenuItem *preferencesItem; @property (strong) NSMenuItem *aboutItem; +// NSMenuValidation is only informal (TODO) +- (BOOL)validateMenuItem:(NSMenuItem *)item; - (NSMenu *)makeMenubar; @end