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>
This commit is contained in:
parent
886f4c3892
commit
87b60efb85
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user