summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXMenu.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-08-19 13:48:39 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-08-19 13:48:39 (GMT)
commitbb85da92c96071f97d0ebdc6f7f029a171b0c682 (patch)
tree41d5454c4a28ff447c81aa025cc8df01156220c0 /macosx/tkMacOSXMenu.c
parentb7987c124821dc0e85b656bc216b70d14a9ba57c (diff)
parent4fea14bc381164ee07c8870a82cdc5a14953b57c (diff)
downloadtk-bb85da92c96071f97d0ebdc6f7f029a171b0c682.zip
tk-bb85da92c96071f97d0ebdc6f7f029a171b0c682.tar.gz
tk-bb85da92c96071f97d0ebdc6f7f029a171b0c682.tar.bz2
merge trunk
Diffstat (limited to 'macosx/tkMacOSXMenu.c')
-rw-r--r--macosx/tkMacOSXMenu.c15
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;