diff options
author | Kevin Walzer <kw@codebykevin.com> | 2014-08-14 02:41:52 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2014-08-14 02:41:52 (GMT) |
commit | 42e0fd23661e8b7a71e227684895c66440d4a9d4 (patch) | |
tree | 425dc3b379345df948cc759bd20295b8c09e0b23 /macosx | |
parent | f7c4bfbe2ac962bd0164bb194306ff254d1f06b5 (diff) | |
download | tk-42e0fd23661e8b7a71e227684895c66440d4a9d4.zip tk-42e0fd23661e8b7a71e227684895c66440d4a9d4.tar.gz tk-42e0fd23661e8b7a71e227684895c66440d4a9d4.tar.bz2 |
Allow Tk to post popup menus when Tk app is not frontmost
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXMenu.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 313a5cf..a8e9f2f 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -757,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; |