summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-04-14 22:05:41 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-05-11 14:27:36 +1000
commit8670c46bdfdade64e63119d2ebbd5ef63b6fa2c3 (patch)
treeed822f928bc3fff5e965c53751dcc1587b8dd90e /mi
parente7150db5350bc2113ff4126019b489847a4dc217 (diff)
input: replace EventListPtr with InternalEvent array
EventListPtr is a relic from pre-1.6, when we had protocol events in the event queue and thus events of varying size. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'mi')
-rw-r--r--mi/mieq.c47
-rw-r--r--mi/mipointer.c5
2 files changed, 12 insertions, 40 deletions
diff --git a/mi/mieq.c b/mi/mieq.c
index 3e6f93110..236ffcc3b 100644
--- a/mi/mieq.c
+++ b/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;
@@ -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;
@@ -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,20 +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;
@@ -480,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
diff --git a/mi/mipointer.c b/mi/mipointer.c
index db243810c..322be9e44 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -63,6 +63,7 @@ in this Software without prior written authorization from The Open Group.
# include "dixstruct.h"
# include "inputstr.h"
# include "inpututils.h"
+# include "eventstr.h"
DevPrivateKeyRec miPointerScreenKeyRec;
@@ -99,7 +100,7 @@ static void miPointerDeviceCleanup(DeviceIntPtr pDev,
ScreenPtr pScreen);
static void miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
-static EventList* events; /* for WarpPointer MotionNotifies */
+static InternalEvent* events; /* for WarpPointer MotionNotifies */
Bool
miPointerInitialize (ScreenPtr pScreen,
@@ -689,7 +690,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
darwinEvents_lock();
#endif
for (i = 0; i < nevents; i++)
- mieqEnqueue(pDev, (InternalEvent*)events[i].event);
+ mieqEnqueue(pDev, &events[i]);
#ifdef XQUARTZ
darwinEvents_unlock();
#endif