diff options
author | culler <culler> | 2020-11-18 14:53:26 (GMT) |
---|---|---|
committer | culler <culler> | 2020-11-18 14:53:26 (GMT) |
commit | 1ba04ba305622a60b6975ce3780696310b158ec5 (patch) | |
tree | 1fb1e4b7d07814ff304922513734133482b3081f /macosx | |
parent | 611b219cbd36c037048c5cce30fd6b32474495cf (diff) | |
download | tk-1ba04ba305622a60b6975ce3780696310b158ec5.zip tk-1ba04ba305622a60b6975ce3780696310b158ec5.tar.gz tk-1ba04ba305622a60b6975ce3780696310b158ec5.tar.bz2 |
Back out accidental commit
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXMenu.c | 75 |
1 files changed, 35 insertions, 40 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index e42ae3e..ee05eb5 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -409,7 +409,7 @@ TKBackgroundLoop *backgroundLoop = nil; (void)menu; if (_tkMenu) { - // RecursivelyClearActiveMenu(_tkMenu); + //RecursivelyClearActiveMenu(_tkMenu); GenerateMenuSelectEvent((TKMenu *)[self supermenu], [self itemInSupermenu]); } @@ -472,8 +472,8 @@ TKBackgroundLoop *backgroundLoop = nil; } backgroundLoop = [[TKBackgroundLoop alloc] init]; [backgroundLoop start]; - // TkMacOSXClearMenubarActive(); - // TkMacOSXPreprocessMenu(); + //TkMacOSXClearMenubarActive(); + //TkMacOSXPreprocessMenu(); } - (void) menuEndTracking: (NSNotification *) notification @@ -725,49 +725,45 @@ TkpConfigureMenuEntry( [title substringToIndex:[title length] - 3], 0x2026]; } } - if ([title length]) { - fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( - mePtr->menuPtr->tkwin, fontPtr)); - attributes = [fontAttributes mutableCopy]; - if (gc->foreground != defaultFg) { + [menuItem setTitle:title]; + fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( + mePtr->menuPtr->tkwin, fontPtr)); + attributes = [fontAttributes mutableCopy]; + if (gc->foreground != defaultFg) { - /* - * Apple's default foreground color changes to white when the menuitem is - * selected. If a custom foreground color is used then the color will be - * the same for selected and unselected menu items. - */ + /* + * Apple's default foreground color changes to white when the menuitem is + * selected. If a custom foreground color is used then the color will be + * the same for selected and unselected menu items. + */ - NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); - [attributes setObject:fgcolor - forKey:NSForegroundColorAttributeName]; - } - if (gc->background != defaultBg) { + NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); + [attributes setObject:fgcolor + forKey:NSForegroundColorAttributeName]; + } + if (gc->background != defaultBg) { - /* - * Setting a background color looks awful. But setting the background should - * not be the same as setting the foreground. As a compromise, if the background - * color is set we draw an underline in that color. - */ - NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); - [attributes setObject:bgcolor - forKey:NSUnderlineColorAttributeName]; - [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble] - forKey:NSUnderlineStyleAttributeName]; - } - attributedTitle = [[NSAttributedString alloc] - initWithString:title - attributes:attributes]; - [menuItem setAttributedTitle:attributedTitle]; + /* + * Setting a background color looks awful. But setting the background should + * not be the same as setting the foreground. As a compromise, if the background + * color is set we draw an underline in that color. + */ + NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); + [attributes setObject:bgcolor + forKey:NSUnderlineColorAttributeName]; + [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble] + forKey:NSUnderlineStyleAttributeName]; } - fprintf(stderr, "Item %s has tk state %x apple enabled %d\n", - title.UTF8String, mePtr->state, [menuItem isEnabled]); - [menuItem setEnabled:(mePtr->state & ENTRY_DISABLED) == 0 || [title length] == 0]; + attributedTitle = [[[NSAttributedString alloc] + initWithString:title attributes:attributes] autorelease]; + [menuItem setAttributedTitle:attributedTitle]; + [menuItem setEnabled:!(mePtr->state == ENTRY_DISABLED)]; [menuItem setState:((mePtr->type == CHECK_BUTTON_ENTRY || - mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && - (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)]; + mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && + (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)]; if (mePtr->type != CASCADE_ENTRY && mePtr->accelPtr && mePtr->accelLength) { keyEquivalent = ParseAccelerator(Tcl_GetString(mePtr->accelPtr), - &modifierMask); + &modifierMask); } [menuItem setKeyEquivalent:keyEquivalent]; [menuItem setKeyEquivalentModifierMask:modifierMask]; @@ -780,7 +776,6 @@ TkpConfigureMenuEntry( CheckForSpecialMenu(menuRefPtr->menuPtr); submenu = (TKMenu *) menuRefPtr->menuPtr->platformData; if ([submenu supermenu] && [menuItem submenu] != submenu) { - /* * This happens during a clone, where the parent menu is * cloned before its children, so just ignore this temprary |