From 2765bf24f90de884b41dc136302ddad35ed99c84 Mon Sep 17 00:00:00 2001 Message-Id: <2765bf24f90de884b41dc136302ddad35ed99c84.1226931512.git.jon.turney@dronecode.org.uk> In-Reply-To: References: From: Jon TURNEY Date: Sun, 2 Nov 2008 18:27:13 +0000 Subject: [PATCH 05/32] Cygwin: update to enqueue pointer motion event on mouse movement Signed-off-by: Jon TURNEY --- hw/xwin/win.h | 3 +++ hw/xwin/winmouse.c | 26 ++++++++++++++++++++++++++ hw/xwin/winmultiwindowwndproc.c | 6 +++--- hw/xwin/winwin32rootlesswndproc.c | 6 +++--- hw/xwin/winwndproc.c | 8 +++----- 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/hw/xwin/win.h b/hw/xwin/win.h index c45b4f5..dc13ef9 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -1006,6 +1006,9 @@ winMouseButtonsHandle (ScreenPtr pScreen, int iEventType, int iButton, WPARAM wParam); +void +winEnqueueMotion(int x, int y); + #ifdef XWIN_NATIVEGDI /* * winnativegdi.c diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c index 04a2ae1..188126b 100644 --- a/hw/xwin/winmouse.c +++ b/hw/xwin/winmouse.c @@ -344,3 +344,29 @@ winMouseButtonsHandle (ScreenPtr pScreen, return 0; } + +/** + * Enqueue a motion event. + * + * XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer) + * + */ +void winEnqueueMotion(int x, int y) +{ + miPointerSetPosition(g_pwinPointer, &x, &y); + g_c32LastInputEventTime = GetTickCount(); + + int i, nevents; + int valuators[2]; + + EventListPtr events; + GetEventList(&events); + + valuators[0] = x; + valuators[1] = y; + nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0, + POINTER_ABSOLUTE, 0, 2, valuators); + + for (i = 0; i < nevents; i++) + mieqEnqueue(g_pwinPointer, events[i].event); +} diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index d7fc122..8eadf45 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -535,9 +535,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message, } /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (ptMouse.x - s_pScreenInfo->dwXOffset, - ptMouse.y - s_pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset, + ptMouse.y - s_pScreenInfo->dwYOffset); + return 0; case WM_NCMOUSEMOVE: diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c index 32db662..6518469 100755 --- a/hw/xwin/winwin32rootlesswndproc.c +++ b/hw/xwin/winwin32rootlesswndproc.c @@ -571,9 +571,9 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, } /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (ptMouse.x - pScreenInfo->dwXOffset, - ptMouse.y - pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(ptMouse.x - pScreenInfo->dwXOffset, + ptMouse.y - pScreenInfo->dwYOffset); + return 0; case WM_NCMOUSEMOVE: diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index 66f439f..460efe6 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -764,9 +764,8 @@ winWindowProc (HWND hwnd, UINT message, } /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, - GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset, - g_c32LastInputEventTime = GetTickCount ()); + winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, + GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); return 0; case WM_NCMOUSEMOVE: @@ -929,8 +928,7 @@ winWindowProc (HWND hwnd, UINT message, point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); /* Deliver absolute cursor position to X Server */ - miPointerAbsoluteCursor (point.x, point.y, - g_c32LastInputEventTime = GetTickCount()); + winEnqueueMotion(point.x , point.y); /* Check if a button was released but we didn't see it */ GetCursorPos (&point); -- 1.6.0.2