diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2007-06-11 15:29:11 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil> | 2007-06-11 15:29:11 -0400 |
commit | e2a720c9a17dc860ee0a858c2b21fd71e86cdcd0 (patch) | |
tree | 980937a838242092b0ec6b9cfc89b39af99d045b /mi | |
parent | 878cac71aa0018deee861b297638c0744dba631b (diff) | |
parent | 3f9adb18f127318d054f30a57e3a77176e14c692 (diff) |
Merge branch 'master' into XACE-SELINUX
Conflicts:
dix/dixutils.c
Diffstat (limited to 'mi')
-rw-r--r-- | mi/mieq.c | 22 |
1 files changed, 6 insertions, 16 deletions
@@ -108,7 +108,8 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e) HWEventQueueType oldtail = miEventQueue.tail, newtail; int isMotion = 0; deviceValuator *v = (deviceValuator *) e; - EventPtr laste = &miEventQueue.events[oldtail - 1]; + EventPtr laste = &miEventQueue.events[(oldtail - 1) % + QUEUE_SIZE]; deviceKeyButtonPointer *lastkbp = (deviceKeyButtonPointer *) &laste->event[0]; @@ -139,14 +140,10 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e) if (isMotion && isMotion == miEventQueue.lastMotion && oldtail != miEventQueue.head) { - if (oldtail == 0) - oldtail = QUEUE_SIZE; - oldtail = oldtail - 1; + oldtail = (oldtail - 1) % QUEUE_SIZE; } else { - newtail = oldtail + 1; - if (newtail == QUEUE_SIZE) - newtail = 0; + newtail = (oldtail + 1) % QUEUE_SIZE; /* Toss events which come in late. Usually this means your server's * stuck in an infinite loop somewhere, but SIGIO is still getting * handled. */ @@ -214,22 +211,15 @@ mieqProcessInputEvents(void) e = &miEventQueue.events[miEventQueue.head]; /* Assumption - screen switching can only occur on motion events. */ + miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE; + if (e->pScreen != miEventQueue.pDequeueScreen) { miEventQueue.pDequeueScreen = e->pScreen; x = e->event[0].u.keyButtonPointer.rootX; y = e->event[0].u.keyButtonPointer.rootY; - if (miEventQueue.head == QUEUE_SIZE - 1) - miEventQueue.head = 0; - else - ++miEventQueue.head; NewCurrentScreen (miEventQueue.pDequeueScreen, x, y); } else { - if (miEventQueue.head == QUEUE_SIZE - 1) - miEventQueue.head = 0; - else - ++miEventQueue.head; - /* If someone's registered a custom event handler, let them * steal it. */ if (miEventQueue.handlers[e->event->u.u.type]) { |