mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-29 02:31:18 +00:00
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).
This commit is contained in:
parent
3fe64d8d27
commit
77dba004a9
3 changed files with 30 additions and 1 deletions
|
|
@ -5712,7 +5712,8 @@ InitEvents(void)
|
|||
DontPropagateRefCnts[i] = 0;
|
||||
}
|
||||
|
||||
InputEventList = InitEventList(GetMaximumEventsNum());
|
||||
InputEventListLen = GetMaximumEventsNum();
|
||||
InputEventList = InitEventList(InputEventListLen);
|
||||
if (!InputEventList)
|
||||
FatalError("[dix] Failed to allocate input event list.\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
@ -598,6 +599,29 @@ InitEventList(int num_events)
|
|||
return 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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue