summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-29 07:37:15 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-29 07:37:15 (GMT)
commit64ac9dba8558f572db2bd2d6f908134796bf92c3 (patch)
treeb5f5b45caa1a676a06ae07d2d5e61587737c2c85 /generic
parent8dca7f801721aeb881ce80cb84c05269f80a2a1a (diff)
parente579396907adac4e3f88da62abfe0ae184180d98 (diff)
downloadtk-64ac9dba8558f572db2bd2d6f908134796bf92c3.zip
tk-64ac9dba8558f572db2bd2d6f908134796bf92c3.tar.gz
tk-64ac9dba8558f572db2bd2d6f908134796bf92c3.tar.bz2
[Bug 533519]: Window placement with multiple screens
Diffstat (limited to 'generic')
-rw-r--r--generic/tkBind.c18
-rw-r--r--generic/tkFocus.c8
-rw-r--r--generic/tkMenuDraw.c28
3 files changed, 14 insertions, 40 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 10998fe..e58ad4d 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -2226,33 +2226,19 @@ ExpandPercents(
}
case 'X':
if (flags & KEY_BUTTON_MOTION_CROSSING) {
- Tk_Window tkwin;
- int x, y;
- int width, height;
number = eventPtr->xkey.x_root;
- tkwin = Tk_IdToWindow(eventPtr->xany.display,
+ Tk_IdToWindow(eventPtr->xany.display,
eventPtr->xany.window);
- if (tkwin != NULL) {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- number -= x;
- }
goto doNumber;
}
goto doString;
case 'Y':
if (flags & KEY_BUTTON_MOTION_CROSSING) {
- Tk_Window tkwin;
- int x, y;
- int width, height;
number = eventPtr->xkey.y_root;
- tkwin = Tk_IdToWindow(eventPtr->xany.display,
+ Tk_IdToWindow(eventPtr->xany.display,
eventPtr->xany.window);
- if (tkwin != NULL) {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- number -= y;
- }
goto doNumber;
}
goto doString;
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 5f68d8b..2f50009 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -715,7 +715,7 @@ TkFocusKeyEvent(
{
DisplayFocusInfo *displayFocusPtr;
TkWindow *focusWinPtr;
- int focusX, focusY, vRootX, vRootY, vRootWidth, vRootHeight;
+ int focusX, focusY;
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
focusWinPtr = displayFocusPtr->focusWinPtr;
@@ -748,11 +748,9 @@ TkFocusKeyEvent(
eventPtr->xkey.x = -1;
eventPtr->xkey.y = -1;
} else {
- Tk_GetVRootGeometry((Tk_Window) focusWinPtr, &vRootX, &vRootY,
- &vRootWidth, &vRootHeight);
Tk_GetRootCoords((Tk_Window) focusWinPtr, &focusX, &focusY);
- eventPtr->xkey.x = eventPtr->xkey.x_root - vRootX - focusX;
- eventPtr->xkey.y = eventPtr->xkey.y_root - vRootY - focusY;
+ eventPtr->xkey.x = eventPtr->xkey.x_root - focusX;
+ eventPtr->xkey.y = eventPtr->xkey.y_root - focusY;
}
eventPtr->xkey.window = focusWinPtr->window;
return focusWinPtr;
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)) {