diff options
author | dgp <dgp@users.sourceforge.net> | 2014-08-19 13:48:39 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-08-19 13:48:39 (GMT) |
commit | bb85da92c96071f97d0ebdc6f7f029a171b0c682 (patch) | |
tree | 41d5454c4a28ff447c81aa025cc8df01156220c0 /macosx/tkMacOSXMenu.c | |
parent | b7987c124821dc0e85b656bc216b70d14a9ba57c (diff) | |
parent | 4fea14bc381164ee07c8870a82cdc5a14953b57c (diff) | |
download | tk-bb85da92c96071f97d0ebdc6f7f029a171b0c682.zip tk-bb85da92c96071f97d0ebdc6f7f029a171b0c682.tar.gz tk-bb85da92c96071f97d0ebdc6f7f029a171b0c682.tar.bz2 |
merge trunk
Diffstat (limited to 'macosx/tkMacOSXMenu.c')
-rw-r--r-- | macosx/tkMacOSXMenu.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 83ad47a..a8e9f2f 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -684,6 +684,9 @@ TkpConfigureMenuEntry( NSArray *itemArray = [submenu itemArray]; for (NSMenuItem *item in itemArray) { 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 >= menuRefPtr->menuPtr->numEntries) break; [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; i++; } @@ -754,10 +757,18 @@ TkpPostMenu( * to be posted. */ int y) /* The global y-coordinate */ { - NSWindow *win = [NSApp keyWindow]; - if (!win) { + + + /* Get the object that holds this Tk Window.*/ + Tk_Window root; + root = Tk_MainWindow(interp); + if (root == NULL) { return TCL_ERROR; } + + Drawable d = Tk_WindowId(root); + NSView *rootview = TkMacOSXGetRootControl(d); + NSWindow *win = [rootview window]; inPostMenu = 1; |