add fallback ChangeDeviceControl, allow XOpenDevice on closed device

Add a fallback ChangeDeviceControl, which allows the attributes we know about
so far.
Allow XOpenDevice on closed devices.
This commit is contained in:
Daniel Stone 2006-07-23 19:02:12 -04:00 committed by Daniel Stone
parent e73e5e2a4d
commit ca3f4fc1b0

View File

@ -288,18 +288,21 @@ OpenInputDevice(DeviceIntPtr dev,
ClientPtr client, ClientPtr client,
int *status) int *status)
{ {
if (!dev->inited) { if (!dev->inited)
*status = BadDevice; ActivateDevice(dev);
} else {
if (!dev->public.on) { if (!dev->public.on) {
if (EnableDevice(dev)) { if (EnableDevice(dev)) {
/* to prevent ProcXOpenDevice to call EnableDevice again */ dev->startup = FALSE;
dev->startup = FALSE; }
} else { else {
*status = BadDevice; ErrorF("couldn't enable device %s\n", dev->name);
} *status = BadDevice;
return;
} }
} }
*status = Success;
} }
@ -530,7 +533,14 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
if (!local->control_proc) { if (!local->control_proc) {
return (BadMatch); switch (control->control) {
case DEVICE_CORE:
case DEVICE_RESOLUTION:
case DEVICE_TOUCHSCREEN:
return Success;
default:
return BadMatch;
}
} }
else { else {
return (*local->control_proc)(local, control); return (*local->control_proc)(local, control);