summaryrefslogtreecommitdiffstats
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
parent92dc17bde5685c5249794b0ef519d9597139c5f4 (diff)
parent1ad8b81988aa95d3ae080faa924677e7c9d56c1f (diff)
downloadtk-f6ce17f323f35d5c06e37723848cbd7fa8f2f6fa.zip
tk-f6ce17f323f35d5c06e37723848cbd7fa8f2f6fa.tar.gz
tk-f6ce17f323f35d5c06e37723848cbd7fa8f2f6fa.tar.bz2
[Bug 533519]: Window placement with multiple screens
-rw-r--r--ChangeLog8
-rw-r--r--generic/tkBind.c12
-rw-r--r--generic/tkFocus.c8
-rw-r--r--generic/tkMenuDraw.c29
-rw-r--r--generic/tkStubInit.c6
-rw-r--r--library/tk.tcl4
-rw-r--r--win/tkWinWm.c17
7 files changed, 30 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index cdfcd5b..d205485 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-02 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * library/tk.tcl: [Bug 533519]: Window placement with multiple screens
+ * generic/tkBind.c:
+ * generic/tkFocus.c:
+ * generic/tkMenuDraw.c:
+ * generic/tkWinWm.c:
+
2012-04-26 Donal K. Fellows <dkf@users.sf.net>
* generic/tkStubInit.c (Tk_GetHINSTANCE): Ensure that this is defined
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 7e8d823..fc212cb 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -2626,32 +2626,20 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
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,
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,
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 aad1305..93e1617 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -737,7 +737,7 @@ TkFocusKeyEvent(winPtr, eventPtr)
{
DisplayFocusInfo *displayFocusPtr;
TkWindow *focusWinPtr;
- int focusX, focusY, vRootX, vRootY, vRootWidth, vRootHeight;
+ int focusX, focusY;
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
focusWinPtr = displayFocusPtr->focusWinPtr;
@@ -770,11 +770,9 @@ TkFocusKeyEvent(winPtr, eventPtr)
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 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)) {
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 6b36f7b..22334bc 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -96,6 +96,12 @@ static void *Tk_GetHINSTANCE()
(const char *) &tkIntStubs, &hInstance);
return hInstance;
}
+ /* TODO: To be implemented for Cygwin */
+# define Tk_AttachHWND 0
+# define Tk_GetHWND 0
+# define Tk_HWNDToWindow 0
+# define Tk_PointerEvent 0
+# define Tk_TranslateWinEvent 0
# else /* !__CYGWIN__ */
# define TkPutImage 0
diff --git a/library/tk.tcl b/library/tk.tcl
index 90a4d0c..57525f1 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -106,10 +106,6 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
set windowingsystem [tk windowingsystem]
- if {$windowingsystem eq "win32"} {
- # Bug 533519: win32 multiple desktops may produce negative geometry.
- set checkBounds 0
- }
if {$checkBounds} {
if {$x < [winfo vrootx $w]} {
set x [winfo vrootx $w]
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 2097938..59287c8 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -5994,19 +5994,10 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
* here. */
int *widthPtr, *heightPtr; /* Store dimensions of virtual root here. */
{
- TkWindow *winPtr = (TkWindow *) tkwin;
-
- /*
- * XXX: This is not correct for multiple monitors. There may be many
- * changes required to get this right, and it may effect existing
- * applications that don't consider possible <0 vroot. See
- * http://msdn.microsoft.com/library/en-us/gdi/monitor_3lrn.asp
- * for more info.
- */
- *xPtr = 0;
- *yPtr = 0;
- *widthPtr = DisplayWidth(winPtr->display, winPtr->screenNum);
- *heightPtr = DisplayHeight(winPtr->display, winPtr->screenNum);
+ *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN);
+ *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN);
+ *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ *heightPtr = GetSystemMetrics(SM_CYVIRTUALSCREEN);
}
/*