Xi: make ProcessOtherEvents more InternalEvent aware.

Get rid of the deviceValuator processing and a few other things, but still
drop back into XI before checking device grabs or doing anything else.

NoticeEventTime now needs to take InternalEvents, and while we're at it,
change NoticeTime from a macro to a function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-01-30 15:14:46 +10:00
commit 75595ba4aa
3 changed files with 70 additions and 62 deletions

View file

@ -974,29 +974,32 @@ XineramaGetCursorScreen(DeviceIntPtr pDev)
#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
static void
MonthChangedOrBadTime(xEvent *xE)
MonthChangedOrBadTime(InternalEvent *ev)
{
/* If the ddx/OS is careless about not processing timestamped events from
* different sources in sorted order, then it's possible for time to go
* backwards when it should not. Here we ensure a decent time.
*/
if ((currentTime.milliseconds - XE_KBPTR.time) > TIMESLOP)
if ((currentTime.milliseconds - ev->u.any.time) > TIMESLOP)
currentTime.months++;
else
XE_KBPTR.time = currentTime.milliseconds;
ev->u.any.time = currentTime.milliseconds;
}
#define NoticeTime(xE) { \
if ((xE)->u.keyButtonPointer.time < currentTime.milliseconds) \
MonthChangedOrBadTime(xE); \
currentTime.milliseconds = (xE)->u.keyButtonPointer.time; \
lastDeviceEventTime = currentTime; }
static void
NoticeTime(InternalEvent *ev)
{
if (ev->u.any.time < currentTime.milliseconds)
MonthChangedOrBadTime(ev);
currentTime.milliseconds = ev->u.any.time;
lastDeviceEventTime = currentTime;
}
void
NoticeEventTime(xEvent *xE)
NoticeEventTime(InternalEvent *ev)
{
if (!syncEvents.playingEvents)
NoticeTime(xE);
NoticeTime(ev);
}
/**************************************************************************
@ -1022,11 +1025,11 @@ EnqueueEvent(xEvent *ev, DeviceIntPtr device, int count)
static xEvent xi[1000]; /* enough bytes for the events we have atm */
xEvent *xE = xi;
NoticeTime((InternalEvent*)event);
nevents = ConvertBackToXI((InternalEvent*)ev, xE);
NoticeTime(xE);
/* Fix for key repeating bug. */
if (device->key != NULL && device->key->xkbInfo != NULL &&
xE->u.u.type == KeyRelease)