diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-20 12:50:11 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-20 12:50:11 (GMT) |
commit | 6d34b08d2f5eafd2926129b4926accad90d165dc (patch) | |
tree | ac02899a473761587e13b2906482b07f4bb0bb66 /generic/tkMenuDraw.c | |
parent | 6e1afb77037d1d3bdec6bab7e516fc50516559d6 (diff) | |
parent | b4f7a9e2ccc9aecfbac6785e383753ec769e8745 (diff) | |
download | tk-6d34b08d2f5eafd2926129b4926accad90d165dc.zip tk-6d34b08d2f5eafd2926129b4926accad90d165dc.tar.gz tk-6d34b08d2f5eafd2926129b4926accad90d165dc.tar.bz2 |
fix (hopefully) menu posting in the same way as window placement
Diffstat (limited to 'generic/tkMenuDraw.c')
-rw-r--r-- | generic/tkMenuDraw.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index 33dadc1..6f0499a 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -892,32 +892,21 @@ TkPostTearoffMenu(interp, menuPtr, x, y) * 2. The menu may not have been mapped yet, so its current size * might be the default 1x1. To compute how much space it * needs, use its requested size, not its actual size. - * - * Note that this code assumes square screen regions and all - * positive coordinates. This does not work on a Mac with - * multiple monitors. But then again, Tk has other problems - * with this. */ Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY, &vRootWidth, &vRootHeight); - x += vRootX; - y += vRootY; - tmp = WidthOfScreen(Tk_Screen(menuPtr->tkwin)) - - Tk_ReqWidth(menuPtr->tkwin); - if (x > tmp) { - x = tmp; + if (x > vRootX + vRootWidth) { + x = vRootX + vRootWidth; } - if (x < 0) { - x = 0; + if (x < vRootX) { + x = vRootX; } - tmp = HeightOfScreen(Tk_Screen(menuPtr->tkwin)) - - Tk_ReqHeight(menuPtr->tkwin); - if (y > tmp) { - y = tmp; + if (y > vRootY + vRootHeight) { + y = vRootY + vRootHeight; } - if (y < 0) { - y = 0; + if (y < vRootY) { + y = vRootY; } Tk_MoveToplevelWindow(menuPtr->tkwin, x, y); if (!Tk_IsMapped(menuPtr->tkwin)) { |