summaryrefslogtreecommitdiffstats
path: root/generic/tkMenuDraw.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-02 11:22:27 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-05-02 11:22:27 (GMT)
commitf6ce17f323f35d5c06e37723848cbd7fa8f2f6fa (patch)
treeddcb2fa3b4aa7f590b0b475a91d7453e13edba97 /generic/tkMenuDraw.c
parent92dc17bde5685c5249794b0ef519d9597139c5f4 (diff)
parent1ad8b81988aa95d3ae080faa924677e7c9d56c1f (diff)
downloadtk-f6ce17f323f35d5c06e37723848cbd7fa8f2f6fa.zip
tk-f6ce17f323f35d5c06e37723848cbd7fa8f2f6fa.tar.gz
tk-f6ce17f323f35d5c06e37723848cbd7fa8f2f6fa.tar.bz2
[Bug 533519]: Window placement with multiple screens
Diffstat (limited to 'generic/tkMenuDraw.c')
-rw-r--r--generic/tkMenuDraw.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 33dadc1..7c69548 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -857,7 +857,7 @@ TkPostTearoffMenu(interp, menuPtr, x, y)
* are posting */
{
int vRootX, vRootY, vRootWidth, vRootHeight;
- int tmp, result;
+ int result;
TkActivateMenuEntry(menuPtr, -1);
TkRecomputeMenu(menuPtr);
@@ -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)) {