diff options
author | marha <marha@users.sourceforge.net> | 2011-05-16 09:49:27 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-05-16 09:49:27 +0000 |
commit | ab5c2d2c78273ccdc7c9734bcba482a33fcf9652 (patch) | |
tree | d12aaeba9956621fe7429d94a7c90105fe306b42 /xorg-server/mi/mieq.c | |
parent | 421ecdd3ee6f691c63c4568944423d986f9f69db (diff) | |
parent | 08cbf3b50bfe713044f36b363c73768cd042f13c (diff) | |
download | vcxsrv-ab5c2d2c78273ccdc7c9734bcba482a33fcf9652.tar.gz vcxsrv-ab5c2d2c78273ccdc7c9734bcba482a33fcf9652.tar.bz2 vcxsrv-ab5c2d2c78273ccdc7c9734bcba482a33fcf9652.zip |
merge ^/branches/released .
Diffstat (limited to 'xorg-server/mi/mieq.c')
-rw-r--r-- | xorg-server/mi/mieq.c | 58 |
1 files changed, 14 insertions, 44 deletions
diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c index a8daf572b..538329827 100644 --- a/xorg-server/mi/mieq.c +++ b/xorg-server/mi/mieq.c @@ -64,7 +64,7 @@ in this Software without prior written authorization from The Open Group. #define DequeueScreen(dev) dev->spriteInfo->sprite->pDequeueScreen
typedef struct _Event {
- EventListPtr events;
+ InternalEvent* events;
ScreenPtr pScreen;
DeviceIntPtr pDev; /* device this event _originated_ from */
} EventRec, *EventPtr;
@@ -111,7 +111,7 @@ mieqInit(void) for (i = 0; i < QUEUE_SIZE; i++)
{
if (miEventQueue.events[i].events == NULL) {
- EventListPtr evlist = InitEventList(1);
+ InternalEvent* evlist = InitEventList(1);
if (!evlist)
FatalError("Could not allocate event queue.\n");
miEventQueue.events[i].events = evlist;
@@ -146,7 +146,7 @@ void mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
{
unsigned int oldtail = miEventQueue.tail;
- EventListPtr evt;
+ InternalEvent* evt;
int isMotion = 0;
int evlen;
Time time;
@@ -156,7 +156,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) pthread_mutex_lock(&miEventQueueMutex);
#endif
- CHECKEVENT(e);
+ verify_internal_event(e);
/* avoid merging events from different devices */
if (e->any.type == ET_Motion)
@@ -188,21 +188,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) evlen = e->any.length;
evt = miEventQueue.events[oldtail].events;
- if (evt->evlen < evlen)
- {
- evt->evlen = evlen;
- evt->event = realloc(evt->event, evt->evlen);
- if (!evt->event)
- {
- ErrorF("[mi] Running out of memory. Tossing event.\n");
-#ifdef XQUARTZ
- pthread_mutex_unlock(&miEventQueueMutex);
-#endif
- return;
- }
- }
-
- memcpy(evt->event, e, evlen);
+ memcpy(evt, e, evlen);
time = e->any.time;
/* Make sure that event times don't go backwards - this
@@ -211,7 +197,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) miEventQueue.lastEventTime - time < 10000)
e->any.time = miEventQueue.lastEventTime;
- miEventQueue.lastEventTime = ((InternalEvent*)evt->event)->any.time;
+ miEventQueue.lastEventTime = evt->any.time;
miEventQueue.events[oldtail].pScreen = pDev ? EnqueueScreen(pDev) : NULL;
miEventQueue.events[oldtail].pDev = pDev;
@@ -292,8 +278,8 @@ static void FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev,
InternalEvent* original, InternalEvent *master)
{
- CHECKEVENT(original);
- CHECKEVENT(master);
+ verify_internal_event(original);
+ verify_internal_event(master);
/* Ensure chained button mappings, i.e. that the detail field is the
* value of the mapped button on the SD, not the physical button */
if (original->any.type == ET_ButtonPress ||
@@ -323,7 +309,7 @@ CopyGetMasterEvent(DeviceIntPtr sdev, int type = original->any.type;
int mtype; /* which master type? */
- CHECKEVENT(original);
+ verify_internal_event(original);
/* ET_XQuartz has sdev == NULL */
if (!sdev || IsMaster(sdev) || IsFloating(sdev))
@@ -376,7 +362,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev, DeviceIntPtr master;
InternalEvent mevent; /* master event */
- CHECKEVENT(event);
+ verify_internal_event(event);
/* Custom event handler */
handler = miEventQueue.handlers[event->any.type];
@@ -431,10 +417,8 @@ void mieqProcessInputEvents(void)
{
EventRec *e = NULL;
- int evlen;
ScreenPtr screen;
- static InternalEvent *event = NULL;
- static size_t event_size = 0;
+ static InternalEvent event;
DeviceIntPtr dev = NULL,
master = NULL;
@@ -445,21 +429,7 @@ mieqProcessInputEvents(void) while (miEventQueue.head != miEventQueue.tail) {
e = &miEventQueue.events[miEventQueue.head];
- evlen = e->events->evlen;
- if(evlen > event_size)
- {
- event = realloc(event, evlen);
- event_size=evlen;
-
-
- if (!event)
- FatalError("[mi] No memory left for event processing.\n");
- }
-
-
- memcpy(event, e->events->event, evlen);
-
-
+ event = *e->events;
dev = e->pDev;
screen = e->pScreen;
@@ -481,10 +451,10 @@ mieqProcessInputEvents(void) DPMSSet(serverClient, DPMSModeOn);
#endif
- mieqProcessDeviceEvent(dev, event, screen);
+ mieqProcessDeviceEvent(dev, &event, screen);
/* Update the sprite now. Next event may be from different device. */
- if (event->any.type == ET_Motion && master)
+ if (event.any.type == ET_Motion && master)
miPointerUpdateSprite(dev);
#ifdef XQUARTZ
|