aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/hw/xwin/win.h9
-rw-r--r--xorg-server/hw/xwin/winmouse.c58
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwndproc.c18
3 files changed, 58 insertions, 27 deletions
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 416bd27d9..36987c095 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -1012,11 +1012,16 @@ void
winMouseButtonsSendEvent (int iEventType, int iButton, int x, int y);
void winGetPtMouse(HWND hwnd, LPARAM lParam, POINT *ptMouse);
+void winGetPtMouseScreen(HWND hwnd, LPARAM lParam, POINT *ptMouse);
int
winMouseButtonsHandle (ScreenPtr pScreen,
- int iEventType, int iButton,
- WPARAM wParam, HWND hwnd, LPARAM lParam);
+ int iEventType, int iButton,
+ WPARAM wParam, HWND hwnd, LPARAM lParam);
+int
+winMouseButtonsHandleScreen (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam, HWND hwnd, LPARAM lParam);
void
winEnqueueMotion(int x, int y);
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
index e06a8ef69..cf52bbaaf 100644
--- a/xorg-server/hw/xwin/winmouse.c
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -258,34 +258,39 @@ void winGetPtMouse(HWND hwnd, LPARAM lParam, POINT *ptMouse)
/* Unpack the client area mouse coordinates */
ptMouse->x = GET_X_LPARAM(lParam);
ptMouse->y = GET_Y_LPARAM(lParam);
+}
+
+void winGetPtMouseScreen(HWND hwnd, LPARAM lParam, POINT *ptMouse)
+{
+ /* Unpack the client area mouse coordinates */
+ ptMouse->x = GET_X_LPARAM(lParam);
+ ptMouse->y = GET_Y_LPARAM(lParam);
-// /* Translate the client area mouse coordinates to screen coordinates */
-// ClientToScreen (hwnd, ptMouse);
+ /* Translate the client area mouse coordinates to screen coordinates */
+ ClientToScreen (hwnd, ptMouse);
/* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
-// ptMouse->x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
-// ptMouse->y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
+ ptMouse->x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
+ ptMouse->y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
}
/*
* Decide what to do with a Windows mouse message
*/
-int
-winMouseButtonsHandle (ScreenPtr pScreen,
- int iEventType, int iButton,
- WPARAM wParam, HWND hwnd, LPARAM lParam)
+static int
+_winMouseButtonsHandle (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam, POINT *ptMouse)
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- POINT ptMouse;
- winGetPtMouse(hwnd,lParam,&ptMouse);
/* Send button events right away if emulate 3 buttons is off */
if (pScreenInfo->iE3BTimeout == WIN_E3B_OFF)
{
/* Emulate 3 buttons is off, send the button event */
- winMouseButtonsSendEvent (iEventType, iButton, ptMouse.x, ptMouse.y);
+ winMouseButtonsSendEvent (iEventType, iButton, ptMouse->x, ptMouse->y);
return 0;
}
@@ -326,7 +331,7 @@ winMouseButtonsHandle (ScreenPtr pScreen,
pScreenPriv->iE3BCachedPress = 0;
/* Send fake middle button */
- winMouseButtonsSendEvent (DeviceButtonPress, Button2, ptMouse.x, ptMouse.y);
+ winMouseButtonsSendEvent (DeviceButtonPress, Button2, ptMouse->x, ptMouse->y);
/* Indicate that a fake middle button event was sent */
pScreenPriv->fE3BFakeButton2Sent = TRUE;
@@ -342,8 +347,8 @@ winMouseButtonsHandle (ScreenPtr pScreen,
pScreenPriv->iE3BCachedPress = 0;
/* Send cached press, then send release */
- winMouseButtonsSendEvent (DeviceButtonPress, iButton, ptMouse.x, ptMouse.y);
- winMouseButtonsSendEvent (DeviceButtonRelease, iButton, ptMouse.x, ptMouse.y);
+ winMouseButtonsSendEvent (DeviceButtonPress, iButton, ptMouse->x, ptMouse->y);
+ winMouseButtonsSendEvent (DeviceButtonRelease, iButton, ptMouse->x, ptMouse->y);
}
else if (iEventType == DeviceButtonRelease
&& pScreenPriv->fE3BFakeButton2Sent
@@ -356,7 +361,7 @@ winMouseButtonsHandle (ScreenPtr pScreen,
pScreenPriv->fE3BFakeButton2Sent = FALSE;
/* Send middle mouse button release */
- winMouseButtonsSendEvent (DeviceButtonRelease, Button2, ptMouse.x, ptMouse.y);
+ winMouseButtonsSendEvent (DeviceButtonRelease, Button2, ptMouse->x, ptMouse->y);
}
else if (iEventType == DeviceButtonRelease
&& pScreenPriv->iE3BCachedPress == 0
@@ -366,12 +371,33 @@ winMouseButtonsHandle (ScreenPtr pScreen,
* Button was release, no button is cached,
* and there is no fake button 2 release is pending.
*/
- winMouseButtonsSendEvent (DeviceButtonRelease, iButton, ptMouse.x, ptMouse.y);
+ winMouseButtonsSendEvent (DeviceButtonRelease, iButton, ptMouse->x, ptMouse->y);
}
return 0;
}
+int
+winMouseButtonsHandle (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam, HWND hwnd, LPARAM lParam)
+{
+ POINT ptMouse;
+ winGetPtMouse(hwnd,lParam,&ptMouse);
+ return _winMouseButtonsHandle(pScreen, iEventType, iButton, wParam ,&ptMouse);
+}
+
+int
+winMouseButtonsHandleScreen (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam, HWND hwnd, LPARAM lParam)
+{
+ POINT ptMouse;
+ winGetPtMouseScreen(hwnd,lParam,&ptMouse);
+ return _winMouseButtonsHandle(pScreen, iEventType, iButton, wParam ,&ptMouse);
+}
+
+
/**
* Enqueue a motion event.
*/
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
index 436930c6e..d6182976e 100644
--- a/xorg-server/hw/xwin/winmultiwindowwndproc.c
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -518,7 +518,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
return 0;
case WM_MOUSEMOVE:
- winGetPtMouse(hwnd, lParam, &ptMouse);
+ winGetPtMouseScreen(hwnd, lParam, &ptMouse);
/* We can't do anything without privates */
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -618,7 +618,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
g_fButton[0] = TRUE;
SetCapture(hwnd);
- return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, Button1, wParam, hwnd, lParam);
+ return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonPress, Button1, wParam, hwnd, lParam);
case WM_LBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -626,7 +626,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
g_fButton[0] = FALSE;
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button1, wParam, hwnd, lParam);
+ return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonRelease, Button1, wParam, hwnd, lParam);
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
@@ -634,7 +634,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
g_fButton[1] = TRUE;
SetCapture(hwnd);
- return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, Button2, wParam, hwnd, lParam);
+ return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonPress, Button2, wParam, hwnd, lParam);
case WM_MBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -642,7 +642,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
g_fButton[1] = FALSE;
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button2, wParam, hwnd, lParam);
+ return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonRelease, Button2, wParam, hwnd, lParam);
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
@@ -650,7 +650,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
g_fButton[2] = TRUE;
SetCapture(hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam, hwnd, lParam);
+ return winMouseButtonsHandleScreen (s_pScreen, ButtonPress, Button3, wParam, hwnd, lParam);
case WM_RBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -658,21 +658,21 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
g_fButton[2] = FALSE;
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button3, wParam, hwnd, lParam);
+ return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonRelease, Button3, wParam, hwnd, lParam);
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
SetCapture(hwnd);
- return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, HIWORD(wParam) + 5, wParam, hwnd, lParam);
+ return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonPress, HIWORD(wParam) + 5, wParam, hwnd, lParam);
case WM_XBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, HIWORD(wParam) + 5, wParam, hwnd, lParam);
+ return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonRelease, HIWORD(wParam) + 5, wParam, hwnd, lParam);
case WM_MOUSEWHEEL:
if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT)