mi: Only increment tail (push) when the event data is actually in the queue
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Tiago Vignatti <vignatti@c3sl.ufpr.br> Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
This commit is contained in:
parent
570835b9a8
commit
56d1793c43
|
@ -122,7 +122,7 @@ mieqResizeEvents(int min_size)
|
||||||
void
|
void
|
||||||
mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
|
mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
|
||||||
{
|
{
|
||||||
unsigned int oldtail = miEventQueue.tail, newtail;
|
unsigned int oldtail = miEventQueue.tail;
|
||||||
EventListPtr evt;
|
EventListPtr evt;
|
||||||
int isMotion = 0;
|
int isMotion = 0;
|
||||||
int evlen;
|
int evlen;
|
||||||
|
@ -170,11 +170,10 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
static int stuck = 0;
|
static int stuck = 0;
|
||||||
newtail = (oldtail + 1) % QUEUE_SIZE;
|
|
||||||
/* Toss events which come in late. Usually this means your server's
|
/* Toss events which come in late. Usually this means your server's
|
||||||
* stuck in an infinite loop somewhere, but SIGIO is still getting
|
* stuck in an infinite loop somewhere, but SIGIO is still getting
|
||||||
* handled. */
|
* handled. */
|
||||||
if (newtail == miEventQueue.head) {
|
if (((oldtail + 1) % QUEUE_SIZE) == miEventQueue.head) {
|
||||||
ErrorF("[mi] EQ overflowing. The server is probably stuck "
|
ErrorF("[mi] EQ overflowing. The server is probably stuck "
|
||||||
"in an infinite loop.\n");
|
"in an infinite loop.\n");
|
||||||
if (!stuck) {
|
if (!stuck) {
|
||||||
|
@ -184,7 +183,6 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stuck = 0;
|
stuck = 0;
|
||||||
miEventQueue.tail = newtail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
evlen = sizeof(xEvent);
|
evlen = sizeof(xEvent);
|
||||||
|
@ -218,6 +216,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
|
||||||
miEventQueue.events[oldtail].pDev = pDev;
|
miEventQueue.events[oldtail].pDev = pDev;
|
||||||
|
|
||||||
miEventQueue.lastMotion = isMotion;
|
miEventQueue.lastMotion = isMotion;
|
||||||
|
miEventQueue.tail = (oldtail + 1) % QUEUE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue