summaryrefslogtreecommitdiff
path: root/dix/getevents.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-02-03 10:10:46 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-02-19 15:52:35 +1030
commit77dba004a9aaf35f183f61ff6875a491a52aa030 (patch)
tree5e8d04ebc4f2094ef9f5923c311865da2212b0da /dix/getevents.c
parent3fe64d8d271aea0863bf01b0376f3eceec0c90b5 (diff)
dix: add InputEventListLen and SetMinimumEventSize
The latter is used to increase the amount of allocated memory for the event list. This will be needed for ClassesChangedEvents that can be of more or less arbitrary size (larger than 32 anyway).
Diffstat (limited to 'dix/getevents.c')
-rw-r--r--dix/getevents.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 2a9df0f40..407ac58b2 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -75,6 +75,7 @@ extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
* Get{Pointer|Keyboard}Events.
*/
EventListPtr InputEventList = NULL;
+int InputEventListLen = 0;
_X_EXPORT EventListPtr
GetEventList()
@@ -599,6 +600,29 @@ InitEventList(int num_events)
}
/**
+ * Allocs min_size memory for each event in the list.
+ */
+_X_EXPORT void
+SetMinimumEventSize(EventListPtr list, int num_events, int min_size)
+{
+ if (!list)
+ return;
+
+ while(num_events--)
+ {
+ if (list[num_events].evlen < min_size)
+ {
+ list[num_events].event = realloc(list[num_events].event, min_size);
+ if (!list[num_events].event)
+ {
+ FatalError("[dix] Failed to set event list's "
+ "min_size to %d.\n", min_size);
+ }
+ }
+ }
+}
+
+/**
* Free an event list.
*
* @param list The list to be freed.