Xi: make SizeDeviceInfo public and re-use from CreateClassesChangedEvent.
This commit is contained in:
parent
6d9d18bf77
commit
09a8fc5c7a
|
@ -92,7 +92,7 @@ SProcXListInputDevices(ClientPtr client)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
_X_EXPORT void
|
||||||
SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
|
SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
|
||||||
{
|
{
|
||||||
int chunks;
|
int chunks;
|
||||||
|
|
|
@ -49,4 +49,9 @@ CopySwapClasses(ClientPtr /* client */,
|
||||||
CARD8* /* num_classes */,
|
CARD8* /* num_classes */,
|
||||||
char** /* classbuf */);
|
char** /* classbuf */);
|
||||||
|
|
||||||
|
void
|
||||||
|
SizeDeviceInfo(DeviceIntPtr /* dev */,
|
||||||
|
int* /* namesize */,
|
||||||
|
int* /* size */);
|
||||||
|
|
||||||
#endif /* LISTDEV_H */
|
#endif /* LISTDEV_H */
|
||||||
|
|
|
@ -113,6 +113,7 @@ CreateClassesChangedEvent(EventList* event,
|
||||||
deviceClassesChangedEvent *dcce;
|
deviceClassesChangedEvent *dcce;
|
||||||
int len = sizeof(xEvent);
|
int len = sizeof(xEvent);
|
||||||
CARD32 ms = GetTimeInMillis();
|
CARD32 ms = GetTimeInMillis();
|
||||||
|
int namelen = 0; /* dummy */
|
||||||
|
|
||||||
/* XXX: ok, this is a bit weird. We need to alloc enough size for the
|
/* XXX: ok, this is a bit weird. We need to alloc enough size for the
|
||||||
* event so it can be filled in in POE lateron. Reason being that if
|
* event so it can be filled in in POE lateron. Reason being that if
|
||||||
|
@ -120,19 +121,9 @@ CreateClassesChangedEvent(EventList* event,
|
||||||
* or realloc the original pointer.
|
* or realloc the original pointer.
|
||||||
* We can only do it here as we don't have the EventList in the event
|
* We can only do it here as we don't have the EventList in the event
|
||||||
* processing any more.
|
* processing any more.
|
||||||
*
|
|
||||||
* Code is basically same as in Xi/listdev.c
|
|
||||||
*/
|
*/
|
||||||
if (slave->key)
|
SizeDeviceInfo(slave, &namelen, &len);
|
||||||
len += sizeof(xKeyInfo);
|
|
||||||
if (slave->button)
|
|
||||||
len += sizeof(xButtonInfo);
|
|
||||||
if (slave->valuator)
|
|
||||||
{
|
|
||||||
int chunks = ((int)slave->valuator->numAxes + 19) / VPC;
|
|
||||||
len += (chunks * sizeof(xValuatorInfo) +
|
|
||||||
slave->valuator->numAxes * sizeof(xAxisInfo));
|
|
||||||
}
|
|
||||||
if (event->evlen < len)
|
if (event->evlen < len)
|
||||||
{
|
{
|
||||||
event->event = realloc(event->event, len);
|
event->event = realloc(event->event, len);
|
||||||
|
|
Loading…
Reference in New Issue