diff options
author | Daniel Stone <daniel@fooishbar.org> | 2006-08-07 16:51:09 +0300 |
---|---|---|
committer | Daniel Stone <daniels@endtroducing.fooishbar.org> | 2006-08-07 16:51:09 +0300 |
commit | 5c7001fef8ffc6e3d8585a37d3f79a9495be8ed0 (patch) | |
tree | 94b0a1b33dc40d18a24036f2ecb2b66ab314afd2 /mi | |
parent | c85e64cba1d2d88f676ca7cf23b52a6f8219e90e (diff) |
memcpy() events in
memcpy events into our event structure instead of doing pointer assignment.
Diffstat (limited to 'mi')
-rw-r--r-- | mi/mieq.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -51,7 +51,7 @@ in this Software without prior written authorization from The Open Group. #define QUEUE_SIZE 256 typedef struct _Event { - xEvent event[2]; + xEvent event[7]; int nevents; ScreenPtr pScreen; DeviceIntPtr pDev; @@ -101,6 +101,7 @@ mieqEnqueue (xEvent *e) #ifdef DEBUG ErrorF("mieqEnqueue: slamming an event on to the queue from %d\n", kbp->deviceid & DEVICE_BITS); + ErrorF(" type %d, detail %d\n", e->u.u.type, e->u.u.detail); #endif if (e->u.u.type == MotionNotify) { @@ -122,9 +123,8 @@ mieqEnqueue (xEvent *e) /* We silently steal valuator events: just tack them on to the last * motion event they need to be attached to. Sigh. */ if (e->u.u.type == DeviceValuator) { - if (laste->nevents >= 6) { + if (laste->nevents > 6) { ErrorF("mieqEnqueue: more than six valuator events; dropping.\n"); - free(e); return; } if (oldtail == miEventQueue.head || @@ -134,10 +134,9 @@ mieqEnqueue (xEvent *e) ((lastkbp->deviceid & DEVICE_BITS) != (v->deviceid & DEVICE_BITS))) { ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n"); - free(e); return; } - laste->event[laste->nevents++] = *e; + memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent)); return; } else if (e->u.u.type == DeviceMotionNotify) { @@ -161,13 +160,12 @@ mieqEnqueue (xEvent *e) /* Toss events which come in late */ if (newtail == miEventQueue.head) { ErrorF("tossed event which came in late\n"); - free(e); return; } miEventQueue.tail = newtail; } - miEventQueue.events[oldtail].event[0] = *e; + memcpy(&(miEventQueue.events[oldtail].event[0]), e, sizeof(xEvent)); miEventQueue.events[oldtail].nevents = 1; /* @@ -238,7 +236,5 @@ void mieqProcessInputEvents () ++miEventQueue.head; (*e->pDev->public.processInputProc)(e->event, e->pDev, e->nevents); } - - free(e->event); } } |