summaryrefslogtreecommitdiff
path: root/Xi/getdctl.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-10-20 00:28:40 +0300
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-10-20 00:43:11 +0300
commita8d3dad9d9f2b9053843e655abe463a68ba8dcb7 (patch)
treeecdd1935f9aa2b76a65504c2fb95af6e19ce5016 /Xi/getdctl.c
parentb0780312d80ea4af0136227f90fdd7ada3db71c5 (diff)
xi: add DEVICE_ENABLE control
Add DEVICE_ENABLE control, which allows runtime enabling and disabling of specific devices.
Diffstat (limited to 'Xi/getdctl.c')
-rw-r--r--Xi/getdctl.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 66342b340..2ae6ef302 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -136,6 +136,9 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_CORE:
total_length = sizeof(xDeviceCoreCtl);
break;
+ case DEVICE_ENABLE:
+ total_length = sizeof(xDeviceEnableCtl);
+ break;
default:
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
return Success;
@@ -157,6 +160,10 @@ ProcXGetDeviceControl(ClientPtr client)
break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
+ break;
+ case DEVICE_ENABLE:
+ CopySwapDeviceEnable(client, dev, buf);
+ break;
default:
break;
}
@@ -239,6 +246,7 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
c->control = DEVICE_CORE;
c->length = sizeof(c);
c->status = dev->coreEvents;
+ c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
if (client->swapped) {
swaps(&c->control, n);
@@ -247,6 +255,22 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
}
}
+void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
+{
+ register char n;
+ xDeviceEnableState *e = (xDeviceEnableState *) buf;
+
+ e->control = DEVICE_ENABLE;
+ e->length = sizeof(e);
+ e->enable = dev->enabled;
+
+ if (client->swapped) {
+ swaps(&e->control, n);
+ swaps(&e->length, n);
+ swaps(&e->enable, n);
+ }
+}
+
/***********************************************************************
*