diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-04-14 22:05:41 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-05-11 14:27:36 +1000 |
commit | 8670c46bdfdade64e63119d2ebbd5ef63b6fa2c3 (patch) | |
tree | ed822f928bc3fff5e965c53751dcc1587b8dd90e | |
parent | e7150db5350bc2113ff4126019b489847a4dc217 (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>
-rw-r--r-- | Xext/xtest.c | 5 | ||||
-rw-r--r-- | dix/devices.c | 6 | ||||
-rw-r--r-- | dix/getevents.c | 101 | ||||
-rw-r--r-- | hw/dmx/input/dmxevents.c | 8 | ||||
-rw-r--r-- | hw/kdrive/src/kinput.c | 2 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Priv.h | 2 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 2 | ||||
-rw-r--r-- | hw/xnest/Events.c | 2 | ||||
-rw-r--r-- | hw/xnest/Init.c | 2 | ||||
-rw-r--r-- | hw/xquartz/darwinEvents.c | 2 | ||||
-rw-r--r-- | hw/xwin/winkeybd.c | 2 | ||||
-rw-r--r-- | hw/xwin/winmouse.c | 4 | ||||
-rw-r--r-- | include/input.h | 36 | ||||
-rw-r--r-- | mi/mieq.c | 47 | ||||
-rw-r--r-- | mi/mipointer.c | 5 | ||||
-rw-r--r-- | xkb/xkbActions.c | 4 |
16 files changed, 85 insertions, 145 deletions
diff --git a/Xext/xtest.c b/Xext/xtest.c index 18e1ef7ae..daa6430f1 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -52,6 +52,7 @@ #include "mipointer.h" #include "xserver-properties.h" #include "exevents.h" +#include "eventstr.h" #include "inpututils.h" #include "modinit.h" @@ -61,7 +62,7 @@ extern int DeviceValuator; /* XTest events are sent during request processing and may be interruped by * a SIGIO. We need a separate event list to avoid events overwriting each * other's memory */ -static EventListPtr xtest_evlist; +static InternalEvent* xtest_evlist; /** * xtestpointer @@ -428,7 +429,7 @@ ProcXTestFakeInput(ClientPtr client) } for (i = 0; i < nevents; i++) - mieqProcessDeviceEvent(dev, (InternalEvent*)(xtest_evlist+i)->event, NULL); + mieqProcessDeviceEvent(dev, &xtest_evlist[i], NULL); if (need_ptr_update) miPointerUpdateSprite(dev); diff --git a/dix/devices.c b/dix/devices.c index 7968c7357..9a4498b9f 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -2368,7 +2368,7 @@ RecalculateMasterButtons(DeviceIntPtr slave) void ReleaseButtonsAndKeys(DeviceIntPtr dev) { - EventListPtr eventlist = InitEventList(GetMaximumEventsNum()); + InternalEvent* eventlist = InitEventList(GetMaximumEventsNum()); ButtonClassPtr b = dev->button; KeyClassPtr k = dev->key; int i, j, nevents; @@ -2383,7 +2383,7 @@ ReleaseButtonsAndKeys(DeviceIntPtr dev) { nevents = GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL); for (j = 0; j < nevents; j++) - mieqProcessDeviceEvent(dev, (InternalEvent*)(eventlist+j)->event, NULL); + mieqProcessDeviceEvent(dev, &eventlist[j], NULL); } } @@ -2394,7 +2394,7 @@ ReleaseButtonsAndKeys(DeviceIntPtr dev) { nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i, NULL); for (j = 0; j < nevents; j++) - mieqProcessDeviceEvent(dev, (InternalEvent*)(eventlist+j)->event, NULL); + mieqProcessDeviceEvent(dev, &eventlist[j], NULL); } } diff --git a/dix/getevents.c b/dix/getevents.c index 68a5224dc..e8c2f45b0 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -68,15 +68,15 @@ /* Number of motion history events to store. */ #define MOTION_HISTORY_SIZE 256 -/* InputEventList is the container list for all input events generated by the +/* InputEventList is the storage for input events generated by the * DDX. The DDX is expected to call GetEventList() and then pass the list into * Get{Pointer|Keyboard}Events. */ -EventListPtr InputEventList = NULL; +InternalEvent* InputEventList = NULL; int InputEventListLen = 0; int -GetEventList(EventListPtr* list) +GetEventList(InternalEvent** list) { *list = InputEventList; return InputEventListLen; @@ -224,7 +224,7 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask) } void -CreateClassesChangedEvent(EventList* event, +CreateClassesChangedEvent(InternalEvent* event, DeviceIntPtr master, DeviceIntPtr slave, int type) @@ -233,7 +233,7 @@ CreateClassesChangedEvent(EventList* event, DeviceChangedEvent *dce; CARD32 ms = GetTimeInMillis(); - dce = (DeviceChangedEvent*)event->event; + dce = &event->changed_event; memset(dce, 0, sizeof(DeviceChangedEvent)); dce->deviceid = slave->id; dce->masterid = master->id; @@ -677,15 +677,15 @@ clipValuators(DeviceIntPtr pDev, ValuatorMask *mask) * is done in the event processing). * Pull in the coordinates from the MD if necessary. * - * @param events Pointer to a pre-allocated event list. + * @param events Pointer to a pre-allocated event array. * @param dev The slave device that generated an event. * @param type Either DEVCHANGE_POINTER_EVENT and/or DEVCHANGE_KEYBOARD_EVENT * @param num_events The current number of events, returns the number of * events if a DCCE was generated. * @return The updated @events pointer. */ -EventListPtr -UpdateFromMaster(EventListPtr events, DeviceIntPtr dev, int type, int *num_events) +InternalEvent* +UpdateFromMaster(InternalEvent* events, DeviceIntPtr dev, int type, int *num_events) { DeviceIntPtr master; @@ -926,12 +926,11 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms) } static void -queueEventList(DeviceIntPtr device, EventList *events, int nevents) +queueEventList(DeviceIntPtr device, InternalEvent *events, int nevents) { int i; - for (i = 0; i < nevents; i++) - mieqEnqueue(device, (InternalEvent*)((events + i)->event)); + mieqEnqueue(device, &events[i]); } /** @@ -949,7 +948,7 @@ queueEventList(DeviceIntPtr device, EventList *events, int nevents) * */ void -QueueKeyboardEvents(EventList *events, DeviceIntPtr device, int type, +QueueKeyboardEvents(InternalEvent *events, DeviceIntPtr device, int type, int keycode, const ValuatorMask *mask) { int nevents; @@ -962,12 +961,13 @@ QueueKeyboardEvents(EventList *events, DeviceIntPtr device, int type, * Returns a set of InternalEvents for KeyPress/KeyRelease, optionally * also with valuator events. * - * events is not NULL-terminated; the return value is the number of events. - * The DDX is responsible for allocating the event structure in the first - * place via GetMaximumEventsNum(), and for freeing it. + * The DDX is responsible for allocating the event list in the first + * place via InitEventList(), and for freeing it. + * + * @return the number of events written into events. */ int -GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, +GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int key_code, const ValuatorMask *mask_in) { int num_events = 0; CARD32 ms = 0; @@ -1000,7 +1000,7 @@ GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, ms = GetTimeInMillis(); - raw = (RawDeviceEvent*)events->event; + raw = &events->raw_event; events++; num_events++; @@ -1013,7 +1013,7 @@ GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, set_raw_valuators(raw, &mask, raw->valuators.data); - event = (DeviceEvent*) events->event; + event = &events->device_event; init_event(pDev, event, ms); event->detail.key = key_code; @@ -1034,37 +1034,16 @@ GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, } /** - * Initialize an event list and fill with 32 byte sized events. + * Initialize an event array large enough for num_events arrays. * This event list is to be passed into GetPointerEvents() and * GetKeyboardEvents(). * * @param num_events Number of elements in list. */ -EventListPtr +InternalEvent* InitEventList(int num_events) { - EventListPtr events; - int i; - - events = (EventListPtr)calloc(num_events, sizeof(EventList)); - if (!events) - return NULL; - - for (i = 0; i < num_events; i++) - { - events[i].evlen = sizeof(InternalEvent); - events[i].event = calloc(1, sizeof(InternalEvent)); - if (!events[i].event) - { - /* rollback */ - while(i--) - free(events[i].event); - free(events); - events = NULL; - break; - } - } - + InternalEvent *events = calloc(num_events, sizeof(InternalEvent)); return events; } @@ -1075,12 +1054,8 @@ InitEventList(int num_events) * @param num_events Number of elements in list. */ void -FreeEventList(EventListPtr list, int num_events) +FreeEventList(InternalEvent *list, int num_events) { - if (!list) - return; - while(num_events--) - free(list[num_events].event); free(list); } @@ -1101,7 +1076,7 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask, int *x, int *y) * * FIXME: don't require the event list to be passed in. * - * @param events Event list used as temporary storage + * @param events Set of events list used as temporary storage * @param device The device to generate the event for * @param type Event type, one of ButtonPress, ButtonRelease, MotionNotify * @param buttons Button number of the buttons modified. Must be 0 for @@ -1110,7 +1085,7 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask, int *x, int *y) * @param mask Valuator mask for valuators present for this event. */ void -QueuePointerEvents(EventList *events, DeviceIntPtr device, int type, +QueuePointerEvents(InternalEvent *events, DeviceIntPtr device, int type, int buttons, int flags, const ValuatorMask *mask) { int nevents; @@ -1120,11 +1095,10 @@ QueuePointerEvents(EventList *events, DeviceIntPtr device, int type, } /** - * Generate a series of InternalEvents (filled into the EventList) - * representing pointer motion, or button presses. + * Generate a series of InternalEvents representing pointer motion, or + * button presses. * - * events is not NULL-terminated; the return value is the number of events. - * The DDX is responsible for allocating the event structure in the first + * The DDX is responsible for allocating the events in the first * place via InitEventList() and GetMaximumEventsNum(), and for freeing it. * * In the generated events rootX/Y will be in absolute screen coords and @@ -1134,9 +1108,11 @@ QueuePointerEvents(EventList *events, DeviceIntPtr device, int type, * last.valuators[x] of the master device is in absolute screen coords. * * master->last.valuators[x] for x > 2 is undefined. + * + * @return the number of events written into events. */ int -GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, +GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons, int flags, const ValuatorMask *mask_in) { int num_events = 1; CARD32 ms; @@ -1174,7 +1150,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events); - raw = (RawDeviceEvent*)events->event; + raw = &events->raw_event; events++; num_events++; @@ -1243,7 +1219,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, clipValuators(pDev, &mask); - event = (DeviceEvent*) events->event; + event = &events->device_event; init_event(pDev, event, ms); if (type == MotionNotify) { @@ -1286,7 +1262,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, * */ void -QueueProximityEvents(EventList *events, DeviceIntPtr device, int type, +QueueProximityEvents(InternalEvent *events, DeviceIntPtr device, int type, const ValuatorMask *mask) { int nevents; @@ -1299,12 +1275,13 @@ QueueProximityEvents(EventList *events, DeviceIntPtr device, int type, * Generate ProximityIn/ProximityOut InternalEvents, accompanied by * valuators. * - * events is not NULL-terminated; the return value is the number of events. - * The DDX is responsible for allocating the event structure in the first - * place via GetMaximumEventsNum(), and for freeing it. + * The DDX is responsible for allocating the events in the first place via + * InitEventList(), and for freeing it. + * + * @return the number of events written into events. */ int -GetProximityEvents(EventList *events, DeviceIntPtr pDev, int type, const ValuatorMask *mask_in) +GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, const ValuatorMask *mask_in) { int num_events = 1, i; DeviceEvent *event; @@ -1336,7 +1313,7 @@ GetProximityEvents(EventList *events, DeviceIntPtr pDev, int type, const Valuato events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events); - event = (DeviceEvent *) events->event; + event = &events->device_event; init_event(pDev, event, GetTimeInMillis()); event->type = (type == ProximityIn) ? ET_ProximityIn : ET_ProximityOut; diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 3f9035cdd..8aa1b8036 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -177,7 +177,7 @@ static void enqueueMotion(DevicePtr pDev, int x, int y) GETDMXLOCALFROMPDEV; DeviceIntPtr p = dmxLocal->pDevice; int valuators[3]; - EventListPtr events; + InternalEvent* events; int detail = 0; /* XXX should this be mask of pressed buttons? */ ValuatorMask mask; valuators[0] = x; @@ -290,7 +290,7 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, int thisX = 0; int thisY = 0; int count; - EventListPtr events; + InternalEvent* events; ValuatorMask mask; memset(xE, 0, sizeof(xE)); @@ -389,7 +389,7 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, XDeviceMotionEvent *me = (XDeviceMotionEvent *)e; DeviceIntPtr pDevice = dmxLocal->pDevice; int valuators[MAX_VALUATORS]; - EventListPtr events; + InternalEvent* events; ValuatorMask mask; if (!e) @@ -652,7 +652,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, xEvent xE; DeviceIntPtr p = dmxLocal->pDevice; int valuators[3]; - EventListPtr events; + InternalEvent* events; ValuatorMask mask; DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail); diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 521542c91..62e8f7866 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -66,7 +66,7 @@ static struct KdConfigDevice *kdConfigPointers = NULL; static KdKeyboardDriver *kdKeyboardDrivers = NULL; static KdPointerDriver *kdPointerDrivers = NULL; -static EventListPtr kdEvents = NULL; +static InternalEvent* kdEvents = NULL; static Bool kdInputEnabled; static Bool kdOffScreen; diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 7137a5363..015e12c3f 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -149,7 +149,7 @@ extern _X_EXPORT int xf86SetLogVerbosity(int verb); extern _X_EXPORT Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only ); /* xf86Xinput.c */ -extern _X_EXPORT EventList *xf86Events; +extern _X_EXPORT InternalEvent *xf86Events; #endif /* _NO_XF86_PROTOTYPES */ diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 111f16f50..9827661d6 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -99,7 +99,7 @@ return; \ } -EventListPtr xf86Events = NULL; +InternalEvent* xf86Events = NULL; static int xf86InputDevicePostInit(DeviceIntPtr dev); diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c index 574e4e415..bbd70bf03 100644 --- a/hw/xnest/Events.c +++ b/hw/xnest/Events.c @@ -43,7 +43,7 @@ is" without express or implied warranty. CARD32 lastEventTime = 0; -extern EventList *xnestEvents; +extern InternalEvent *xnestEvents; void ProcessInputEvents(void) diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c index 8a90cc65e..f8637f2ab 100644 --- a/hw/xnest/Init.c +++ b/hw/xnest/Init.c @@ -45,7 +45,7 @@ is" without express or implied warranty. Bool xnestDoFullGeneration = True; -EventList *xnestEvents = NULL; +InternalEvent *xnestEvents = NULL; void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 99956e012..6736e3d69 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -88,7 +88,7 @@ static pthread_mutex_t fd_add_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t fd_add_ready_cond = PTHREAD_COND_INITIALIZER; static pthread_t fd_add_tid = NULL; -static EventListPtr darwinEvents = NULL; +static InternalEvent* darwinEvents = NULL; static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER; diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index cf0dea22e..8b6be0266 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -472,7 +472,7 @@ winKeybdReleaseKeys (void) void winSendKeyEvent (DWORD dwKey, Bool fDown) { - EventListPtr events; + InternalEvent* events; /* * When alt-tabing between screens we can get phantom key up messages diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c index 0e36687cf..aaa4d4b99 100644 --- a/hw/xwin/winmouse.c +++ b/hw/xwin/winmouse.c @@ -234,7 +234,7 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ) void winMouseButtonsSendEvent (int iEventType, int iButton) { - EventListPtr events; + InternalEvent* events; ValuatorMask mask; if (g_winMouseButtonMap) @@ -365,7 +365,7 @@ void winEnqueueMotion(int x, int y) { int valuators[2]; ValuatorMask mask; - EventListPtr events; + InternalEvent* events; miPointerSetPosition(g_pwinPointer, POINTER_RELATIVE, &x, &y); valuators[0] = x; diff --git a/include/input.h b/include/input.h index 100c00fc0..3c7740dce 100644 --- a/include/input.h +++ b/include/input.h @@ -109,18 +109,8 @@ typedef union _GrabMask GrabMask; typedef struct _ValuatorMask ValuatorMask; -typedef struct _EventList { - xEvent* event; - int evlen; /* length of allocated memory for event in bytes. This is not - the actual length of the event. The event's actual length is - 32 for standard events or 32 + - ((xGenericEvent*)event)->length * 4 for GenericEvents. - For events in the EQ, the length is - ((InternalEvent*)event)->u.any.length */ -} EventList, *EventListPtr; - /* The DIX stores incoming input events in this list */ -extern EventListPtr InputEventList; +extern InternalEvent* InputEventList; extern int InputEventListLen; typedef int (*DeviceProc)( @@ -439,22 +429,22 @@ extern _X_EXPORT void CloseInput(void); extern _X_EXPORT int GetMaximumEventsNum(void); -extern _X_EXPORT int GetEventList(EventListPtr* list); -extern _X_EXPORT EventListPtr InitEventList(int num_events); -extern _X_EXPORT void FreeEventList(EventListPtr list, int num_events); +extern _X_EXPORT int GetEventList(InternalEvent** list); +extern _X_EXPORT InternalEvent *InitEventList(int num_events); +extern _X_EXPORT void FreeEventList(InternalEvent *list, int num_events); -extern void CreateClassesChangedEvent(EventListPtr event, +extern void CreateClassesChangedEvent(InternalEvent *event, DeviceIntPtr master, DeviceIntPtr slave, int type); -extern EventListPtr UpdateFromMaster( - EventListPtr events, +extern InternalEvent * UpdateFromMaster( + InternalEvent *events, DeviceIntPtr pDev, int type, int *num_events); extern _X_EXPORT int GetPointerEvents( - EventListPtr events, + InternalEvent *events, DeviceIntPtr pDev, int type, int buttons, @@ -462,7 +452,7 @@ extern _X_EXPORT int GetPointerEvents( const ValuatorMask *mask); extern _X_EXPORT void QueuePointerEvents( - EventListPtr events, + InternalEvent *events, DeviceIntPtr pDev, int type, int buttons, @@ -470,27 +460,27 @@ extern _X_EXPORT void QueuePointerEvents( const ValuatorMask *mask); extern _X_EXPORT int GetKeyboardEvents( - EventListPtr events, + InternalEvent *events, DeviceIntPtr pDev, int type, int key_code, const ValuatorMask *mask); extern _X_EXPORT void QueueKeyboardEvents( - EventListPtr events, + InternalEvent *events, DeviceIntPtr pDev, int type, int key_code, const ValuatorMask *mask); extern int GetProximityEvents( - EventListPtr events, + InternalEvent *events, DeviceIntPtr pDev, int type, const ValuatorMask *mask); extern void QueueProximityEvents( - EventListPtr events, + InternalEvent *events, DeviceIntPtr pDev, int type, const ValuatorMask *mask); @@ -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 diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index c4336d7b4..4b5405ab0 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -1351,7 +1351,7 @@ static void InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, ValuatorMask *mask) { ScreenPtr pScreen; - EventListPtr events; + InternalEvent* events; int nevents, i; DeviceIntPtr ptr, mpointer, lastSlave = NULL; Bool saveWait; @@ -1377,7 +1377,7 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, Valuat OsReleaseSignals(); for (i = 0; i < nevents; i++) - mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); + mieqProcessDeviceEvent(ptr, &events[i], NULL); FreeEventList(events, GetMaximumEventsNum()); |