diff options
author | Kevin Walzer <kw@codebykevin.com> | 2014-08-14 02:39:53 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2014-08-14 02:39:53 (GMT) |
commit | a5927e8d5f0b12747732ed2d4a6c58ac801314b9 (patch) | |
tree | 65a73b098ee88349df2dbcf8ba2f4b2ccb68a39c | |
parent | acb6f7b259137644e34ba799e20432a0ced9be0a (diff) | |
download | tk-a5927e8d5f0b12747732ed2d4a6c58ac801314b9.zip tk-a5927e8d5f0b12747732ed2d4a6c58ac801314b9.tar.gz tk-a5927e8d5f0b12747732ed2d4a6c58ac801314b9.tar.bz2 |
Allow Tk to post popup menus when Tk app is not frontmost
-rw-r--r-- | macosx/tkMacOSXMenu.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 380d3a7..e1cdc76 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -757,11 +757,19 @@ 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; int oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE); |