summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2008-11-02 18:27:13 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2008-12-17 13:37:38 +0000
commit35d76028304f910edeaf642376df71b8134ec02c (patch)
tree565aa1fcf45da8d8f13bd00d0ecce7ce4e10d85f
parent816e0d243df068bc06d328874b5655d4530fe16a (diff)
Cygwin/X: enqueue a pointer motion event on mouse movement
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-rw-r--r--hw/xwin/win.h3
-rw-r--r--hw/xwin/winmouse.c26
-rw-r--r--hw/xwin/winmultiwindowwndproc.c6
-rwxr-xr-xhw/xwin/winwin32rootlesswndproc.c6
-rw-r--r--hw/xwin/winwndproc.c8
5 files changed, 38 insertions, 11 deletions
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 045577e44..5904a65fc 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -1005,6 +1005,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 04a2ae10e..188126b3a 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 d7fc1227b..8eadf45f5 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 32db6621b..651846990 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 66f439fd1..460efe650 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);