summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2019-09-02 01:58:35 (GMT)
committerKevin Walzer <kw@codebykevin.com>2019-09-02 01:58:35 (GMT)
commit25636c05e1455cf6dbee4c85b090c4e0f50064b4 (patch)
treee89913cda58b2b34d23f6fcbf828335f3011712c
parent395ccd06ea603f8537297ca63699a8610ff58bb1 (diff)
downloadtk-25636c05e1455cf6dbee4c85b090c4e0f50064b4.zip
tk-25636c05e1455cf6dbee4c85b090c4e0f50064b4.tar.gz
tk-25636c05e1455cf6dbee4c85b090c4e0f50064b4.tar.bz2
Fix for menus in Dark Aqua windows, addresses ticket 07cfc9f03e; thanks to Christopher Chavez for the patch
-rw-r--r--macosx/tkMacOSXMenu.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 4c1ad51..3b61c47 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -793,14 +793,29 @@ TkpPostMenu(
int index)
{
int result;
- Tk_Window root = Tk_MainWindow(interp);
+ Tk_Window realWin = menuPtr->tkwin;
+ TkWindow *realWinPtr;
+ NSView *realWinView;
- if (root == NULL) {
- return TCL_ERROR;
+ while (1) {
+ if (realWin == NULL) {
+ return TCL_ERROR;
+ }
+ /*
+ * Fix for bug 07cfc9f03e: use the view for the parent real (non-menu)
+ * toplevel window, rather than always using the root window.
+ * This allows menus to appear on a separate monitor than the root
+ * window, and to use the appearance of their parent real window
+ * rather than the appearance of the root window.
+ */
+ realWinPtr = (TkWindow*) realWin;
+ realWinView = TkMacOSXDrawableView(realWinPtr->privatePtr);
+ if (realWinView != nil) {
+ break;
+ }
+ realWin = Tk_Parent(realWin);
}
- Drawable d = Tk_WindowId(root);
- NSView *rootview = TkMacOSXGetRootControl(d);
- NSWindow *win = [rootview window];
+ NSWindow *win = [realWinView window];
NSView *view = [win contentView];
NSMenu *menu = (NSMenu *) menuPtr->platformData;
NSInteger itemIndex = index;