dix: fix endianess issue in AddInputDevice. #18111

dev->enabled is a Bool. Bool is two bytes.
BOOL on the other hand is a protocol type and always 1 byte. So copy the value
into the one-byte type before passing it into XIChangeDeviceProperty.

Found by Michel Dänzer.

X.Org Bug 18111 <http://bugs.freedesktop.org/show_bug.cgi?id=18111>
This commit is contained in:
Peter Hutterer 2008-10-23 09:13:41 +10:30
parent f6cbe0326c
commit 98f01c2abe

View File

@ -139,6 +139,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
DeviceIntPtr devtmp;
int devid;
char devind[MAX_DEVICES];
BOOL enabled;
/* Find next available id */
memset(devind, 0, sizeof(char)*MAX_DEVICES);
@ -183,8 +184,9 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
*prev = dev;
dev->next = NULL;
enabled = TRUE;
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
XA_INTEGER, 8, PropModeReplace, 1, &enabled,
FALSE);
XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE);
XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL, NULL);