This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
Re: PATCH: XWin multiwindow+multiscreen for negative screen coordinates
Howdy, I'm happy to help out (especially when it helps me too). I got
hooked on
multiple monitors back on a Mac way too many years ago, and today at work I use
a 3-head "cockpit" setup, so I feel sort of constrained even when using my
2-screen home machine now.
Please find below the diff -U3 against the 20030501 dump referenced in your
message:
------------8<--------------------------------
--- winmultiwindowwindow.c 2003-05-11 14:59:52.000000000 -0700
+++ /tmp/winmultiwindowwindow.c 2003-05-01 09:56:46.000000000 -0700
@@ -202,10 +202,6 @@
iX = pWin->drawable.x;
iY = pWin->drawable.y;
- /* Root coord (0,0) is really screen coord (-X, -Y) */
- iX += GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY += GetSystemMetrics(SM_YVIRTUALSCREEN);
-
/* Get the height and width of the X window */
iWidth = pWin->drawable.width;
iHeight = pWin->drawable.height;
@@ -813,10 +809,6 @@
/* Translate the client area mouse coordinates to screen coordinates */
ClientToScreen (hwnd, &ptMouse);
- /* Screen coord (-X,-Y) maps to root window (0,0) */
- ptMouse.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
- ptMouse.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
-
/* We can't do anything without privates */
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
@@ -946,10 +938,6 @@
/* Translate the client area mouse coordinates to screen coordinates */
ClientToScreen (hwnd, &ptMouse);
- /* Screen Coords from (-X,-Y) => Root Window (0,0) */
- ptMouse.left -= GetSystemMetrics(SM_XVIRTUALSCREEN);
- ptMouse.top -= GetSystemMetrics(SM_YVIRTUALSCREEN);
-
/* Pass the message to the root window */
SendMessage (hwndScreen, message, wParam, MAKELONG(ptMouse.x,
ptMouse.y));
return 0;
@@ -1097,10 +1085,9 @@
ErrorF ("\t(%d, %d)\n", pWinPriv->iX, pWinPriv->iY);
#endif
- /* Map from screen (-X,-Y) to (0,0) root coords */
winMoveXWindow (pWin,
- LOWORD(lParam) - wBorderWidth (pWin) -
GetSystemMetrics(SM_XVIRTUALSCREEN),
- HIWORD(lParam) - wBorderWidth (pWin) -
GetSystemMetrics(SM_YVIRTUALSCREEN));
+ LOWORD(lParam) - wBorderWidth (pWin),
+ HIWORD(lParam) - wBorderWidth (pWin));
return 0;
case WM_SHOWWINDOW:
@@ -1259,10 +1246,9 @@
}
- /* Map from screen (-X,-Y) to (0,0) root coords */
(s_pScreen->ResizeWindow) (pWin,
- pWinPriv->iX - wBorderWidth (pWin) -
GetSystemMetrics(SM_XVIRTUALSCREEN),
- pWinPriv->iY - wBorderWidth (pWin) -
GetSystemMetrics(SM_YVIRTUALSCREEN),
+ pWinPriv->iX - wBorderWidth (pWin),
+ pWinPriv->iY - wBorderWidth (pWin),
pWinPriv->iWidth,
pWinPriv->iHeight,
pWin->nextSib);
@@ -1304,10 +1290,6 @@
/* Get the current position of the mouse cursor */
GetCursorPos (&point);
- /* Map from screen (-x,-y) to root (0,0) */
- point.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
- point.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
-
/* Deliver absolute cursor position to X Server */
miPointerAbsoluteCursor (point.x, point.y,
g_c32LastInputEventTime = GetTickCount ());
@@ -1350,10 +1332,6 @@
iX = pWin->drawable.x;
iY = pWin->drawable.y;
- /* Map from root coord (0,0) to screen (-X, -Y) */
- iX += GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY += GetSystemMetrics(SM_YVIRTUALSCREEN);
-
iWidth = pWin->drawable.width;
iHeight = pWin->drawable.height;
------------8<--------------------------------
Thanks,
At 05:08 PM 5/11/2003 -0400, you wrote:
Earle,
I like the patch.
However, I have two problems (easily fixable) with it:
1) It is against an old version of winmultiwindowwindow.c. The newest
version can be downloaded here:
http://www.msu.edu/~huntharo/xwin/shadow/xwin-20030501-1250.tar.bz2
http://xfree86.cygwin.com/devel/shadow/changelog.html
2) Please run ``diff -U3''. I need the extra info that that format
provides so I can figure out what is happening.
Other than that I thank you for stepping up to fix this problem. I don't
have multiple monitors so I can't really fix these sorts of things on my own.
Thanks for contributing,
Harold
Earle F. Philhower III wrote:
There is a bug in the way XWin handles Windows screen coordinates when
it's run on a system with legal negative position values. That is, there
is a monitor to the left of the primary monitor, whose screen coords are
(-xxx,0), and the global screen coords are from (-xxx,0) to (+xxx,0). You
can reproduce this on a 2 head system by setting the rightmost head to be
the Control Panel->Display Settings->Settings->Use this device as my
primary monitor, and then running "XWin.exe -multiwindow -multiplemonitors"
The fix is to offset screen coords by SM_XVIRTUALSCREEN/SM_YVIRTUALSCREEN
whenever you are mapping to/from root window coords (window positioning,
mouse movements).
-Earle F. Philhower, III
earle@ziplabel.com
cdrlabel - ZipLabel - FlpLabel
http://www.cdrlabel.com