# On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: src/XChgDCtl.c # modified: src/XGetDCtl.c # diff --git a/src/XChgDCtl.c b/src/XChgDCtl.c index 952164c..3dc3197 100644 --- a/src/XChgDCtl.c +++ b/src/XChgDCtl.c @@ -214,16 +214,53 @@ XChangeDeviceControl(dpy, dev, control, d) return rep.status; } } + case DEVICE_PTRACCEL: + { + XDeviceAccelPredictableControl *A = (XDeviceAccelPredictableControl*) d; + xDeviceAccelPredictableCtl a; + + a.control = DEVICE_PTRACCEL; + a.scheme = A->scheme; + switch(a.scheme){ + case PtrAccelPredictable: + { + a.length = sizeof(xDeviceAccelPredictableCtl); + + int* PI = &A->valid_set; + CARD32 *pi = &a.valid_set, + *end = &a.softening; + while (pi <= end) { + *(pi++) = *(PI++); + } + break; + } + default: + a.length = sizeof(xDeviceAccelCtl); + break; + } + + req->length += (a.length + 3) >> 2; + Data (dpy, (char *) &a, a.length); + + if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return NoSuchExtension; + } else { + UnlockDisplay(dpy); + SyncHandle(); + 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); + Data(dpy, (char *)&u, length); } } diff --git a/src/XGetDCtl.c b/src/XGetDCtl.c index 7689059..56e163d 100644 --- a/src/XGetDCtl.c +++ b/src/XGetDCtl.c @@ -227,6 +227,33 @@ XGetDeviceControl(dpy, dev, control) break; } + case DEVICE_PTRACCEL: + { + /* Since no broken server supports DEVICE_PTRACCEL, we don't need + a case in the switch above this one. + */ + xDeviceAccelPredictableState *a = (xDeviceAccelPredictableState*) d; + XDeviceAccelPredictableState *A = (XDeviceAccelPredictableState*) Device; + + A->control = DEVICE_PTRACCEL; + A->scheme = a->scheme; + switch (a->scheme) { + case PtrAccelPredictable: + { + A->length = sizeof(XDeviceAccelPredictableState); + + int* PI = &A->valid_set; + CARD32 *pi = &a->valid_set, + *end = &a->softening; + while (pi <= end) { + *(PI++) = *(pi++); + } + break; + } + default: + A->length = sizeof(XDeviceAccelState); + } + } default: break; }