diff --git a/dix/devices.c b/dix/devices.c index d386f41..fe67faf 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -108,14 +108,15 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, { if (property == XIGetKnownProperty(XI_PROP_ENABLED)) { - if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1) + if (prop->format != 8 * sizeof(dev->enabled) || + prop->type != XA_INTEGER || prop->size != 1) return BadValue; if (!checkonly) { - if ((*((CARD8*)prop->data)) && !dev->enabled) + if ((*((Bool*)prop->data)) && !dev->enabled) EnableDevice(dev); - else if (!(*((CARD8*)prop->data)) && dev->enabled) + else if (!(*((Bool*)prop->data)) && dev->enabled) DisableDevice(dev); } } @@ -184,8 +185,8 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) dev->next = NULL; XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED), - XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled, - FALSE); + XA_INTEGER, 8 * sizeof(dev->enabled), + PropModeReplace, 1, &dev->enabled, FALSE); XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE); XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL, NULL); @@ -275,8 +276,8 @@ EnableDevice(DeviceIntPtr dev) dev->next = NULL; XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED), - XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled, - TRUE); + XA_INTEGER, 8 * sizeof(dev->enabled), + PropModeReplace, 1, &dev->enabled, TRUE); ev.type = DevicePresenceNotify; ev.time = currentTime.milliseconds; @@ -351,8 +352,8 @@ DisableDevice(DeviceIntPtr dev) inputInfo.off_devices = dev; XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED), - XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled, - TRUE); + XA_INTEGER, 8 * sizeof(dev->enabled), + PropModeReplace, 1, &dev->enabled, TRUE); ev.type = DevicePresenceNotify; ev.time = currentTime.milliseconds;