dix: Allocate device privates separate from devices
This will allow device privates to be resized. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
f38b2b6283
commit
493ad83323
|
@ -246,13 +246,17 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
||||||
|
|
||||||
if (devid >= MAXDEVICES)
|
if (devid >= MAXDEVICES)
|
||||||
return (DeviceIntPtr) NULL;
|
return (DeviceIntPtr) NULL;
|
||||||
dev =
|
dev = calloc(1,
|
||||||
_dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) +
|
|
||||||
sizeof(SpriteInfoRec),
|
|
||||||
sizeof(DeviceIntRec) +
|
sizeof(DeviceIntRec) +
|
||||||
sizeof(SpriteInfoRec),
|
sizeof(SpriteInfoRec));
|
||||||
offsetof(DeviceIntRec, devPrivates),
|
if (!dev)
|
||||||
PRIVATE_DEVICE);
|
return (DeviceIntPtr) NULL;
|
||||||
|
|
||||||
|
if (!dixAllocatePrivates(&dev->devPrivates, PRIVATE_DEVICE)) {
|
||||||
|
free(dev);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return (DeviceIntPtr) NULL;
|
return (DeviceIntPtr) NULL;
|
||||||
|
|
||||||
|
@ -282,6 +286,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
||||||
/* security creation/labeling check
|
/* security creation/labeling check
|
||||||
*/
|
*/
|
||||||
if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) {
|
if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) {
|
||||||
|
dixFreePrivates(dev->devPrivates, PRIVATE_DEVICE);
|
||||||
free(dev);
|
free(dev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -961,7 +966,8 @@ CloseDevice(DeviceIntPtr dev)
|
||||||
free(dev->last.touches[j].valuators);
|
free(dev->last.touches[j].valuators);
|
||||||
free(dev->last.touches);
|
free(dev->last.touches);
|
||||||
dev->config_info = NULL;
|
dev->config_info = NULL;
|
||||||
dixFreeObjectWithPrivates(dev, PRIVATE_DEVICE);
|
dixFreePrivates(dev->devPrivates, PRIVATE_DEVICE);
|
||||||
|
free(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue