diff options
author | Colin Harrison <colin.harrison@virgin.net> | 2012-09-02 22:39:32 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-09-05 23:49:03 +0100 |
commit | 5078a0649219a370f2c3a6fe7557f525fbc06dec (patch) | |
tree | 1a161c537aef4d375a7e294c91ec5472a840c256 | |
parent | 253f8b08a4f60d28f0697af05011f51ae769f51b (diff) |
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.)
-rw-r--r-- | hw/xwin/winwndproc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index 6f65720d3..9aba46b98 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); |