summaryrefslogtreecommitdiff
path: root/src/XChgDCtl.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-07-18 11:43:24 -0400
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-07-18 11:43:24 -0400
commit878d9e76764d27f5af861817b46b2caf2d89d7c4 (patch)
tree4563424795d2208844a44276c4bb9b1f1ea5a5f7 /src/XChgDCtl.c
parent8f0d3c6d1f64fdc3b20d0beb831fa457214d5188 (diff)
add sensible DEVICE_TOUCHSCREEN and DEVICE_CORE controls
Add a more sensible DEVICE_TOUCHSCREEN control, which allows you to clip the x and y values. Add a DEVICE_CORE control, which toggles the sending of core events by extended devices.
Diffstat (limited to 'src/XChgDCtl.c')
-rw-r--r--src/XChgDCtl.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/XChgDCtl.c b/src/XChgDCtl.c
index be5d941..a196523 100644
--- a/src/XChgDCtl.c
+++ b/src/XChgDCtl.c
@@ -92,7 +92,7 @@ XChangeDeviceControl(dpy, dev, control, d)
R = (XDeviceResolutionControl *) d;
r.control = DEVICE_RESOLUTION;
r.length = sizeof(xDeviceResolutionCtl) +
- R->num_valuators * sizeof(int);
+ R->num_valuators * sizeof(int);
r.first_valuator = R->first_valuator;
r.num_valuators = R->num_valuators;
req->length += ((unsigned)(r.length + 3) >> 2);
@@ -107,6 +107,52 @@ XChangeDeviceControl(dpy, dev, control, d)
} else
return (rep.status);
}
+ case DEVICE_TOUCHSCREEN:
+ {
+ XDeviceTSControl *T = (XDeviceTSControl *) d;
+ xDeviceTSCtl t;
+
+ t.control = DEVICE_TOUCHSCREEN;
+ t.length = sizeof(t);
+ t.min_x = T->min_x;
+ t.max_x = T->max_x;
+ t.min_y = T->min_y;
+ t.max_y = T->max_y;
+ t.button_threshold = T->button_threshold;
+
+ req->length += (sizeof(t) + 3) >> 2;
+ Data(dpy, (char *) &t, sizeof(t));
+
+ if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NoSuchExtension;
+ }
+ else {
+ return rep.status;
+ }
+ }
+ case DEVICE_CORE:
+ {
+ XDeviceCoreControl *C = (XDeviceCoreControl *) d;
+ xDeviceCoreCtl c;
+
+ c.control = DEVICE_CORE;
+ c.length = sizeof(c);
+ c.status = C->status;
+
+ req->length += (sizeof(c) + 3) >> 2;
+ Data (dpy, (char *) &c, sizeof(c));
+
+ if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NoSuchExtension;
+ }
+ else {
+ return rep.status;
+ }
+ }
default:
{
xDeviceCtl u;