dix: don't try to access "time" field for GenericEvents in PlayReleasedEvent.

GenericEvents can't be parsed to keyButtonPointer, and there's no guarantee
that it has a time field anyway. PlayReleasedEvent needs to store the millis
when we know it (core events, XI event) and just re-use them for GenericEvents.

Yes, this is a hack. But it looks like the time has zero significance anyway.
This commit is contained in:
Peter Hutterer 2007-09-12 18:34:51 +09:30
parent 1c38eac442
commit b484451eab

View File

@ -1228,6 +1228,7 @@ PlayReleasedEvents(void)
QdEventPtr *prev, qe;
DeviceIntPtr dev;
DeviceIntPtr pDev;
static CARD32 lastKnownMillis = 0; /* Hack, see comment below */
prev = &syncEvents.pending;
while ( (qe = *prev) )
@ -1241,7 +1242,17 @@ PlayReleasedEvents(void)
if (qe->event->u.u.type == MotionNotify)
CheckVirtualMotion(pDev, qe, NullWindow);
syncEvents.time.months = qe->months;
syncEvents.time.milliseconds = qe->event->u.keyButtonPointer.time;
/* XXX: Hack! We can't reliably get the time from GenericEvents,
since we don't know which struct it may be. So we store the time
when we know it, and re-use it when we can't get it. */
if (qe->event->u.u.type == GenericEvent)
{
syncEvents.time.milliseconds = lastKnownMillis;
} else
{
syncEvents.time.milliseconds = qe->event->u.keyButtonPointer.time;
lastKnownMillis = syncEvents.time.milliseconds;
}
#ifdef PANORAMIX
/* Translate back to the sprite screen since processInputProc
will translate from sprite screen to screen 0 upon reentry