summaryrefslogtreecommitdiff
path: root/src/XChgFCtl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/XChgFCtl.c')
-rw-r--r--src/XChgFCtl.c114
1 files changed, 50 insertions, 64 deletions
diff --git a/src/XChgFCtl.c b/src/XChgFCtl.c
index 8f4c009..32c7b24 100644
--- a/src/XChgFCtl.c
+++ b/src/XChgFCtl.c
@@ -62,35 +62,34 @@ SOFTWARE.
#include "XIint.h"
int
-XChangeFeedbackControl (dpy, dev, mask, f)
- register Display *dpy;
- XDevice *dev;
- unsigned long mask;
- XFeedbackControl *f;
- {
+XChangeFeedbackControl(dpy, dev, mask, f)
+ register Display *dpy;
+ XDevice *dev;
+ unsigned long mask;
+ XFeedbackControl *f;
+{
int length;
- xChangeFeedbackControlReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
+ xChangeFeedbackControlReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
- LockDisplay (dpy);
+ LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
return (NoSuchExtension);
- GetReq(ChangeFeedbackControl,req);
+ GetReq(ChangeFeedbackControl, req);
req->reqType = info->codes->major_opcode;
req->ReqType = X_ChangeFeedbackControl;
req->deviceid = dev->device_id;
req->mask = mask;
req->feedbackid = f->class;
- if (f->class == KbdFeedbackClass)
- {
- XKbdFeedbackControl *K;
- xKbdFeedbackCtl k;
+ if (f->class == KbdFeedbackClass) {
+ XKbdFeedbackControl *K;
+ xKbdFeedbackCtl k;
K = (XKbdFeedbackControl *) f;
k.class = KbdFeedbackClass;
- k.length = sizeof (xKbdFeedbackCtl);
+ k.length = sizeof(xKbdFeedbackCtl);
k.id = K->id;
k.click = K->click;
k.percent = K->percent;
@@ -103,16 +102,14 @@ XChangeFeedbackControl (dpy, dev, mask, f)
length = ((unsigned)(k.length + 3) >> 2);
req->length += length;
length <<= 2;
- Data (dpy, (char *) &k, length);
- }
- else if (f->class == PtrFeedbackClass)
- {
- XPtrFeedbackControl *P;
- xPtrFeedbackCtl p;
+ Data(dpy, (char *)&k, length);
+ } else if (f->class == PtrFeedbackClass) {
+ XPtrFeedbackControl *P;
+ xPtrFeedbackCtl p;
P = (XPtrFeedbackControl *) f;
p.class = PtrFeedbackClass;
- p.length = sizeof (xPtrFeedbackCtl);
+ p.length = sizeof(xPtrFeedbackCtl);
p.id = P->id;
p.num = P->accelNum;
p.denom = P->accelDenom;
@@ -120,48 +117,42 @@ XChangeFeedbackControl (dpy, dev, mask, f)
length = ((unsigned)(p.length + 3) >> 2);
req->length += length;
length <<= 2;
- Data (dpy, (char *) &p, length);
- }
- else if (f->class == IntegerFeedbackClass)
- {
- XIntegerFeedbackControl *I;
- xIntegerFeedbackCtl i;
+ Data(dpy, (char *)&p, length);
+ } else if (f->class == IntegerFeedbackClass) {
+ XIntegerFeedbackControl *I;
+ xIntegerFeedbackCtl i;
I = (XIntegerFeedbackControl *) f;
i.class = IntegerFeedbackClass;
- i.length = sizeof (xIntegerFeedbackCtl);
+ i.length = sizeof(xIntegerFeedbackCtl);
i.id = I->id;
i.int_to_display = I->int_to_display;
length = ((unsigned)(i.length + 3) >> 2);
req->length += length;
length <<= 2;
- Data (dpy, (char *) &i, length);
- }
- else if (f->class == StringFeedbackClass)
- {
- XStringFeedbackControl *S;
- xStringFeedbackCtl s;
+ Data(dpy, (char *)&i, length);
+ } else if (f->class == StringFeedbackClass) {
+ XStringFeedbackControl *S;
+ xStringFeedbackCtl s;
S = (XStringFeedbackControl *) f;
s.class = StringFeedbackClass;
- s.length = sizeof (xStringFeedbackCtl) +
- (S->num_keysyms * sizeof (KeySym));
+ s.length = sizeof(xStringFeedbackCtl) +
+ (S->num_keysyms * sizeof(KeySym));
s.id = S->id;
s.num_keysyms = S->num_keysyms;
req->length += ((unsigned)(s.length + 3) >> 2);
- length = sizeof (xStringFeedbackCtl);
- Data (dpy, (char *) &s, length);
- length = (s.num_keysyms * sizeof (KeySym));
- Data (dpy, (char *) S->syms_to_display, length);
- }
- else if (f->class == BellFeedbackClass)
- {
- XBellFeedbackControl *B;
- xBellFeedbackCtl b;
+ length = sizeof(xStringFeedbackCtl);
+ Data(dpy, (char *)&s, length);
+ length = (s.num_keysyms * sizeof(KeySym));
+ Data(dpy, (char *)S->syms_to_display, length);
+ } else if (f->class == BellFeedbackClass) {
+ XBellFeedbackControl *B;
+ xBellFeedbackCtl b;
B = (XBellFeedbackControl *) f;
b.class = BellFeedbackClass;
- b.length = sizeof (xBellFeedbackCtl);
+ b.length = sizeof(xBellFeedbackCtl);
b.id = B->id;
b.percent = B->percent;
b.pitch = B->pitch;
@@ -169,39 +160,34 @@ XChangeFeedbackControl (dpy, dev, mask, f)
length = ((unsigned)(b.length + 3) >> 2);
req->length += length;
length <<= 2;
- Data (dpy, (char *) &b, length);
- }
- else if (f->class == LedFeedbackClass)
- {
- XLedFeedbackControl *L;
- xLedFeedbackCtl l;
+ Data(dpy, (char *)&b, length);
+ } else if (f->class == LedFeedbackClass) {
+ XLedFeedbackControl *L;
+ xLedFeedbackCtl l;
L = (XLedFeedbackControl *) f;
l.class = LedFeedbackClass;
- l.length = sizeof (xLedFeedbackCtl);
+ l.length = sizeof(xLedFeedbackCtl);
l.id = L->id;
l.led_mask = L->led_mask;
l.led_values = L->led_values;
length = ((unsigned)(l.length + 3) >> 2);
req->length += length;
length <<= 2;
- Data (dpy, (char *) &l, length);
- }
- else
- {
- xFeedbackCtl u;
+ Data(dpy, (char *)&l, length);
+ } else {
+ xFeedbackCtl u;
u.class = f->class;
- u.length = f->length - sizeof (int);
+ u.length = f->length - sizeof(int);
u.id = f->id;
length = ((unsigned)(u.length + 3) >> 2);
req->length += length;
length <<= 2;
- Data (dpy, (char *) &u, length);
- }
+ Data(dpy, (char *)&u, length);
+ }
UnlockDisplay(dpy);
SyncHandle();
return (Success);
- }
-
+}