Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Walther for the patch. Fixes Bugzilla #353. --HG-- branch : SDL-1.2 extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402332
This commit is contained in:
parent
88ccf13d13
commit
6b5b916b0d
1 changed files with 11 additions and 22 deletions
|
@ -722,7 +722,6 @@ void QZ_PumpEvents (_THIS)
|
||||||
{
|
{
|
||||||
static Uint32 screensaverTicks = 0;
|
static Uint32 screensaverTicks = 0;
|
||||||
Uint32 nowTicks;
|
Uint32 nowTicks;
|
||||||
int firstMouseEvent;
|
|
||||||
CGMouseDelta dx, dy;
|
CGMouseDelta dx, dy;
|
||||||
|
|
||||||
NSDate *distantPast;
|
NSDate *distantPast;
|
||||||
|
@ -748,10 +747,7 @@ void QZ_PumpEvents (_THIS)
|
||||||
|
|
||||||
winRect = NSMakeRect (0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h);
|
winRect = NSMakeRect (0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h);
|
||||||
|
|
||||||
/* send the first mouse event in absolute coordinates */
|
/* while grabbed, accumulate all mouse moved events into one SDL mouse event */
|
||||||
firstMouseEvent = 1;
|
|
||||||
|
|
||||||
/* accumulate any additional mouse moved events into one SDL mouse event */
|
|
||||||
dx = 0;
|
dx = 0;
|
||||||
dy = 0;
|
dy = 0;
|
||||||
|
|
||||||
|
@ -853,29 +849,22 @@ void QZ_PumpEvents (_THIS)
|
||||||
dx += dx1;
|
dx += dx1;
|
||||||
dy += dy1;
|
dy += dy1;
|
||||||
}
|
}
|
||||||
else if (firstMouseEvent) {
|
else {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the first mouse event in a possible
|
Get the absolute mouse location. This is not the
|
||||||
sequence of mouse moved events. Since we
|
mouse location after the currently processed event,
|
||||||
use absolute coordinates, this serves to
|
but the *current* mouse location, i.e. after all
|
||||||
compensate any inaccuracy in deltas, and
|
pending events. This means that if there are
|
||||||
provides the first known mouse position,
|
multiple mouse moved events in the queue, we make
|
||||||
since everything after this uses deltas
|
multiple identical calls to SDL_PrivateMouseMotion(),
|
||||||
|
but that's no problem since the latter only
|
||||||
|
generates SDL events for nonzero movements. In my
|
||||||
|
experience on PBG4/10.4.8, this rarely happens anyway.
|
||||||
*/
|
*/
|
||||||
NSPoint p;
|
NSPoint p;
|
||||||
QZ_GetMouseLocation (this, &p);
|
QZ_GetMouseLocation (this, &p);
|
||||||
SDL_PrivateMouseMotion (0, 0, p.x, p.y);
|
SDL_PrivateMouseMotion (0, 0, p.x, p.y);
|
||||||
firstMouseEvent = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
/*
|
|
||||||
Get the amount moved since the last drag or move event,
|
|
||||||
add it on for one big move event at the end.
|
|
||||||
*/
|
|
||||||
dx += [ event deltaX ];
|
|
||||||
dy += [ event deltaY ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue