summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Harrison <colin.harrison@virgin.net>2012-09-02 22:39:32 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-27 16:26:37 +0000
commit87b60efb859d86fd9e96306112bc5453a549fa69 (patch)
tree03a40f7eb94dde6e226ca49f7ab379840d1f7354
parent886f4c389266bf759414f15a5e25e50b5935dc9d (diff)
hw/xwin: Don't spam MotionNotify events when the mouse hasn't moved
Don't spam MotionNotify events when the mouse hasn't moved, when polling the mouse position outside any X window (Test with 'xev -root' after mouse polling has started.) Signed-off-by: Colin Harrison <colin.harrison@virgin.net> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-rw-r--r--hw/xwin/winwndproc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index fe662b9ba..7ba028042 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -930,6 +930,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WIN_POLLING_MOUSE_TIMER_ID:
{
+ static POINT last_point;
POINT point;
WPARAM wL, wM, wR, wShift, wCtrl;
LPARAM lPos;
@@ -941,8 +942,12 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
point.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
point.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
- /* Deliver absolute cursor position to X Server */
- winEnqueueMotion(point.x, point.y);
+ /* If the mouse pointer has moved, deliver absolute cursor position to X Server */
+ if (last_point.x != point.x || last_point.y != point.y) {
+ winEnqueueMotion(point.x, point.y);
+ last_point.x = point.x;
+ last_point.y = point.y;
+ }
/* Check if a button was released but we didn't see it */
GetCursorPos(&point);