summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-07-28 16:51:14 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-07-30 08:43:13 +1000
commit3d3b8babd1a5407082f1a40875ed69f62ba2153f (patch)
tree2f23d6acc5bf00bc8a92fc053e748c624c7741db /mi
parentf85619b14d130ec54d42cabfaee15e55ced0c665 (diff)
mi: update master event copying to InternalEvents.
This is long overdue. The device events are InternalEvents now (and only one at a time), diminishing the need for an EventList for the master event. Furthermore, don't make masterEvent a static since this will interfere if mieqProcessDeviceEvent is called from somewhere else (e.g. XKB actions). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'mi')
-rw-r--r--mi/mi.h2
-rw-r--r--mi/mieq.c37
2 files changed, 10 insertions, 29 deletions
diff --git a/mi/mi.h b/mi/mi.h
index 4431239cf..3db8bfcf1 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -224,7 +224,7 @@ extern _X_EXPORT void mieqProcessInputEvents(
extern DeviceIntPtr CopyGetMasterEvent(
DeviceIntPtr /* sdev */,
InternalEvent* /* original */,
- EventListPtr /* mlist */
+ InternalEvent* /* copy */
);
/**
diff --git a/mi/mieq.c b/mi/mieq.c
index 539a99f81..6ec2dba08 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -78,7 +78,6 @@ typedef struct _EventQueue {
} EventQueueRec, *EventQueuePtr;
static EventQueueRec miEventQueue;
-static EventListPtr masterEvents; /* for use in mieqProcessInputEvents */
#ifdef XQUARTZ
#include <pthread.h>
@@ -117,16 +116,6 @@ mieqInit(void)
miEventQueue.events[i].events = evlist;
}
- /* XXX: mE is just 1 event long, if we have Motion + Valuator they are
- * squashed into the first event to make passing it into the event
- * processing handlers easier. This should be fixed when the processing
- * handlers switch to EventListPtr instead of xEvent */
- masterEvents = InitEventList(1);
- if (!masterEvents)
- FatalError("Could not allocated MD event queue.\n");
- SetMinimumEventSize(masterEvents, 1,
- (1 + MAX_VALUATOR_EVENTS) * sizeof(xEvent));
-
SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
return TRUE;
}
@@ -317,16 +306,15 @@ FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev,
* Copy the given event into master.
* @param sdev The slave device the original event comes from
* @param original The event as it came from the EQ
- * @param master The event after being copied
+ * @param copy The event after being copied
* @return The master device or NULL if the device is a floating slave.
*/
DeviceIntPtr
CopyGetMasterEvent(DeviceIntPtr sdev,
- InternalEvent* original, EventListPtr mlist)
+ InternalEvent* original, InternalEvent *copy)
{
DeviceIntPtr mdev;
int len = original->any.length;
- InternalEvent *mevent;
CHECKEVENT(original);
@@ -351,15 +339,9 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
break;
}
-
- if (mlist->evlen < len)
- SetMinimumEventSize(mlist, 1, len);
-
- mevent = (InternalEvent*)mlist->event;
-
- memcpy(mevent, original, len);
- ChangeDeviceID(mdev, mevent);
- FixUpEventForMaster(mdev, sdev, original, mevent);
+ memcpy(copy, original, len);
+ ChangeDeviceID(mdev, copy);
+ FixUpEventForMaster(mdev, sdev, original, copy);
return mdev;
}
@@ -378,6 +360,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
mieqHandler handler;
int x = 0, y = 0;
DeviceIntPtr master;
+ InternalEvent mevent; /* master event */
CHECKEVENT(event);
@@ -392,7 +375,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
NewCurrentScreen (dev, DequeueScreen(dev), x, y);
}
else {
- master = CopyGetMasterEvent(dev, event, masterEvents);
+ master = CopyGetMasterEvent(dev, event, &mevent);
if (master)
master->u.lastSlave = dev;
@@ -406,7 +389,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
/* Check for the SD's master in case the device got detached
* during event processing */
if (master && dev->u.master)
- handler(screenNum, (InternalEvent*)masterEvents->event, master);
+ handler(screenNum, &mevent, master);
} else
{
/* process slave first, then master */
@@ -415,9 +398,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
/* Check for the SD's master in case the device got detached
* during event processing */
if (master && dev->u.master)
- master->public.processInputProc(
- (InternalEvent*)masterEvents->event,
- master);
+ master->public.processInputProc(&mevent, master);
}
}
}