Prevent generating mouseMoved events when the mouse hasn't moved

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@29905 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
dpsimons 2010-03-11 22:44:53 +00:00
parent de5ebd2871
commit bb257f25c0
2 changed files with 15 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2010-03-11 Doug Simons <doug.simons@testplant.com>
* Source/win32/WIN32Server.m: Prevent generating spurious
NSMouseMoved events when the mouse hasn't actually moved.
2010-03-08 Doug Simons <doug.simons@testplant.com>
* Source/win32/WIN32Server.m: Oops, I don't know how the

View file

@ -1973,6 +1973,16 @@ process_mouse_event(WIN32Server *svr, HWND hwnd, WPARAM wParam, LPARAM lParam,
if (eventType == NSLeftMouseUp) lDown = NO;
if (eventType == NSRightMouseUp) rDown = NO;
if (eventType == NSOtherMouseUp) oDown = NO;
if (eventType == NSMouseMoved) {
static HWND lastHwnd = 0;
static NSPoint lastLocation = {0.0, 0.0};
if (hwnd == lastHwnd && NSEqualPoints(eventLocation, lastLocation))
return nil; // mouse hasn't actually moved -- don't generate another event
// record window and location of this event, to check next mouseMoved event against
lastHwnd = hwnd;
lastLocation = eventLocation;
}
event = [NSEvent mouseEventWithType: eventType
location: eventLocation