summaryrefslogtreecommitdiff
path: root/src/XChgDCtl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/XChgDCtl.c')
-rw-r--r--src/XChgDCtl.c100
1 files changed, 48 insertions, 52 deletions
diff --git a/src/XChgDCtl.c b/src/XChgDCtl.c
index b1fd7a1..be5d941 100644
--- a/src/XChgDCtl.c
+++ b/src/XChgDCtl.c
@@ -62,69 +62,65 @@ SOFTWARE.
#include "XIint.h"
int
-XChangeDeviceControl (dpy, dev, control, d)
- register Display *dpy;
- XDevice *dev;
- int control;
- XDeviceControl *d;
- {
+XChangeDeviceControl(dpy, dev, control, d)
+ register Display *dpy;
+ XDevice *dev;
+ int control;
+ XDeviceControl *d;
+{
int length;
- xChangeDeviceControlReq *req;
- xChangeDeviceControlReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
+ xChangeDeviceControlReq *req;
+ xChangeDeviceControlReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
- LockDisplay (dpy);
+ LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl) == -1)
return (NoSuchExtension);
- GetReq(ChangeDeviceControl,req);
+ GetReq(ChangeDeviceControl, req);
req->reqType = info->codes->major_opcode;
req->ReqType = X_ChangeDeviceControl;
req->deviceid = dev->device_id;
req->control = control;
- switch (control)
- {
- case DEVICE_RESOLUTION:
- {
- XDeviceResolutionControl *R;
- xDeviceResolutionCtl r;
-
- R = (XDeviceResolutionControl *) d;
- r.control = DEVICE_RESOLUTION;
- r.length = sizeof (xDeviceResolutionCtl) +
- R->num_valuators * sizeof(int);
- r.first_valuator = R->first_valuator;
- r.num_valuators = R->num_valuators;
- req->length += ((unsigned)(r.length + 3) >> 2);
- length = sizeof (xDeviceResolutionCtl);
- Data (dpy, (char *) &r, length);
- length = r.num_valuators * sizeof(int);
- Data (dpy, (char *) R->resolutions, length);
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (NoSuchExtension);
- }
- else
- return (rep.status);
- }
- default:
- {
- xDeviceCtl u;
-
- u.control = d->control;
- u.length = d->length - sizeof (int);
- length = ((unsigned)(u.length + 3) >> 2);
- req->length += length;
- length <<= 2;
- Data (dpy, (char *) &u, length);
- }
- }
+ switch (control) {
+ case DEVICE_RESOLUTION:
+ {
+ XDeviceResolutionControl *R;
+ xDeviceResolutionCtl r;
+
+ R = (XDeviceResolutionControl *) d;
+ r.control = DEVICE_RESOLUTION;
+ r.length = sizeof(xDeviceResolutionCtl) +
+ R->num_valuators * sizeof(int);
+ r.first_valuator = R->first_valuator;
+ r.num_valuators = R->num_valuators;
+ req->length += ((unsigned)(r.length + 3) >> 2);
+ length = sizeof(xDeviceResolutionCtl);
+ Data(dpy, (char *)&r, length);
+ length = r.num_valuators * sizeof(int);
+ Data(dpy, (char *)R->resolutions, length);
+ if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (NoSuchExtension);
+ } else
+ return (rep.status);
+ }
+ default:
+ {
+ xDeviceCtl u;
+
+ u.control = d->control;
+ u.length = d->length - sizeof(int);
+ length = ((unsigned)(u.length + 3) >> 2);
+ req->length += length;
+ length <<= 2;
+ Data(dpy, (char *)&u, length);
+ }
+ }
UnlockDisplay(dpy);
SyncHandle();
return (Success);
- }
-
+}