diff options
author | marc_culler <marc.culler@gmail.com> | 2020-11-19 16:41:15 (GMT) |
---|---|---|
committer | marc_culler <marc.culler@gmail.com> | 2020-11-19 16:41:15 (GMT) |
commit | ec57a85265a5f6889b38efff0e37b9611fa7a4f5 (patch) | |
tree | 05664d590b2827876ac316c485539e9f1ca75b7e /macosx | |
parent | 37279b8ec55cb993d441216c9b90e5668146e4c7 (diff) | |
parent | 5734f829eb4afcad446076b6ca2fee779b2ae722 (diff) | |
download | tk-ec57a85265a5f6889b38efff0e37b9611fa7a4f5.zip tk-ec57a85265a5f6889b38efff0e37b9611fa7a4f5.tar.gz tk-ec57a85265a5f6889b38efff0e37b9611fa7a4f5.tar.bz2 |
Merge 8.6
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXMenu.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 8970109..348dd64 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -748,7 +748,7 @@ TkpConfigureMenuEntry( } } [menuItem setAttributedTitle:attributedTitle]; - [menuItem setEnabled:!(mePtr->state == ENTRY_DISABLED)]; + [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)]; @@ -781,27 +781,17 @@ TkpConfigureMenuEntry( if ([menuItem isEnabled]) { /* - * This menuItem might have been previously disabled (XXX: - * track this), which would have disabled entries; we must - * re-enable the entries here. + * This menuItem might have been previously disabled which + * would have disabled all of its entries; we must re-enable the + * entries here. It is important to iterate though the Tk + * entries, not the NSMenuItems, since some NSMenuItems may + * have been added by the system. See [7185d26cf4]. */ - int i = 0; - NSArray *itemArray = [submenu itemArray]; - - for (NSMenuItem *item in itemArray) { + for (int i = 0; i < menuRefPtr->menuPtr->numEntries; i++) { TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; - - /* - * Work around an apparent bug where itemArray can have - * more items than the menu's entries[] array. - */ - - if (i >= (int) menuRefPtr->menuPtr->numEntries) { - break; - } - [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; - i++; + NSMenuItem *item = (NSMenuItem *) mePtr->platformEntryData; + [item setEnabled:(submePtr->state != ENTRY_DISABLED)]; } } } @@ -1815,13 +1805,17 @@ TkpComputeMenubarGeometry( * TkpDrawMenuEntry -- * * Draws the given menu entry at the given coordinates with the given - * attributes. + * attributes. This is a no-op on macOS since the menus are drawn by + * the Apple window manager, which also handles all events related to + * selecting menu items. This function is only called for tearoff + * menus, which are not supported on macOS but do get drawn as nearly + * invisible 1 pixel wide windows on macOS * * Results: * None. * * Side effects: - * X Server commands are executed to display the menu entry. + * None * *---------------------------------------------------------------------- */ |