From 9b35ccda6670ca1d9982e7cde1e7c04fe113cb57 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 28 Jul 2009 14:32:59 +0000 Subject: Multiwindow is now also running. --- xorg-server/hw/xwin/winmouse.c | 58 ++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 16 deletions(-) (limited to 'xorg-server/hw/xwin/winmouse.c') 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 @@ -254,38 +254,43 @@ winMouseButtonsSendEvent (int iEventType, int iButton, int x, int y) } 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. */ -- cgit v1.2.3