summaryrefslogtreecommitdiffstats
path: root/generic/tkMenuDraw.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-29 08:16:38 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-29 08:16:38 (GMT)
commit2394840bf0a69ff1aa91ecead70e6b2a4d716d1a (patch)
treea071167cb16834595a30cb892fda90b867250e6c /generic/tkMenuDraw.c
parent79ddeebf264139cfbadae729b54646a2cfc8c092 (diff)
parent64ac9dba8558f572db2bd2d6f908134796bf92c3 (diff)
downloadtk-bug_3512824.zip
tk-bug_3512824.tar.gz
tk-bug_3512824.tar.bz2
merge trunkbug_3512824
Diffstat (limited to 'generic/tkMenuDraw.c')
-rw-r--r--generic/tkMenuDraw.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 119b4bf..4cd9b02 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -844,7 +844,7 @@ TkPostTearoffMenu(
* posting */
{
int vRootX, vRootY, vRootWidth, vRootHeight;
- int tmp, result;
+ int result;
TkActivateMenuEntry(menuPtr, -1);
TkRecomputeMenu(menuPtr);
@@ -877,31 +877,21 @@ TkPostTearoffMenu(
* 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)) {