diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-02-15 21:25:27 +0100 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2018-02-26 00:58:46 +0100 |
commit | b0abdf7bd8284b1edf39c13e1863ecc420fd68e4 (patch) | |
tree | 191171d5cfdee1851ad3b5246be6363f9d1f3445 /nx-X11/programs/Xserver | |
parent | 7aca428ffe10b2cffca8fe01962aef421a5a5645 (diff) | |
download | nx-libs-b0abdf7bd8284b1edf39c13e1863ecc420fd68e4.tar.gz nx-libs-b0abdf7bd8284b1edf39c13e1863ecc420fd68e4.tar.bz2 nx-libs-b0abdf7bd8284b1edf39c13e1863ecc420fd68e4.zip |
Xi: reformat
Diffstat (limited to 'nx-X11/programs/Xserver')
37 files changed, 534 insertions, 893 deletions
diff --git a/nx-X11/programs/Xserver/Xi/allowev.c b/nx-X11/programs/Xserver/Xi/allowev.c index 85e3ed979..8981f9142 100644 --- a/nx-X11/programs/Xserver/Xi/allowev.c +++ b/nx-X11/programs/Xserver/Xi/allowev.c @@ -100,15 +100,13 @@ ProcXAllowDeviceEvents(register ClientPtr client) REQUEST_SIZE_MATCH(xAllowDeviceEventsReq); thisdev = LookupDeviceIntRec(stuff->deviceid); - if (thisdev == NULL) - { + if (thisdev == NULL) { SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice); return Success; } time = ClientTimeToServerTime(stuff->time); - switch (stuff->mode) - { + switch (stuff->mode) { case ReplayThisDevice: AllowSome(client, time, thisdev, NOT_GRABBED); break; @@ -128,8 +126,7 @@ ProcXAllowDeviceEvents(register ClientPtr client) AllowSome(client, time, thisdev, THAWED_BOTH); break; default: - SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, - BadValue); + SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadValue); client->errorValue = stuff->mode; return Success; } diff --git a/nx-X11/programs/Xserver/Xi/chgdctl.c b/nx-X11/programs/Xserver/Xi/chgdctl.c index 9f45ddcc8..566df5906 100644 --- a/nx-X11/programs/Xserver/Xi/chgdctl.c +++ b/nx-X11/programs/Xserver/Xi/chgdctl.c @@ -107,8 +107,7 @@ ProcXChangeDeviceControl(ClientPtr client) len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadDevice); return Success; @@ -119,70 +118,55 @@ ProcXChangeDeviceControl(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - switch (stuff->control) - { + switch (stuff->control) { case DEVICE_RESOLUTION: r = (xDeviceResolutionCtl *) & stuff[1]; if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) || - (len != (sizeof(xDeviceResolutionCtl)>>2) + - r->num_valuators)) - { + (len != (sizeof(xDeviceResolutionCtl) >> 2) + r->num_valuators)) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadLength); return Success; } - if (!dev->valuator) - { + if (!dev->valuator) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadMatch); return Success; } - if ((dev->grab) && !SameClient(dev->grab, client)) - { + if ((dev->grab) && !SameClient(dev->grab, client)) { rep.status = AlreadyGrabbed; - WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), - &rep); + WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); return Success; } resolution = (CARD32 *) (r + 1); - if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) - { + if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue); return Success; } status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r); - if (status == Success) - { + if (status == Success) { a = &dev->valuator->axes[r->first_valuator]; for (i = 0; i < r->num_valuators; i++) if (*(resolution + i) < (a + i)->min_resolution || - *(resolution+i) > (a+i)->max_resolution) - { + *(resolution + i) > (a + i)->max_resolution) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue); return Success; } for (i = 0; i < r->num_valuators; i++) (a++)->resolution = *resolution++; - } - else if (status == DeviceBusy) - { + } else if (status == DeviceBusy) { rep.status = DeviceBusy; - WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), - &rep); + WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); return Success; - } - else - { + } else { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadMatch); return Success; } break; default: - SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0, - BadValue); + SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue); return Success; } WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); diff --git a/nx-X11/programs/Xserver/Xi/chgfctl.c b/nx-X11/programs/Xserver/Xi/chgfctl.c index da4111b71..24e30fbe6 100644 --- a/nx-X11/programs/Xserver/Xi/chgfctl.c +++ b/nx-X11/programs/Xserver/Xi/chgfctl.c @@ -109,40 +109,36 @@ ProcXChangeFeedbackControl(ClientPtr client) len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadDevice); return Success; } - switch (stuff->feedbackid) - { + switch (stuff->feedbackid) { case KbdFeedbackClass: - if (len != (sizeof(xKbdFeedbackCtl)>>2)) - { + if (len != (sizeof(xKbdFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (k = dev->kbdfeed; k; k = k->next) - if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id) - { - ChangeKbdFeedback (client, dev, stuff->mask, k, (xKbdFeedbackCtl *)&stuff[1]); + if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) { + ChangeKbdFeedback(client, dev, stuff->mask, k, + (xKbdFeedbackCtl *) & stuff[1]); return Success; } break; case PtrFeedbackClass: - if (len != (sizeof(xPtrFeedbackCtl)>>2)) - { + if (len != (sizeof(xPtrFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (p = dev->ptrfeed; p; p = p->next) - if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id) - { - ChangePtrFeedback (client, dev, stuff->mask, p, (xPtrFeedbackCtl *)&stuff[1]); + if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) { + ChangePtrFeedback(client, dev, stuff->mask, p, + (xPtrFeedbackCtl *) & stuff[1]); return Success; } break; @@ -155,59 +151,55 @@ ProcXChangeFeedbackControl(ClientPtr client) return BadLength; swaps(&f->num_keysyms); } - if (len != ((sizeof(xStringFeedbackCtl)>>2) + f->num_keysyms)) - { + if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (s = dev->stringfeed; s; s = s->next) - if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id) - { - ChangeStringFeedback (client, dev, stuff->mask,s,(xStringFeedbackCtl *)&stuff[1]); + if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) { + ChangeStringFeedback(client, dev, stuff->mask, s, + (xStringFeedbackCtl *) & stuff[1]); return Success; } break; } case IntegerFeedbackClass: - if (len != (sizeof(xIntegerFeedbackCtl)>>2)) - { + if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (i = dev->intfeed; i; i = i->next) - if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id) - { - ChangeIntegerFeedback (client, dev,stuff->mask,i,(xIntegerFeedbackCtl *)&stuff[1]); + if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) { + ChangeIntegerFeedback(client, dev, stuff->mask, i, + (xIntegerFeedbackCtl *) & stuff[1]); return Success; } break; case LedFeedbackClass: - if (len != (sizeof(xLedFeedbackCtl)>>2)) - { + if (len != (sizeof(xLedFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (l = dev->leds; l; l = l->next) - if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id) - { - ChangeLedFeedback (client, dev, stuff->mask, l, (xLedFeedbackCtl *)&stuff[1]); + if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) { + ChangeLedFeedback(client, dev, stuff->mask, l, + (xLedFeedbackCtl *) & stuff[1]); return Success; } break; case BellFeedbackClass: - if (len != (sizeof(xBellFeedbackCtl)>>2)) - { + if (len != (sizeof(xBellFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (b = dev->bell; b; b = b->next) - if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id) - { - ChangeBellFeedback (client, dev, stuff->mask, b, (xBellFeedbackCtl *)&stuff[1]); + if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) { + ChangeBellFeedback(client, dev, stuff->mask, b, + (xBellFeedbackCtl *) & stuff[1]); return Success; } break; @@ -233,8 +225,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, int t; int key = DO_ALL; - if (client->swapped) - { + if (client->swapped) { swaps(&f->length); swaps(&f->pitch); swaps(&f->duration); @@ -243,13 +234,11 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, } kctrl = k->ctrl; - if (mask & DvKeyClickPercent) - { + if (mask & DvKeyClickPercent) { t = f->click; if (t == -1) t = defaultKeyboardControl.click; - else if (t < 0 || t > 100) - { + else if (t < 0 || t > 100) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); @@ -258,13 +247,11 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, kctrl.click = t; } - if (mask & DvPercent) - { + if (mask & DvPercent) { t = f->percent; if (t == -1) t = defaultKeyboardControl.bell; - else if (t < 0 || t > 100) - { + else if (t < 0 || t > 100) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); @@ -273,13 +260,11 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, kctrl.bell = t; } - if (mask & DvPitch) - { + if (mask & DvPitch) { t = f->pitch; if (t == -1) t = defaultKeyboardControl.bell_pitch; - else if (t < 0) - { + else if (t < 0) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); @@ -288,13 +273,11 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, kctrl.bell_pitch = t; } - if (mask & DvDuration) - { + if (mask & DvDuration) { t = f->duration; if (t == -1) t = defaultKeyboardControl.bell_duration; - else if (t < 0) - { + else if (t < 0) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); @@ -303,51 +286,41 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, kctrl.bell_duration = t; } - if (mask & DvLed) - { + if (mask & DvLed) { kctrl.leds &= ~(f->led_mask); kctrl.leds |= (f->led_mask & f->led_values); } - if (mask & DvKey) - { + if (mask & DvKey) { key = (KeyCode) f->key; - if (key < 8 || key > 255) - { + if (key < 8 || key > 255) { client->errorValue = key; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } - if (!(mask & DvAutoRepeatMode)) - { + if (!(mask & DvAutoRepeatMode)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); return Success; } } - if (mask & DvAutoRepeatMode) - { + if (mask & DvAutoRepeatMode) { int inx = (key >> 3); int kmask = (1 << (key & 7)); t = (CARD8) f->auto_repeat_mode; - if (t == AutoRepeatModeOff) - { + if (t == AutoRepeatModeOff) { if (key == DO_ALL) kctrl.autoRepeat = FALSE; else kctrl.autoRepeats[inx] &= ~kmask; - } - else if (t == AutoRepeatModeOn) - { + } else if (t == AutoRepeatModeOn) { if (key == DO_ALL) kctrl.autoRepeat = TRUE; else kctrl.autoRepeats[inx] |= kmask; - } - else if (t == AutoRepeatModeDefault) - { + } else if (t == AutoRepeatModeDefault) { if (key == DO_ALL) kctrl.autoRepeat = defaultKeyboardControl.autoRepeat; else @@ -355,9 +328,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, kctrl.autoRepeats[inx] = (kctrl.autoRepeats[inx] & ~kmask) | (defaultKeyboardControl.autoRepeats[inx] & kmask); - } - else - { + } else { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); @@ -382,8 +353,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, { PtrCtrl pctrl; /* might get BadValue part way through */ - if (client->swapped) - { + if (client->swapped) { swaps(&f->length); swaps(&f->num); swaps(&f->denom); @@ -391,55 +361,49 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, } pctrl = p->ctrl; - if (mask & DvAccelNum) - { + if (mask & DvAccelNum) { int accelNum; accelNum = f->num; if (accelNum == -1) pctrl.num = defaultPointerControl.num; - else if (accelNum < 0) - { + else if (accelNum < 0) { client->errorValue = accelNum; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; - } - else pctrl.num = accelNum; + } else + pctrl.num = accelNum; } - if (mask & DvAccelDenom) - { + if (mask & DvAccelDenom) { int accelDenom; accelDenom = f->denom; if (accelDenom == -1) pctrl.den = defaultPointerControl.den; - else if (accelDenom <= 0) - { + else if (accelDenom <= 0) { client->errorValue = accelDenom; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; - } - else pctrl.den = accelDenom; + } else + pctrl.den = accelDenom; } - if (mask & DvThreshold) - { + if (mask & DvThreshold) { int threshold; threshold = f->thresh; if (threshold == -1) pctrl.threshold = defaultPointerControl.threshold; - else if (threshold < 0) - { + else if (threshold < 0) { client->errorValue = threshold; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; - } - else pctrl.threshold = threshold; + } else + pctrl.threshold = threshold; } p->ctrl = pctrl; @@ -483,26 +447,22 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, KeySym *syms, *sup_syms; syms = (KeySym *) (f + 1); - if (client->swapped) - { + if (client->swapped) { swaps(&f->length); /* swapped num_keysyms in calling proc */ SwapLongs((CARD32 *) syms, f->num_keysyms); } - if (f->num_keysyms > s->ctrl.max_symbols) - { + if (f->num_keysyms > s->ctrl.max_symbols) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } sup_syms = s->ctrl.symbols_supported; - for (i=0; i<f->num_keysyms; i++) - { + for (i = 0; i < f->num_keysyms; i++) { for (j = 0; j < s->ctrl.num_symbols_supported; j++) if (*(syms + i) == *(sup_syms + j)) break; - if (j==s->ctrl.num_symbols_supported) - { + if (j == s->ctrl.num_symbols_supported) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); return Success; @@ -530,21 +490,18 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, int t; BellCtrl bctrl; /* might get BadValue part way through */ - if (client->swapped) - { + if (client->swapped) { swaps(&f->length); swaps(&f->pitch); swaps(&f->duration); } bctrl = b->ctrl; - if (mask & DvPercent) - { + if (mask & DvPercent) { t = f->percent; if (t == -1) t = defaultKeyboardControl.bell; - else if (t < 0 || t > 100) - { + else if (t < 0 || t > 100) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); @@ -553,13 +510,11 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, bctrl.percent = t; } - if (mask & DvPitch) - { + if (mask & DvPitch) { t = f->pitch; if (t == -1) t = defaultKeyboardControl.bell_pitch; - else if (t < 0) - { + else if (t < 0) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); @@ -568,13 +523,11 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, bctrl.pitch = t; } - if (mask & DvDuration) - { + if (mask & DvDuration) { t = f->duration; if (t == -1) t = defaultKeyboardControl.bell_duration; - else if (t < 0) - { + else if (t < 0) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); @@ -599,8 +552,7 @@ ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, { LedCtrl lctrl; /* might get BadValue part way through */ - if (client->swapped) - { + if (client->swapped) { swaps(&f->length); swapl(&f->led_values); swapl(&f->led_mask); @@ -608,8 +560,7 @@ ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, f->led_mask &= l->ctrl.led_mask; /* set only supported leds */ f->led_values &= l->ctrl.led_mask; /* set only supported leds */ - if (mask & DvLed) - { + if (mask & DvLed) { lctrl.led_mask = f->led_mask; lctrl.led_values = f->led_values; (*l->CtrlProc) (dev, &lctrl); diff --git a/nx-X11/programs/Xserver/Xi/chgkbd.c b/nx-X11/programs/Xserver/Xi/chgkbd.c index a74fe6929..4e8b5ee70 100644 --- a/nx-X11/programs/Xserver/Xi/chgkbd.c +++ b/nx-X11/programs/Xserver/Xi/chgkbd.c @@ -114,8 +114,7 @@ ProcXChangeKeyboardDevice(register ClientPtr client) rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { rep.status = -1; SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, BadDevice); @@ -123,8 +122,7 @@ ProcXChangeKeyboardDevice(register ClientPtr client) } k = dev->key; - if (k == NULL) - { + if (k == NULL) { rep.status = -1; SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, BadMatch); @@ -139,10 +137,8 @@ ProcXChangeKeyboardDevice(register ClientPtr client) (xkbd->sync.frozen && xkbd->sync.other && !SameClient(xkbd->sync.other, client))) rep.status = GrabFrozen; - else - { - if (ChangeKeyboardDevice (xkbd, dev) != Success) - { + else { + if (ChangeKeyboardDevice(xkbd, dev) != Success) { SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, BadDevice); return Success; @@ -157,11 +153,11 @@ ProcXChangeKeyboardDevice(register ClientPtr client) df->revert = xf->revert; df->time = xf->time; df->traceGood = xf->traceGood; - if (df->traceSize != xf->traceSize) - { + if (df->traceSize != xf->traceSize) { Must_have_memory = TRUE; /* XXX */ df->trace = (WindowPtr *) realloc(df->trace, - xf->traceSize * sizeof(WindowPtr)); + xf->traceSize * + sizeof(WindowPtr)); Must_have_memory = FALSE; /* XXX */ } df->traceSize = xf->traceSize; @@ -177,13 +173,13 @@ ProcXChangeKeyboardDevice(register ClientPtr client) SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1); SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode, - k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client); + k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + + 1, client); rep.status = 0; } - WriteReplyToClient (client, sizeof (xChangeKeyboardDeviceReply), - &rep); + WriteReplyToClient(client, sizeof(xChangeKeyboardDeviceReply), &rep); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/chgkmap.c b/nx-X11/programs/Xserver/Xi/chgkmap.c index 82054e8df..604fcd9cf 100644 --- a/nx-X11/programs/Xserver/Xi/chgkmap.c +++ b/nx-X11/programs/Xserver/Xi/chgkmap.c @@ -109,8 +109,7 @@ ProcXChangeDeviceKeyMapping(register ClientPtr client) REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32)); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0, BadDevice); return Success; @@ -118,11 +117,10 @@ ProcXChangeDeviceKeyMapping(register ClientPtr client) len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2); ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify, - stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode, - (KeySym *)&stuff[1]); + stuff->firstKeyCode, stuff->keyCodes, + stuff->keySymsPerKeyCode, (KeySym *) & stuff[1]); if (ret != Success) - SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0, - ret); + SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0, ret); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/chgprop.c b/nx-X11/programs/Xserver/Xi/chgprop.c index 4c55f5508..bdff7ceee 100644 --- a/nx-X11/programs/Xserver/Xi/chgprop.c +++ b/nx-X11/programs/Xserver/Xi/chgprop.c @@ -108,24 +108,21 @@ ProcXChangeDeviceDontPropagateList(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq); if (stuff->length != (sizeof(xChangeDeviceDontPropagateListReq) >> 2) + - stuff->count) - { + stuff->count) { SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, BadLength); return Success; } pWin = (WindowPtr) LookupWindow(stuff->window, client); - if (!pWin) - { + if (!pWin) { client->errorValue = stuff->window; SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, BadWindow); return Success; } - if (stuff->mode != AddToList && stuff->mode != DeleteFromList) - { + if (stuff->mode != AddToList && stuff->mode != DeleteFromList) { client->errorValue = stuff->window; SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, BadMode); @@ -133,14 +130,14 @@ ProcXChangeDeviceDontPropagateList(register ClientPtr client) } if (CreateMaskFromList(client, (XEventClass *) & stuff[1], - stuff->count, tmp, NULL, X_ChangeDeviceDontPropagateList) != Success) + stuff->count, tmp, NULL, + X_ChangeDeviceDontPropagateList) != Success) return Success; others = wOtherInputMasks(pWin); if (!others && stuff->mode == DeleteFromList) return Success; - for (i=0; i<EMASKSIZE; i++) - { + for (i = 0; i < EMASKSIZE; i++) { if (tmp[i].mask == 0) continue; @@ -149,10 +146,10 @@ ProcXChangeDeviceDontPropagateList(register ClientPtr client) else if (others) tmp[i].mask |= others->dontPropagateMask[i]; - if (DeviceEventSuppressForWindow (pWin,client,tmp[i].mask,i) != Success) - { - SendErrorToClient ( client, IReqCode, X_ChangeDeviceDontPropagateList, 0, - BadClass); + if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) != + Success) { + SendErrorToClient(client, IReqCode, + X_ChangeDeviceDontPropagateList, 0, BadClass); return Success; } } diff --git a/nx-X11/programs/Xserver/Xi/chgptr.c b/nx-X11/programs/Xserver/Xi/chgptr.c index 978a6b339..af2625f49 100644 --- a/nx-X11/programs/Xserver/Xi/chgptr.c +++ b/nx-X11/programs/Xserver/Xi/chgptr.c @@ -113,8 +113,7 @@ ProcXChangePointerDevice(register ClientPtr client) rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { rep.status = -1; SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadDevice); @@ -123,9 +122,7 @@ ProcXChangePointerDevice(register ClientPtr client) v = dev->valuator; if (v == NULL || v->numAxes < 2 || - stuff->xaxis >= v->numAxes || - stuff->yaxis >= v->numAxes) - { + stuff->xaxis >= v->numAxes || stuff->yaxis >= v->numAxes) { rep.status = -1; SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch); return Success; @@ -139,11 +136,9 @@ ProcXChangePointerDevice(register ClientPtr client) (xptr->sync.frozen && xptr->sync.other && !SameClient(xptr->sync.other, client))) rep.status = GrabFrozen; - else - { - if (ChangePointerDevice ( - xptr, dev, stuff->xaxis, stuff->yaxis) != Success) - { + else { + if (ChangePointerDevice(xptr, dev, stuff->xaxis, stuff->yaxis) != + Success) { SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadDevice); return Success; @@ -168,8 +163,7 @@ ProcXChangePointerDevice(register ClientPtr client) rep.status = 0; } - WriteReplyToClient (client, sizeof (xChangePointerDeviceReply), - &rep); + WriteReplyToClient(client, sizeof(xChangePointerDeviceReply), &rep); return Success; } @@ -193,8 +187,7 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) int i; WindowPtr pWin, p1; - for (i=0; i<screenInfo.numScreens; i++) - { + for (i = 0; i < screenInfo.numScreens; i++) { pWin = screenInfo.screens[i]->root; (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id); p1 = pWin->firstChild; @@ -215,8 +208,7 @@ FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, { WindowPtr p2; - while (p1) - { + while (p1) { p2 = p1->firstChild; (void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id); FindInterestedChildren(dev, p2, mask, ev, count); diff --git a/nx-X11/programs/Xserver/Xi/closedev.c b/nx-X11/programs/Xserver/Xi/closedev.c index 48a743aca..b41474e70 100644 --- a/nx-X11/programs/Xserver/Xi/closedev.c +++ b/nx-X11/programs/Xserver/Xi/closedev.c @@ -101,8 +101,7 @@ ProcXCloseDevice(register ClientPtr client) REQUEST_SIZE_MATCH(xCloseDeviceReq); d = LookupDeviceIntRec(stuff->deviceid); - if (d == NULL) - { + if (d == NULL) { SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice); return Success; } @@ -111,11 +110,10 @@ ProcXCloseDevice(register ClientPtr client) (*d->DeactivateGrab) (d); /* release active grab */ /* Remove event selections from all windows for events from this device - and selected by this client. - Delete passive grabs from all windows for this device. */ + * and selected by this client. + * Delete passive grabs from all windows for this device. */ - for (i=0; i<screenInfo.numScreens; i++) - { + for (i = 0; i < screenInfo.numScreens; i++) { pWin = screenInfo.screens[i]->root; DeleteDeviceEvents(d, pWin, client); p1 = pWin->firstChild; @@ -138,8 +136,7 @@ DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) { WindowPtr p2; - while (p1) - { + while (p1) { p2 = p1->firstChild; DeleteDeviceEvents(dev, p1, client); DeleteEventsFromChildren(dev, p2, client); @@ -162,13 +159,11 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) GrabPtr grab, next; if ((pOthers = wOtherInputMasks(pWin)) != 0) - for (others=pOthers->inputClients; others; - others = others->next) + for (others = pOthers->inputClients; others; others = others->next) if (SameClient(others, client)) others->mask[dev->id] = NoEventMask; - for (grab = wPassiveGrabs(pWin); grab; grab=next) - { + for (grab = wPassiveGrabs(pWin); grab; grab = next) { next = grab->next; if ((grab->device == dev) && (client->clientAsMask == CLIENT_BITS(grab->resource))) diff --git a/nx-X11/programs/Xserver/Xi/devbell.c b/nx-X11/programs/Xserver/Xi/devbell.c index 8738436b8..f594e7f36 100644 --- a/nx-X11/programs/Xserver/Xi/devbell.c +++ b/nx-X11/programs/Xserver/Xi/devbell.c @@ -103,26 +103,22 @@ ProcXDeviceBell(register ClientPtr client) REQUEST_SIZE_MATCH(xDeviceBellReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { client->errorValue = stuff->deviceid; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice); return Success; } - if (stuff->percent < -100 || stuff->percent > 100) - { + if (stuff->percent < -100 || stuff->percent > 100) { client->errorValue = stuff->percent; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); return Success; } - if (stuff->feedbackclass == KbdFeedbackClass) - { + if (stuff->feedbackclass == KbdFeedbackClass) { for (k = dev->kbdfeed; k; k = k->next) if (k->ctrl.id == stuff->feedbackid) break; - if (!k) - { + if (!k) { client->errorValue = stuff->feedbackid; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); return Success; @@ -131,14 +127,11 @@ ProcXDeviceBell(register ClientPtr client) proc = k->BellProc; ctrl = (void *)&(k->ctrl); class = KbdFeedbackClass; - } - else if (stuff->feedbackclass == BellFeedbackClass) - { + } else if (stuff->feedbackclass == BellFeedbackClass) { for (b = dev->bell; b; b = b->next) if (b->ctrl.id == stuff->feedbackid) break; - if (!b) - { + if (!b) { client->errorValue = stuff->feedbackid; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); return Success; @@ -147,9 +140,7 @@ ProcXDeviceBell(register ClientPtr client) proc = b->BellProc; ctrl = (void *)&(b->ctrl); class = BellFeedbackClass; - } - else - { + } else { client->errorValue = stuff->feedbackclass; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); return Success; diff --git a/nx-X11/programs/Xserver/Xi/exevents.c b/nx-X11/programs/Xserver/Xi/exevents.c index 07d6eac57..7fd779aff 100644 --- a/nx-X11/programs/Xserver/Xi/exevents.c +++ b/nx-X11/programs/Xserver/Xi/exevents.c @@ -128,28 +128,29 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) inputInfo.pointer->button->state; bit = 1 << (key & 7); } - if (DeviceEventCallback) - { + if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; eventinfo.events = (xEventPtr) xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); } for (i = 1; i < count; i++) - if ((++xV)->type == DeviceValuator) - { + if ((++xV)->type == DeviceValuator) { int first = xV->first_valuator; int *axisvals; - if (xV->num_valuators && (!v || (xV->num_valuators && (first + xV->num_valuators > v->numAxes)))) - FatalError("Bad valuators reported for device %s\n",other->name); + if (xV->num_valuators + && (!v + || (xV->num_valuators + && (first + xV->num_valuators > v->numAxes)))) + FatalError("Bad valuators reported for device %s\n", + other->name); xV->device_state = 0; if (k) xV->device_state |= k->state; if (b) xV->device_state |= b->state; - if (v && v->axisVal) - { + if (v && v->axisVal) { axisvals = v->axisVal; switch (xV->num_valuators) { case 6: @@ -171,14 +172,11 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) } } - if (xE->u.u.type == DeviceKeyPress) - { + if (xE->u.u.type == DeviceKeyPress) { modifiers = k->modifierMap[key]; kptr = &k->down[key >> 3]; - if (*kptr & bit) /* allow ddx to generate multiple downs */ - { - if (!modifiers) - { + if (*kptr & bit) { /* allow ddx to generate multiple downs */ + if (!modifiers) { xE->u.u.type = DeviceKeyRelease; ProcessOtherEvent(xE, other, count); xE->u.u.type = DeviceKeyPress; @@ -191,24 +189,19 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) other->valuator->motionHintWindow = NullWindow; *kptr |= bit; k->prev_state = k->state; - for (i = 0, mask = 1; modifiers; i++, mask <<= 1) - { - if (mask & modifiers) - { + for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { + if (mask & modifiers) { /* This key affects modifier "i" */ k->modifierKeyCount[i]++; k->state |= mask; modifiers &= ~mask; } } - if (!grab && CheckDeviceGrabs(other, xE, 0, count)) - { + if (!grab && CheckDeviceGrabs(other, xE, 0, count)) { other->activatingKey = key; return; } - } - else if (xE->u.u.type == DeviceKeyRelease) - { + } else if (xE->u.u.type == DeviceKeyRelease) { kptr = &k->down[key >> 3]; if (!(*kptr & bit)) /* guard against duplicates */ return; @@ -217,13 +210,10 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) other->valuator->motionHintWindow = NullWindow; *kptr &= ~bit; k->prev_state = k->state; - for (i = 0, mask = 1; modifiers; i++, mask <<= 1) - { - if (mask & modifiers) - { + for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { + if (mask & modifiers) { /* This key affects modifier "i" */ - if (--k->modifierKeyCount[i] <= 0) - { + if (--k->modifierKeyCount[i] <= 0) { k->modifierKeyCount[i] = 0; k->state &= ~mask; } @@ -233,9 +223,7 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) if (other->fromPassiveGrab && (key == other->activatingKey)) deactivateDeviceGrab = TRUE; - } - else if (xE->u.u.type == DeviceButtonPress) - { + } else if (xE->u.u.type == DeviceButtonPress) { kptr = &b->down[key >> 3]; *kptr |= bit; if (other->valuator) @@ -252,9 +240,7 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) if (CheckDeviceGrabs(other, xE, 0, count)) return; - } - else if (xE->u.u.type == DeviceButtonRelease) - { + } else if (xE->u.u.type == DeviceButtonRelease) { kptr = &b->down[key >> 3]; *kptr &= ~bit; if (other->valuator) @@ -269,8 +255,7 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify); if (!b->state && other->fromPassiveGrab) deactivateDeviceGrab = TRUE; - } - else if (xE->u.u.type == ProximityIn) + } else if (xE->u.u.type == ProximityIn) other->valuator->mode &= ~OutOfProximity; else if (xE->u.u.type == ProximityOut) other->valuator->mode |= OutOfProximity; @@ -328,8 +313,7 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, ev->classes_reported |= (1 << ButtonClass); ev->num_buttons = b->numButtons; memmove((char *)&ev->buttons[0], (char *)b->down, 4); - } - else if (k) { + } else if (k) { ev->classes_reported |= (1 << KeyClass); ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode; memmove((char *)&ev->keys[0], (char *)k->down, 4); @@ -339,8 +323,7 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, ev->classes_reported |= (1 << ValuatorClass); ev->classes_reported |= (dev->valuator->mode << ModeBitsShift); ev->num_valuators = nval < 3 ? nval : 3; - switch (ev->num_valuators) - { + switch (ev->num_valuators) { case 3: ev->valuator2 = v->axisVal[first + 2]; case 2: @@ -505,25 +488,20 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, GrabPtr grab; if ((this_device_mode != GrabModeSync) && - (this_device_mode != GrabModeAsync)) - { + (this_device_mode != GrabModeAsync)) { client->errorValue = this_device_mode; return BadValue; } if ((other_devices_mode != GrabModeSync) && - (other_devices_mode != GrabModeAsync)) - { + (other_devices_mode != GrabModeAsync)) { client->errorValue = other_devices_mode; return BadValue; } - if ((modifiers != AnyModifier) && - (modifiers & ~AllModifiersMask)) - { + if ((modifiers != AnyModifier) && (modifiers & ~AllModifiersMask)) { client->errorValue = modifiers; return BadValue; } - if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) - { + if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) { client->errorValue = ownerEvents; return BadValue; } @@ -532,28 +510,25 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, return BadWindow; if (rconfineTo == None) confineTo = NullWindow; - else - { + else { confineTo = LookupWindow(rconfineTo, client); if (!confineTo) return BadWindow; } if (rcursor == None) cursor = NullCursor; - else - { + else { cursor = (CursorPtr) LookupIDByType(rcursor, RT_CURSOR); - if (!cursor) - { + if (!cursor) { client->errorValue = rcursor; return BadCursor; } } grab = CreateGrab(client->index, dev, pWin, eventMask, - (Bool)ownerEvents, (Bool) this_device_mode, (Bool)other_devices_mode, - modifier_device, modifiers, DeviceButtonPress, button, confineTo, - cursor); + (Bool) ownerEvents, (Bool) this_device_mode, + (Bool) other_devices_mode, modifier_device, modifiers, + DeviceButtonPress, button, confineTo, cursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(grab); @@ -572,32 +547,25 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, if (k == NULL) return BadMatch; if ((other_devices_mode != GrabModeSync) && - (other_devices_mode != GrabModeAsync)) - { + (other_devices_mode != GrabModeAsync)) { client->errorValue = other_devices_mode; return BadValue; } if ((this_device_mode != GrabModeSync) && - (this_device_mode != GrabModeAsync)) - { + (this_device_mode != GrabModeAsync)) { client->errorValue = this_device_mode; return BadValue; } - if (((key > k->curKeySyms.maxKeyCode) || - (key < k->curKeySyms.minKeyCode)) - && (key != AnyKey)) - { + if (((key > k->curKeySyms.maxKeyCode) || (key < k->curKeySyms.minKeyCode)) + && (key != AnyKey)) { client->errorValue = key; return BadValue; } - if ((modifiers != AnyModifier) && - (modifiers & ~AllModifiersMask)) - { + if ((modifiers != AnyModifier) && (modifiers & ~AllModifiersMask)) { client->errorValue = modifiers; return BadValue; } - if ((ownerEvents != xTrue) && (ownerEvents != xFalse)) - { + if ((ownerEvents != xTrue) && (ownerEvents != xFalse)) { client->errorValue = ownerEvents; return BadValue; } @@ -607,8 +575,8 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, grab = CreateGrab(client->index, dev, pWin, mask, ownerEvents, this_device_mode, other_devices_mode, - modifier_device, modifiers, DeviceKeyPress, key, NullWindow, - NullCursor); + modifier_device, modifiers, DeviceKeyPress, key, + NullWindow, NullCursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(grab); @@ -623,43 +591,35 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client, Mask check; InputClientsPtr others; - if (mask & ~validmasks) - { + if (mask & ~validmasks) { client->errorValue = mask; return BadValue; } check = (mask & exclusivemasks); - if (wOtherInputMasks(pWin)) - { - if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) - { /* It is illegal for two different - clients to select on any of the - events for maskcheck. However, - it is OK, for some client to - continue selecting on one of those - events. */ + if (wOtherInputMasks(pWin)) { + if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) { /* It is illegal for two different + * clients to select on any of the + * events for maskcheck. However, + * it is OK, for some client to + * continue selecting on one of those + * events. */ for (others = wOtherInputMasks(pWin)->inputClients; others; - others = others->next) - { + others = others->next) { if (!SameClient(others, client) && (check & others->mask[mskidx])) return BadAccess; } } for (others = wOtherInputMasks(pWin)->inputClients; others; - others = others->next) - { - if (SameClient(others, client)) - { + others = others->next) { + if (SameClient(others, client)) { check = others->mask[mskidx]; others->mask[mskidx] = mask; - if (mask == 0) - { + if (mask == 0) { for (i = 0; i < EMASKSIZE; i++) if (i != mskidx && others->mask[i] != 0) break; - if (i == EMASKSIZE) - { + if (i == EMASKSIZE) { RecalculateDeviceDeliverableEvents(pWin); if (ShouldFreeInputMasks(pWin, FALSE)) FreeResource(others->resource, RT_NONE); @@ -728,13 +688,10 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin) int i; pChild = pWin; - while (1) - { - if ((inputMasks = wOtherInputMasks(pChild)) != 0) - { + while (1) { + if ((inputMasks = wOtherInputMasks(pChild)) != 0) { for (others = inputMasks->inputClients; others; - others = others->next) - { + others = others->next) { for (i = 0; i < EMASKSIZE; i++) inputMasks->inputEvents[i] |= others->mask[i]; } @@ -745,10 +702,10 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin) for (i = 0; i < EMASKSIZE; i++) inputMasks->deliverableEvents[i] |= (wOtherInputMasks(tmp)->deliverableEvents[i] - & ~inputMasks->dontPropagateMask[i] & PropagateMask[i]); + & ~inputMasks-> + dontPropagateMask[i] & PropagateMask[i]); } - if (pChild->firstChild) - { + if (pChild->firstChild) { pChild = pChild->firstChild; continue; } @@ -768,35 +725,25 @@ InputClientGone(register WindowPtr pWin, XID id) return (Success); prev = 0; for (other = wOtherInputMasks(pWin)->inputClients; other; - other = other->next) - { - if (other->resource == id) - { - if (prev) - { + other = other->next) { + if (other->resource == id) { + if (prev) { prev->next = other->next; free(other); - } - else if (!(other->next)) - { - if (ShouldFreeInputMasks(pWin, TRUE)) - { + } else if (!(other->next)) { + if (ShouldFreeInputMasks(pWin, TRUE)) { wOtherInputMasks(pWin)->inputClients = other->next; free(wOtherInputMasks(pWin)); pWin->optional->inputMasks = (OtherInputMasks *) NULL; CheckWindowOptionalNeed(pWin); free(other); - } - else - { + } else { other->resource = FakeClientID(0); if (!AddResource(other->resource, RT_INPUTCLIENT, (void *) pWin)) return BadAlloc; } - } - else - { + } else { wOtherInputMasks(pWin)->inputClients = other->next; free(other); } @@ -819,8 +766,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, if (dest == PointerWindow) pWin = spriteWin; - else if (dest == InputFocus) - { + else if (dest == InputFocus) { WindowPtr inputFocus; if (!d->focus) @@ -835,32 +781,26 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, return Success; /* If the input focus is PointerRootWin, send the event to where - the pointer is if possible, then perhaps propogate up to root. */ + * the pointer is if possible, then perhaps propogate up to root. */ if (inputFocus == PointerRootWin) inputFocus = GetCurrentRootWindow(); - if (IsParent(inputFocus, spriteWin)) - { + if (IsParent(inputFocus, spriteWin)) { effectiveFocus = inputFocus; pWin = spriteWin; - } - else + } else effectiveFocus = pWin = inputFocus; - } - else + } else pWin = LookupWindow(dest, client); if (!pWin) return BadWindow; - if ((propagate != xFalse) && (propagate != xTrue)) - { + if ((propagate != xFalse) && (propagate != xTrue)) { client->errorValue = propagate; return BadValue; } ev->u.u.type |= 0x80; - if (propagate) - { - for (;pWin; pWin = pWin->parent) - { + if (propagate) { + for (; pWin; pWin = pWin->parent) { if (DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id)) return Success; if (pWin == effectiveFocus) @@ -870,8 +810,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, if (!mask) break; } - } - else + } else (void)(DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id)); return Success; } @@ -885,16 +824,14 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map) if (b == NULL) return BadMatch; - if (nElts != b->numButtons) - { + if (nElts != b->numButtons) { client->errorValue = nElts; return BadValue; } if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue)) return BadValue; for (i = 0; i < nElts; i++) - if ((b->map[i + 1] != map[i]) && - BitIsOn(b->down, i + 1)) + if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1)) return MappingBusy; for (i = 0; i < nElts; i++) b->map[i + 1] = map[i]; @@ -938,10 +875,11 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen, * that the DDX layer likes the choice. */ if (!AllModifierKeysAreUp(dev, (*k)->modifierKeyMap, - (int)(*k)->maxKeysPerModifier, inputMap, (int)numKeyPerModifier) - || - !AllModifierKeysAreUp(dev, inputMap, (int)numKeyPerModifier, - (*k)->modifierKeyMap, (int)(*k)->maxKeysPerModifier)) { + (int)(*k)->maxKeysPerModifier, inputMap, + (int)numKeyPerModifier) + || !AllModifierKeysAreUp(dev, inputMap, (int)numKeyPerModifier, + (*k)->modifierKeyMap, + (int)(*k)->maxKeysPerModifier)) { return MappingBusy; } else { for (i = 0; i < inputMapLen; i++) { @@ -971,7 +909,8 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen, (*k)->maxKeysPerModifier = numKeyPerModifier; for (i = 0; i < MAP_LENGTH; i++) (*k)->modifierMap[i] = 0; - for (i = 0; i < inputMapLen; i++) if (inputMap[i]) { + for (i = 0; i < inputMapLen; i++) + if (inputMap[i]) { (*k)->modifierMap[inputMap[i]] |= (1 << (i / (*k)->maxKeysPerModifier)); } @@ -990,8 +929,7 @@ SendDeviceMappingNotify(CARD8 request, ev->request = request; ev->deviceid = dev->id; ev->time = currentTime.milliseconds; - if (request == MappingKeyboard) - { + if (request == MappingKeyboard) { ev->firstKeyCode = firstKeyCode; ev->count = count; } @@ -1017,13 +955,11 @@ ChangeKeyMapping(ClientPtr client, return BadLength; if ((firstKeyCode < k->curKeySyms.minKeyCode) || - (firstKeyCode + keyCodes - 1 > k->curKeySyms.maxKeyCode)) - { + (firstKeyCode + keyCodes - 1 > k->curKeySyms.maxKeyCode)) { client->errorValue = firstKeyCode; return BadValue; } - if (keySymsPerKeyCode == 0) - { + if (keySymsPerKeyCode == 0) { client->errorValue = 0; return BadValue; } @@ -1033,8 +969,7 @@ ChangeKeyMapping(ClientPtr client, keysyms.map = map; if (!SetKeySymsMap(&k->curKeySyms, &keysyms)) return BadAlloc; - SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes, - dev); + SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes, dev); return client->noClientException; } @@ -1046,10 +981,8 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) InputClientsPtr ic; struct _OtherInputMasks *inputMasks; - for (dev=inputInfo.devices; dev; dev=dev->next) - { - if (dev == inputInfo.pointer || - dev == inputInfo.keyboard) + for (dev = inputInfo.devices; dev; dev = dev->next) { + if (dev == inputInfo.pointer || dev == inputInfo.keyboard) continue; DeleteDeviceFromAnyExtEvents(pWin, dev); } @@ -1058,8 +991,7 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) DeleteDeviceFromAnyExtEvents(pWin, dev); if (freeResources) - while ((inputMasks = wOtherInputMasks(pWin)) != 0) - { + while ((inputMasks = wOtherInputMasks(pWin)) != 0) { ic = inputMasks->inputClients; for (i = 0; i < EMASKSIZE; i++) inputMasks->dontPropagateMask[i] = 0; @@ -1073,17 +1005,16 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) WindowPtr parent; /* Deactivate any grabs performed on this window, before making - any input focus changes. - Deactivating a device grab should cause focus events. */ + * any input focus changes. + * Deactivating a device grab should cause focus events. */ if (dev->grab && (dev->grab->window == pWin)) (*dev->DeactivateGrab) (dev); /* If the focus window is a root window (ie. has no parent) - then don't delete the focus from it. */ + * then don't delete the focus from it. */ - if (dev->focus && (pWin==dev->focus->win) && (pWin->parent != NullWindow)) - { + if (dev->focus && (pWin == dev->focus->win) && (pWin->parent != NullWindow)) { int focusEventMode = NotifyNormal; /* If a grab is in progress, then alter the mode of focus events. */ @@ -1091,8 +1022,7 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) if (dev->grab) focusEventMode = NotifyWhileGrabbed; - switch (dev->focus->revert) - { + switch (dev->focus->revert) { case RevertToNone: DoFocusEvents(dev, pWin, NoneWin, focusEventMode); dev->focus->win = NoneWin; @@ -1100,11 +1030,11 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) break; case RevertToParent: parent = pWin; - do - { + do { parent = parent->parent; dev->focus->traceGood--; - } while (!parent->realized); + } + while (!parent->realized); DoFocusEvents(dev, pWin, parent, focusEventMode); dev->focus->win = parent; dev->focus->revert = RevertToNone; @@ -1140,18 +1070,13 @@ MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) DeviceIntPtr dev; dev = LookupDeviceIntRec(pEvents->deviceid & DEVICE_BITS); - if (pEvents->type == DeviceMotionNotify) - { - if (mask & DevicePointerMotionHintMask) - { - if (WID(dev->valuator->motionHintWindow) == pEvents->event) - { + if (pEvents->type == DeviceMotionNotify) { + if (mask & DevicePointerMotionHintMask) { + if (WID(dev->valuator->motionHintWindow) == pEvents->event) { return 1; /* don't send, but pretend we did */ } pEvents->detail = NotifyHint; - } - else - { + } else { pEvents->detail = NotifyNormal; } } @@ -1169,14 +1094,14 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, if (type == DeviceMotionNotify) dev->valuator->motionHintWindow = pWin; else if ((type == DeviceButtonPress) && (!grab) && - (deliveryMask & DeviceButtonGrabMask)) - { + (deliveryMask & DeviceButtonGrabMask)) { GrabRec tempGrab; tempGrab.device = dev; tempGrab.resource = client->clientAsMask; tempGrab.window = pWin; - tempGrab.ownerEvents = (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE; + tempGrab.ownerEvents = + (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE; tempGrab.eventMask = deliveryMask; tempGrab.keyboardMode = GrabModeAsync; tempGrab.pointerMode = GrabModeAsync; @@ -1194,8 +1119,7 @@ DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) if (!wOtherInputMasks(pWin)) return 0; for (other = wOtherInputMasks(pWin)->inputClients; other; - other = other->next) - { + other = other->next) { if (SameClient(other, client)) return other->mask[dev->id]; } @@ -1226,19 +1150,15 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, { struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin); - if (mask & ~PropagateMask[maskndx]) - { + if (mask & ~PropagateMask[maskndx]) { client->errorValue = mask; return BadValue; } - if (mask == 0) - { + if (mask == 0) { if (inputMasks) inputMasks->dontPropagateMask[maskndx] = mask; - } - else - { + } else { if (!inputMasks) AddExtensionClient(pWin, client, 0, 0); inputMasks = wOtherInputMasks(pWin); diff --git a/nx-X11/programs/Xserver/Xi/extinit.c b/nx-X11/programs/Xserver/Xi/extinit.c index f9415af6b..b727cfe37 100644 --- a/nx-X11/programs/Xserver/Xi/extinit.c +++ b/nx-X11/programs/Xserver/Xi/extinit.c @@ -120,24 +120,26 @@ struct dev_type { Atom type; char *name; - }dev_type [] = {{0,XI_KEYBOARD}, - {0,XI_MOUSE}, - {0,XI_TABLET}, - {0,XI_TOUCHSCREEN}, - {0,XI_TOUCHPAD}, - {0,XI_BARCODE}, - {0,XI_BUTTONBOX}, - {0,XI_KNOB_BOX}, - {0,XI_ONE_KNOB}, - {0,XI_NINE_KNOB}, - {0,XI_TRACKBALL}, - {0,XI_QUADRATURE}, - {0,XI_ID_MODULE}, - {0,XI_SPACEBALL}, - {0,XI_DATAGLOVE}, - {0,XI_EYETRACKER}, - {0,XI_CURSORKEYS}, - {0,XI_FOOTMOUSE}}; +} dev_type[] = { + { + 0, XI_KEYBOARD}, { + 0, XI_MOUSE}, { + 0, XI_TABLET}, { + 0, XI_TOUCHSCREEN}, { + 0, XI_TOUCHPAD}, { + 0, XI_BARCODE}, { + 0, XI_BUTTONBOX}, { + 0, XI_KNOB_BOX}, { + 0, XI_ONE_KNOB}, { + 0, XI_NINE_KNOB}, { + 0, XI_TRACKBALL}, { + 0, XI_QUADRATURE}, { + 0, XI_ID_MODULE}, { + 0, XI_SPACEBALL}, { + 0, XI_DATAGLOVE}, { + 0, XI_EYETRACKER}, { + 0, XI_CURSORKEYS}, { +0, XI_FOOTMOUSE}}; CARD8 event_base[numInputClasses]; XExtEventInfo EventInfo[32]; @@ -223,8 +225,7 @@ XInputExtensionInit() extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, SProcIDispatch, IResetProc, StandardMinorOpcode); - if (extEntry) - { + if (extEntry) { IReqCode = extEntry->base; AllExtensionVersions[IReqCode - 128] = thisversion; MakeDeviceTypeAtoms(); @@ -246,9 +247,7 @@ XInputExtensionInit() EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; EventSwapVector[DeviceMappingNotify] = SEventIDispatch; EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; - } - else - { + } else { FatalError("IExtensionInit: AddExtensions failed\n"); } } @@ -334,8 +333,7 @@ ProcIDispatch(register ClientPtr client) return (ProcXGetDeviceControl(client)); else if (stuff->data == X_ChangeDeviceControl) return (ProcXChangeDeviceControl(client)); - else - { + else { SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest); } return (BadRequest); @@ -424,8 +422,7 @@ SProcIDispatch(register ClientPtr client) return (SProcXGetDeviceControl(client)); else if (stuff->data == X_ChangeDeviceControl) return (SProcXChangeDeviceControl(client)); - else - { + else { SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest); } return (BadRequest); @@ -448,7 +445,8 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) /* All we look at is the type field */ { /* This is common to all replies */ if (rep->RepType == X_GetExtensionVersion) - SRepXGetExtensionVersion (client, len, (xGetExtensionVersionReply *)rep); + SRepXGetExtensionVersion(client, len, + (xGetExtensionVersionReply *) rep); else if (rep->RepType == X_ListInputDevices) SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep); else if (rep->RepType == X_OpenDevice) @@ -456,15 +454,22 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) else if (rep->RepType == X_SetDeviceMode) SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep); else if (rep->RepType == X_GetSelectedExtensionEvents) - SRepXGetSelectedExtensionEvents (client, len, (xGetSelectedExtensionEventsReply *) rep); + SRepXGetSelectedExtensionEvents(client, len, + (xGetSelectedExtensionEventsReply *) + rep); else if (rep->RepType == X_GetDeviceDontPropagateList) - SRepXGetDeviceDontPropagateList (client, len, (xGetDeviceDontPropagateListReply *)rep); + SRepXGetDeviceDontPropagateList(client, len, + (xGetDeviceDontPropagateListReply *) + rep); else if (rep->RepType == X_GetDeviceMotionEvents) - SRepXGetDeviceMotionEvents (client, len, (xGetDeviceMotionEventsReply *) rep); + SRepXGetDeviceMotionEvents(client, len, + (xGetDeviceMotionEventsReply *) rep); else if (rep->RepType == X_ChangeKeyboardDevice) - SRepXChangeKeyboardDevice (client, len, (xChangeKeyboardDeviceReply *) rep); + SRepXChangeKeyboardDevice(client, len, + (xChangeKeyboardDeviceReply *) rep); else if (rep->RepType == X_ChangePointerDevice) - SRepXChangePointerDevice (client, len, (xChangePointerDeviceReply *)rep); + SRepXChangePointerDevice(client, len, + (xChangePointerDeviceReply *) rep); else if (rep->RepType == X_GrabDevice) SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep); else if (rep->RepType == X_GetDeviceFocus) @@ -472,15 +477,20 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) else if (rep->RepType == X_GetFeedbackControl) SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep); else if (rep->RepType == X_GetDeviceKeyMapping) - SRepXGetDeviceKeyMapping (client, len, (xGetDeviceKeyMappingReply *)rep); + SRepXGetDeviceKeyMapping(client, len, + (xGetDeviceKeyMappingReply *) rep); else if (rep->RepType == X_GetDeviceModifierMapping) - SRepXGetDeviceModifierMapping (client, len, (xGetDeviceModifierMappingReply *)rep); + SRepXGetDeviceModifierMapping(client, len, + (xGetDeviceModifierMappingReply *) rep); else if (rep->RepType == X_SetDeviceModifierMapping) - SRepXSetDeviceModifierMapping (client, len, (xSetDeviceModifierMappingReply *)rep); + SRepXSetDeviceModifierMapping(client, len, + (xSetDeviceModifierMappingReply *) rep); else if (rep->RepType == X_GetDeviceButtonMapping) - SRepXGetDeviceButtonMapping (client, len, (xGetDeviceButtonMappingReply *)rep); + SRepXGetDeviceButtonMapping(client, len, + (xGetDeviceButtonMappingReply *) rep); else if (rep->RepType == X_SetDeviceButtonMapping) - SRepXSetDeviceButtonMapping (client, len, (xSetDeviceButtonMappingReply *)rep); + SRepXSetDeviceButtonMapping(client, len, + (xSetDeviceButtonMappingReply *) rep); else if (rep->RepType == X_QueryDeviceState) SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep); else if (rep->RepType == X_SetDeviceValuators) @@ -488,9 +498,9 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) else if (rep->RepType == X_GetDeviceControl) SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep); else if (rep->RepType == X_ChangeDeviceControl) - SRepXChangeDeviceControl (client, len, (xChangeDeviceControlReply *)rep); - else - { + SRepXChangeDeviceControl(client, len, + (xChangeDeviceControlReply *) rep); + else { FatalError("XINPUT confused sending swapped reply"); } } @@ -510,46 +520,32 @@ SEventIDispatch(xEvent * from, xEvent * to) if (type == DeviceValuator) DO_SWAP(SEventDeviceValuator, deviceValuator); - else if (type == DeviceKeyPress) - { + else if (type == DeviceKeyPress) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } - else if (type == DeviceKeyRelease) - { + } else if (type == DeviceKeyRelease) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } - else if (type == DeviceButtonPress) - { + } else if (type == DeviceButtonPress) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } - else if (type == DeviceButtonRelease) - { + } else if (type == DeviceButtonRelease) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } - else if (type == DeviceMotionNotify) - { + } else if (type == DeviceMotionNotify) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } - else if (type == DeviceFocusIn) + } else if (type == DeviceFocusIn) DO_SWAP(SEventFocus, deviceFocus); else if (type == DeviceFocusOut) DO_SWAP(SEventFocus, deviceFocus); - else if (type == ProximityIn) - { + else if (type == ProximityIn) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } - else if (type == ProximityOut) - { + } else if (type == ProximityOut) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } - else if (type == DeviceStateNotify) + } else if (type == DeviceStateNotify) DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); else if (type == DeviceKeyStateNotify) DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); @@ -559,8 +555,7 @@ SEventIDispatch(xEvent * from, xEvent * to) DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); else if (type == ChangeDeviceNotify) DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); - else - { + else { FatalError("XInputExtension: Impossible event!\n"); } } @@ -606,8 +601,7 @@ SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) swaps(&to->sequenceNumber); swapl(&to->time); ip = &to->valuator0; - for (i=0; i<3; i++) - { + for (i = 0; i < 3; i++) { swapl((ip + i)); /* macro - braces are required */ } } @@ -759,8 +753,7 @@ RestoreExtensionEvents() IReqCode = 0; - for (i=0; i<ExtEventIndex-1; i++) - { + for (i = 0; i < ExtEventIndex - 1; i++) { if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128)) SetMaskForEvent(0, EventInfo[i].type); EventInfo[i].mask = 0; @@ -865,10 +858,8 @@ LookupDeviceIntRec(CARD8 id) { DeviceIntPtr dev; - for (dev=inputInfo.devices; dev; dev=dev->next) - { - if (dev->id == id) - { + for (dev = inputInfo.devices; dev; dev = dev->next) { + if (dev->id == id) { if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id) return (NULL); return (dev); @@ -922,8 +913,7 @@ GetNextExtEventMask() int i; Mask mask = lastExtEventMask; - if (lastExtEventMask == 0) - { + if (lastExtEventMask == 0) { FatalError("GetNextExtEventMask: no more events are available."); } lastExtEventMask <<= 1; diff --git a/nx-X11/programs/Xserver/Xi/getbmap.c b/nx-X11/programs/Xserver/Xi/getbmap.c index 0708e5fbe..7055e9f92 100644 --- a/nx-X11/programs/Xserver/Xi/getbmap.c +++ b/nx-X11/programs/Xserver/Xi/getbmap.c @@ -103,16 +103,14 @@ ProcXGetDeviceButtonMapping(register ClientPtr client) rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0, BadDevice); return Success; } b = dev->button; - if (b == NULL) - { + if (b == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0, BadMatch); return Success; @@ -120,8 +118,7 @@ ProcXGetDeviceButtonMapping(register ClientPtr client) rep.nElts = b->numButtons; rep.length = (rep.nElts + (4 - 1)) / 4; WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep); - WriteToClient(client, rep.nElts, - (char *)&b->map[1]); + WriteToClient(client, rep.nElts, (char *)&b->map[1]); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/getdctl.c b/nx-X11/programs/Xserver/Xi/getdctl.c index f23fc212e..7cc96cb2b 100644 --- a/nx-X11/programs/Xserver/Xi/getdctl.c +++ b/nx-X11/programs/Xserver/Xi/getdctl.c @@ -101,10 +101,8 @@ ProcXGetDeviceControl(ClientPtr client) REQUEST_SIZE_MATCH(xGetDeviceControlReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { - SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice); return Success; } @@ -113,11 +111,9 @@ ProcXGetDeviceControl(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - switch (stuff->control) - { + switch (stuff->control) { case DEVICE_RESOLUTION: - if (!dev->valuator) - { + if (!dev->valuator) { SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadMatch); return Success; @@ -126,25 +122,20 @@ ProcXGetDeviceControl(ClientPtr client) (3 * sizeof(int) * dev->valuator->numAxes); break; default: - SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0, - BadValue); + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); return Success; } buf = (char *)malloc(total_length); - if (!buf) - { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, - BadAlloc); + if (!buf) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc); return Success; } savbuf = buf; - switch (stuff->control) - { + switch (stuff->control) { case DEVICE_RESOLUTION: - CopySwapDeviceResolution(client, dev->valuator, buf, - total_length); + CopySwapDeviceResolution(client, dev->valuator, buf, total_length); break; default: break; @@ -183,14 +174,12 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, *iptr++ = a->min_resolution; for (i = 0, a = v->axes; i < v->numAxes; i++, a++) *iptr++ = a->max_resolution; - if (client->swapped) - { + if (client->swapped) { swaps(&r->control); swaps(&r->length); swapl(&r->num_valuators); iptr = (int *)buf; - for (i=0; i < (3 * v->numAxes); i++,iptr++) - { + for (i = 0; i < (3 * v->numAxes); i++, iptr++) { swapl(iptr); } } diff --git a/nx-X11/programs/Xserver/Xi/getfctl.c b/nx-X11/programs/Xserver/Xi/getfctl.c index a7d46e24f..9f75753f3 100644 --- a/nx-X11/programs/Xserver/Xi/getfctl.c +++ b/nx-X11/programs/Xserver/Xi/getfctl.c @@ -105,10 +105,8 @@ ProcXGetFeedbackControl(ClientPtr client) REQUEST_SIZE_MATCH(xGetFeedbackControlReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { - SendErrorToClient (client, IReqCode, X_GetFeedbackControl, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice); return Success; } @@ -118,50 +116,40 @@ ProcXGetFeedbackControl(ClientPtr client) rep.sequenceNumber = client->sequence; rep.num_feedbacks = 0; - for (k=dev->kbdfeed; k; k=k->next) - { + for (k = dev->kbdfeed; k; k = k->next) { rep.num_feedbacks++; total_length += sizeof(xKbdFeedbackState); } - for (p=dev->ptrfeed; p; p=p->next) - { + for (p = dev->ptrfeed; p; p = p->next) { rep.num_feedbacks++; total_length += sizeof(xPtrFeedbackState); } - for (s=dev->stringfeed; s; s=s->next) - { + for (s = dev->stringfeed; s; s = s->next) { rep.num_feedbacks++; total_length += sizeof(xStringFeedbackState) + (s->ctrl.num_symbols_supported * sizeof(KeySym)); } - for (i=dev->intfeed; i; i=i->next) - { + for (i = dev->intfeed; i; i = i->next) { rep.num_feedbacks++; total_length += sizeof(xIntegerFeedbackState); } - for (l=dev->leds; l; l=l->next) - { + for (l = dev->leds; l; l = l->next) { rep.num_feedbacks++; total_length += sizeof(xLedFeedbackState); } - for (b=dev->bell; b; b=b->next) - { + for (b = dev->bell; b; b = b->next) { rep.num_feedbacks++; total_length += sizeof(xBellFeedbackState); } - if (total_length == 0) - { - SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, - BadMatch); + if (total_length == 0) { + SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch); return Success; } buf = (char *)malloc(total_length); - if (!buf) - { - SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, - BadAlloc); + if (!buf) { + SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc); return Success; } savbuf = buf; @@ -210,8 +198,7 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) k2->global_auto_repeat = k->ctrl.autoRepeat; for (i = 0; i < 32; i++) k2->auto_repeats[i] = k->ctrl.autoRepeats[i]; - if (client->swapped) - { + if (client->swapped) { swaps(&k2->length); swaps(&k2->pitch); swaps(&k2->duration); @@ -239,8 +226,7 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) p2->accelNum = p->ctrl.num; p2->accelDenom = p->ctrl.den; p2->threshold = p->ctrl.threshold; - if (client->swapped) - { + if (client->swapped) { swaps(&p2->length); swaps(&p2->accelNum); swaps(&p2->accelDenom); @@ -267,8 +253,7 @@ CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) i2->resolution = i->ctrl.resolution; i2->min_value = i->ctrl.min_value; i2->max_value = i->ctrl.max_value; - if (client->swapped) - { + if (client->swapped) { swaps(&i2->length); swapl(&i2->resolution); swapl(&i2->min_value); @@ -301,14 +286,12 @@ CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) kptr = (KeySym *) (*buf); for (i = 0; i < s->ctrl.num_symbols_supported; i++) *kptr++ = *(s->ctrl.symbols_supported + i); - if (client->swapped) - { + if (client->swapped) { swaps(&s2->length); swaps(&s2->max_symbols); swaps(&s2->num_syms_supported); kptr = (KeySym *) (*buf); - for (i=0; i<s->ctrl.num_symbols_supported; i++,kptr++) - { + for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) { swapl(kptr); } } @@ -332,8 +315,7 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) l2->id = l->ctrl.id; l2->led_values = l->ctrl.led_values; l2->led_mask = l->ctrl.led_mask; - if (client->swapped) - { + if (client->swapped) { swaps(&l2->length); swapl(&l2->led_values); swapl(&l2->led_mask); @@ -359,8 +341,7 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf) b2->percent = b->ctrl.percent; b2->pitch = b->ctrl.pitch; b2->duration = b->ctrl.duration; - if (client->swapped) - { + if (client->swapped) { swaps(&b2->length); swaps(&b2->pitch); swaps(&b2->duration); diff --git a/nx-X11/programs/Xserver/Xi/getfocus.c b/nx-X11/programs/Xserver/Xi/getfocus.c index 6642d5b42..5111522f2 100644 --- a/nx-X11/programs/Xserver/Xi/getfocus.c +++ b/nx-X11/programs/Xserver/Xi/getfocus.c @@ -98,8 +98,7 @@ ProcXGetDeviceFocus(ClientPtr client) REQUEST_SIZE_MATCH(xGetDeviceFocusReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL || !dev->focus) - { + if (dev == NULL || !dev->focus) { SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/getkmap.c b/nx-X11/programs/Xserver/Xi/getkmap.c index 2ce98923c..419d1080f 100644 --- a/nx-X11/programs/Xserver/Xi/getkmap.c +++ b/nx-X11/programs/Xserver/Xi/getkmap.c @@ -99,35 +99,28 @@ ProcXGetDeviceKeyMapping(register ClientPtr client) REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadDevice); return Success; } - if (dev->key == NULL) - { - SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, - BadMatch); + if (dev->key == NULL) { + SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadMatch); return Success; } k = &dev->key->curKeySyms; if ((stuff->firstKeyCode < k->minKeyCode) || - (stuff->firstKeyCode > k->maxKeyCode)) - { + (stuff->firstKeyCode > k->maxKeyCode)) { client->errorValue = stuff->firstKeyCode; - SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, - BadValue); + SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue); return Success; } - if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) - { + if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) { client->errorValue = stuff->count; - SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, - BadValue); + SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue); return Success; } @@ -139,8 +132,7 @@ ProcXGetDeviceKeyMapping(register ClientPtr client) WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; - WriteSwappedDataToClient( - client, + WriteSwappedDataToClient(client, k->mapWidth * stuff->count * sizeof(KeySym), &k->map[(stuff->firstKeyCode - k->minKeyCode) * k->mapWidth]); diff --git a/nx-X11/programs/Xserver/Xi/getmmap.c b/nx-X11/programs/Xserver/Xi/getmmap.c index f12783554..ce11e3e28 100644 --- a/nx-X11/programs/Xserver/Xi/getmmap.c +++ b/nx-X11/programs/Xserver/Xi/getmmap.c @@ -99,16 +99,14 @@ ProcXGetDeviceModifierMapping(ClientPtr client) REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0, BadDevice); return Success; } kp = dev->key; - if (kp == NULL) - { + if (kp == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0, BadMatch); return Success; diff --git a/nx-X11/programs/Xserver/Xi/getprop.c b/nx-X11/programs/Xserver/Xi/getprop.c index c8b148972..77075c92b 100644 --- a/nx-X11/programs/Xserver/Xi/getprop.c +++ b/nx-X11/programs/Xserver/Xi/getprop.c @@ -113,21 +113,18 @@ ProcXGetDeviceDontPropagateList(register ClientPtr client) rep.count = 0; pWin = (WindowPtr) LookupWindow(stuff->window, client); - if (!pWin) - { + if (!pWin) { client->errorValue = stuff->window; SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0, BadWindow); return Success; } - if ((others = wOtherInputMasks(pWin)) != 0) - { + if ((others = wOtherInputMasks(pWin)) != 0) { for (i = 0; i < EMASKSIZE; i++) tbuf = ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT); - if (count) - { + if (count) { rep.count = count; buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass)); rep.length = (rep.count * sizeof(XEventClass) + 3) >> 2; @@ -139,11 +136,9 @@ ProcXGetDeviceDontPropagateList(register ClientPtr client) } } - WriteReplyToClient (client, sizeof (xGetDeviceDontPropagateListReply), - &rep); + WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep); - if (count) - { + if (count) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf); free(buf); @@ -167,11 +162,9 @@ XEventClass Mask tmask = 0x80000000; for (i = 0; i < 32; i++, tmask >>= 1) - if (tmask & mask) - { + if (tmask & mask) { for (j = 0; j < ExtEventIndex; j++) - if (EventInfo[j].mask == tmask) - { + if (EventInfo[j].mask == tmask) { if (mode == COUNT) (*count)++; else diff --git a/nx-X11/programs/Xserver/Xi/getselev.c b/nx-X11/programs/Xserver/Xi/getselev.c index 10e040d22..21f6d8090 100644 --- a/nx-X11/programs/Xserver/Xi/getselev.c +++ b/nx-X11/programs/Xserver/Xi/getselev.c @@ -115,23 +115,20 @@ ProcXGetSelectedExtensionEvents(register ClientPtr client) rep.this_client_count = 0; rep.all_clients_count = 0; - if (!(pWin = LookupWindow(stuff->window, client))) - { + if (!(pWin = LookupWindow(stuff->window, client))) { SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0, BadWindow); return Success; } - if ((pOthers = wOtherInputMasks(pWin)) != 0) - { + if ((pOthers = wOtherInputMasks(pWin)) != 0) { for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(NULL, others->mask[i], i, &rep.all_clients_count, COUNT); for (others = pOthers->inputClients; others; others = others->next) - if (SameClient(others, client)) - { + if (SameClient(others, client)) { for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(NULL, others->mask[i], i, &rep.this_client_count, COUNT); @@ -147,17 +144,18 @@ ProcXGetSelectedExtensionEvents(register ClientPtr client) aclient = buf + rep.this_client_count; if (others) for (i = 0; i < EMASKSIZE; i++) - tclient = ClassFromMask (tclient, others->mask[i], i, NULL, CREATE); + tclient = + ClassFromMask(tclient, others->mask[i], i, NULL, CREATE); for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) - aclient = ClassFromMask (aclient, others->mask[i], i, NULL, CREATE); + aclient = + ClassFromMask(aclient, others->mask[i], i, NULL, CREATE); } WriteReplyToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep); - if (total_length) - { + if (total_length) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, total_length, buf); free(buf); diff --git a/nx-X11/programs/Xserver/Xi/getvers.c b/nx-X11/programs/Xserver/Xi/getvers.c index 51afa410e..d66175d58 100644 --- a/nx-X11/programs/Xserver/Xi/getvers.c +++ b/nx-X11/programs/Xserver/Xi/getvers.c @@ -99,8 +99,7 @@ ProcXGetExtensionVersion(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq); if (stuff->length != (sizeof(xGetExtensionVersionReq) + - stuff->nbytes + 3)>>2) - { + stuff->nbytes + 3) >> 2) { SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0, BadLength); return Success; @@ -115,12 +114,9 @@ ProcXGetExtensionVersion(register ClientPtr client) rep.minor_version = 0; rep.present = TRUE; - if (rep.present) - { - rep.major_version = - AllExtensionVersions[IReqCode-128].major_version; - rep.minor_version = - AllExtensionVersions[IReqCode-128].minor_version; + if (rep.present) { + rep.major_version = AllExtensionVersions[IReqCode - 128].major_version; + rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version; } WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep); diff --git a/nx-X11/programs/Xserver/Xi/grabdev.c b/nx-X11/programs/Xserver/Xi/grabdev.c index 1ecc05fde..b99a44eac 100644 --- a/nx-X11/programs/Xserver/Xi/grabdev.c +++ b/nx-X11/programs/Xserver/Xi/grabdev.c @@ -113,8 +113,7 @@ ProcXGrabDevice(ClientPtr client) REQUEST(xGrabDeviceReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceReq); - if (stuff->length !=(sizeof(xGrabDeviceReq)>>2) + stuff->event_count) - { + if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count) { SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadLength); return Success; } @@ -125,22 +124,22 @@ ProcXGrabDevice(ClientPtr client) rep.length = 0; dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice); return Success; } if (CreateMaskFromList(client, (XEventClass *) & stuff[1], - stuff->event_count, tmp, dev, X_GrabDevice) != Success) + stuff->event_count, tmp, dev, + X_GrabDevice) != Success) return Success; error = GrabDevice(client, dev, stuff->this_device_mode, - stuff->other_devices_mode, stuff->grabWindow, stuff->ownerEvents, - stuff->time, tmp[stuff->deviceid].mask, &rep.status); + stuff->other_devices_mode, stuff->grabWindow, + stuff->ownerEvents, stuff->time, + tmp[stuff->deviceid].mask, &rep.status); - if (error != Success) - { + if (error != Success) { SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error); return Success; } @@ -163,30 +162,25 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count, int device; DeviceIntPtr tdev; - for (i=0; i<EMASKSIZE; i++) - { + for (i = 0; i < EMASKSIZE; i++) { mask[i].mask = 0; mask[i].dev = NULL; } - for (i=0; i<count; i++, list++) - { + for (i = 0; i < count; i++, list++) { device = *list >> 8; - if (device > 255) - { + if (device > 255) { SendErrorToClient(client, IReqCode, req, 0, BadClass); return BadClass; } tdev = LookupDeviceIntRec(device); - if (tdev==NULL || (dev != NULL && tdev != dev)) - { + if (tdev == NULL || (dev != NULL && tdev != dev)) { SendErrorToClient(client, IReqCode, req, 0, BadClass); return BadClass; } for (j = 0; j < ExtEventIndex; j++) - if (EventInfo[j].type == (*list & 0xff)) - { + if (EventInfo[j].type == (*list & 0xff)) { mask[device].mask |= EventInfo[j].mask; mask[device].dev = (Pointer) tdev; break; diff --git a/nx-X11/programs/Xserver/Xi/grabdevb.c b/nx-X11/programs/Xserver/Xi/grabdevb.c index 8db8976f7..469658b23 100644 --- a/nx-X11/programs/Xserver/Xi/grabdevb.c +++ b/nx-X11/programs/Xserver/Xi/grabdevb.c @@ -109,47 +109,42 @@ ProcXGrabDeviceButton(ClientPtr client) REQUEST(xGrabDeviceButtonReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq); - if (stuff->length !=(sizeof(xGrabDeviceButtonReq)>>2) + stuff->event_count) - { + if (stuff->length != + (sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count) { SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadLength); return Success; } dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - { - SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice); return Success; } - if (stuff->modifier_device != UseXKeyboard) - { + if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) - { + if (mdev == NULL) { SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice); return Success; } - if (mdev->key == NULL) - { + if (mdev->key == NULL) { SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadMatch); return Success; } - } - else + } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); class = (XEventClass *) (&stuff[1]); /* first word of values */ if ((ret = CreateMaskFromList(client, class, - stuff->event_count, tmp, dev, X_GrabDeviceButton)) != Success) + stuff->event_count, tmp, dev, + X_GrabDeviceButton)) != Success) return Success; ret = GrabButton(client, dev, stuff->this_device_mode, - stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button, - stuff->grabWindow, stuff->ownerEvents, (Cursor)0, (Window)0, - tmp[stuff->grabbed_device].mask); + stuff->other_devices_mode, stuff->modifiers, mdev, + stuff->button, stuff->grabWindow, stuff->ownerEvents, + (Cursor) 0, (Window) 0, tmp[stuff->grabbed_device].mask); if (ret != Success) SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret); diff --git a/nx-X11/programs/Xserver/Xi/grabdevk.c b/nx-X11/programs/Xserver/Xi/grabdevk.c index 26469c4b7..29498b08a 100644 --- a/nx-X11/programs/Xserver/Xi/grabdevk.c +++ b/nx-X11/programs/Xserver/Xi/grabdevk.c @@ -107,51 +107,43 @@ ProcXGrabDeviceKey(ClientPtr client) REQUEST(xGrabDeviceKeyReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq); - if (stuff->length !=(sizeof(xGrabDeviceKeyReq)>>2) + stuff->event_count) - { + if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count) { SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadLength); return Success; } dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - { - SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice); return Success; } - if (stuff->modifier_device != UseXKeyboard) - { + if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) - { - SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, - BadDevice); + if (mdev == NULL) { + SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice); return Success; } - if (mdev->key == NULL) - { - SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, - BadMatch); + if (mdev->key == NULL) { + SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadMatch); return Success; } - } - else + } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); class = (XEventClass *) (&stuff[1]); /* first word of values */ if ((ret = CreateMaskFromList(client, class, - stuff->event_count, tmp, dev, X_GrabDeviceKey)) != Success) + stuff->event_count, tmp, dev, + X_GrabDeviceKey)) != Success) return Success; ret = GrabKey(client, dev, stuff->this_device_mode, - stuff->other_devices_mode, stuff->modifiers, mdev, stuff->key, - stuff->grabWindow, stuff->ownerEvents, tmp[stuff->grabbed_device].mask); + stuff->other_devices_mode, stuff->modifiers, mdev, + stuff->key, stuff->grabWindow, stuff->ownerEvents, + tmp[stuff->grabbed_device].mask); - if (ret != Success) - { + if (ret != Success) { SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/gtmotion.c b/nx-X11/programs/Xserver/Xi/gtmotion.c index 870d87fb9..72209d1b4 100644 --- a/nx-X11/programs/Xserver/Xi/gtmotion.c +++ b/nx-X11/programs/Xserver/Xi/gtmotion.c @@ -107,15 +107,13 @@ ProcXGetDeviceMotionEvents(ClientPtr client) REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, BadDevice); return Success; } v = dev->valuator; - if (v==NULL || v->numAxes == 0) - { + if (v == NULL || v->numAxes == 0) { SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, BadMatch); return Success; @@ -133,16 +131,14 @@ ProcXGetDeviceMotionEvents(ClientPtr client) start = ClientTimeToServerTime(stuff->start); stop = ClientTimeToServerTime(stuff->stop); if (CompareTimeStamps(start, stop) == LATER || - CompareTimeStamps(start, currentTime) == LATER) - { + CompareTimeStamps(start, currentTime) == LATER) { WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); return Success; } if (CompareTimeStamps(stop, currentTime) == LATER) stop = currentTime; num_events = v->numMotionEvents; - if (num_events) - { + if (num_events) { size = sizeof(Time) + (axes * sizeof(INT32)); tsize = num_events * size; coords = (INT32 *) malloc(tsize); @@ -152,24 +148,20 @@ ProcXGetDeviceMotionEvents(ClientPtr client) BadAlloc); return Success; } - rep.nEvents = (v->GetMotionProc) ( - dev, (xTimecoord *)coords, /* XXX */ - start.milliseconds, stop.milliseconds, (ScreenPtr)NULL); + rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */ + start.milliseconds, stop.milliseconds, + (ScreenPtr) NULL); } - if (rep.nEvents > 0) - { + if (rep.nEvents > 0) { length = (rep.nEvents * size + 3) >> 2; rep.length = length; } nEvents = rep.nEvents; WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); - if (nEvents) - { - if (client->swapped) - { + if (nEvents) { + if (client->swapped) { bufptr = coords; - for (i=0; i<nEvents * (axes+1); i++) - { + for (i = 0; i < nEvents * (axes + 1); i++) { swapl(bufptr); bufptr++; } diff --git a/nx-X11/programs/Xserver/Xi/listdev.c b/nx-X11/programs/Xserver/Xi/listdev.c index c667f1632..ba32d5494 100644 --- a/nx-X11/programs/Xserver/Xi/listdev.c +++ b/nx-X11/programs/Xserver/Xi/listdev.c @@ -159,8 +159,7 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) *size += sizeof(xKeyInfo); if (d->button != NULL) *size += sizeof(xButtonInfo); - if (d->valuator != NULL) - { + if (d->valuator != NULL) { chunks = ((int)d->valuator->numAxes + 19) / VPC; *size += (chunks * sizeof(xValuatorInfo) + d->valuator->numAxes * sizeof(xAxisInfo)); @@ -179,19 +178,17 @@ ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, { CopyDeviceName(namebuf, d->name); CopySwapDevice(client, d, 0, devbuf); - if (d->key != NULL) - { + if (d->key != NULL) { CopySwapKeyClass(client, d->key, classbuf); dev->num_classes++; } - if (d->button != NULL) - { + if (d->button != NULL) { CopySwapButtonClass(client, d->button, classbuf); dev->num_classes++; } - if (d->valuator != NULL) - { - dev->num_classes += CopySwapValuatorClass(client, d->valuator, classbuf); + if (d->valuator != NULL) { + dev->num_classes += + CopySwapValuatorClass(client, d->valuator, classbuf); } } @@ -210,14 +207,11 @@ CopyDeviceName(char **namebuf, char *name) { char *nameptr = (char *)*namebuf; - if (name) - { + if (name) { *nameptr++ = strlen(name); strcpy(nameptr, name); *namebuf += (strlen(name) + 1); - } - else - { + } else { *nameptr++ = 0; *namebuf += 1; } @@ -246,8 +240,7 @@ CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, dev->use = IsXPointer; else dev->use = IsXExtensionDevice; - if (client->swapped) - { + if (client->swapped) { swapl(&dev->type); /* macro - braces are required */ } *buf += sizeof(xDeviceInfo); @@ -270,8 +263,7 @@ CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) k2->min_keycode = k->curKeySyms.minKeyCode; k2->max_keycode = k->curKeySyms.maxKeyCode; k2->num_keys = k2->max_keycode - k2->min_keycode + 1; - if (client->swapped) - { + if (client->swapped) { swaps(&k2->num_keys); } *buf += sizeof(xKeyInfo); @@ -292,8 +284,7 @@ CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) b2->class = ButtonClass; b2->length = sizeof(xButtonInfo); b2->num_buttons = b->numButtons; - if (client->swapped) - { + if (client->swapped) { swaps(&b2->num_buttons); /* macro - braces are required */ } *buf += sizeof(xButtonInfo); @@ -319,7 +310,8 @@ CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) AxisInfo *a; xAxisInfoPtr a2; - for (i=0,axes=v->numAxes; i < ((v->numAxes+19)/VPC); i++, axes-=VPC) { + for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC); + i++, axes -= VPC) { t_axes = axes < VPC ? axes : VPC; if (t_axes < 0) t_axes = v->numAxes % VPC; @@ -329,8 +321,7 @@ CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) v2->num_axes = t_axes; v2->mode = v->mode & DeviceMode; v2->motion_buffer_size = v->numMotionEvents; - if (client->swapped) - { + if (client->swapped) { swapl(&v2->motion_buffer_size); } *buf += sizeof(xValuatorInfo); diff --git a/nx-X11/programs/Xserver/Xi/opendev.c b/nx-X11/programs/Xserver/Xi/opendev.c index 52bd03620..975ed5169 100644 --- a/nx-X11/programs/Xserver/Xi/opendev.c +++ b/nx-X11/programs/Xserver/Xi/opendev.c @@ -105,19 +105,16 @@ ProcXOpenDevice(register ClientPtr client) REQUEST_SIZE_MATCH(xOpenDeviceReq); if (stuff->deviceid == inputInfo.pointer->id || - stuff->deviceid == inputInfo.keyboard->id) - { + stuff->deviceid == inputInfo.keyboard->id) { SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice); return Success; } - if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) /* not open */ - { + if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) { /* not open */ for (dev = inputInfo.off_devices; dev; dev = dev->next) if (dev->id == stuff->deviceid) break; - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice); return Success; } @@ -125,8 +122,7 @@ ProcXOpenDevice(register ClientPtr client) } OpenInputDevice(dev, client, &status); - if (status != Success) - { + if (status != Success) { SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status); return Success; } @@ -137,34 +133,28 @@ ProcXOpenDevice(register ClientPtr client) rep.repType = X_Reply; rep.RepType = X_OpenDevice; rep.sequenceNumber = client->sequence; - if (dev->key != NULL) - { + if (dev->key != NULL) { evbase[j].class = KeyClass; evbase[j++].event_type_base = event_base[KeyClass]; } - if (dev->button != NULL) - { + if (dev->button != NULL) { evbase[j].class = ButtonClass; evbase[j++].event_type_base = event_base[ButtonClass]; } - if (dev->valuator != NULL) - { + if (dev->valuator != NULL) { evbase[j].class = ValuatorClass; evbase[j++].event_type_base = event_base[ValuatorClass]; } if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL || - dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) - { + dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) { evbase[j].class = FeedbackClass; evbase[j++].event_type_base = event_base[FeedbackClass]; } - if (dev->focus != NULL) - { + if (dev->focus != NULL) { evbase[j].class = FocusClass; evbase[j++].event_type_base = event_base[FocusClass]; } - if (dev->proximity != NULL) - { + if (dev->proximity != NULL) { evbase[j].class = ProximityClass; evbase[j++].event_type_base = event_base[ProximityClass]; } diff --git a/nx-X11/programs/Xserver/Xi/queryst.c b/nx-X11/programs/Xserver/Xi/queryst.c index ba9b63fa2..f7392f9fe 100644 --- a/nx-X11/programs/Xserver/Xi/queryst.c +++ b/nx-X11/programs/Xserver/Xi/queryst.c @@ -95,10 +95,8 @@ ProcXQueryDeviceState(register ClientPtr client) rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { - SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadDevice); return Success; } @@ -107,36 +105,29 @@ ProcXQueryDeviceState(register ClientPtr client) MaybeStopDeviceHint(dev, client); k = dev->key; - if (k != NULL) - { + if (k != NULL) { total_length += sizeof(xKeyState); num_classes++; } b = dev->button; - if (b != NULL) - { + if (b != NULL) { total_length += sizeof(xButtonState); num_classes++; } - if (v != NULL) - { - total_length += (sizeof(xValuatorState) + - (v->numAxes * sizeof(int))); + if (v != NULL) { + total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int))); num_classes++; } buf = (char *)malloc(total_length); - if (!buf) - { - SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, - BadAlloc); + if (!buf) { + SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadAlloc); return Success; } savbuf = buf; - if (k != NULL) - { + if (k != NULL) { tk = (xKeyState *) buf; tk->class = KeyClass; tk->length = sizeof(xKeyState); @@ -146,8 +137,7 @@ ProcXQueryDeviceState(register ClientPtr client) buf += sizeof(xKeyState); } - if (b != NULL) - { + if (b != NULL) { tb = (xButtonState *) buf; tb->class = ButtonClass; tb->length = sizeof(xButtonState); @@ -157,19 +147,16 @@ ProcXQueryDeviceState(register ClientPtr client) buf += sizeof(xButtonState); } - if (v != NULL) - { + if (v != NULL) { tv = (xValuatorState *) buf; tv->class = ValuatorClass; tv->length = sizeof(xValuatorState); tv->num_valuators = v->numAxes; tv->mode = v->mode; buf += sizeof(xValuatorState); - for (i=0, values=v->axisVal; i<v->numAxes; i++) - { + for (i = 0, values = v->axisVal; i < v->numAxes; i++) { *((int *)buf) = *values++; - if (client->swapped) - { + if (client->swapped) { swapl((int *)buf); /* macro - braces needed */ } buf += sizeof(int); diff --git a/nx-X11/programs/Xserver/Xi/selectev.c b/nx-X11/programs/Xserver/Xi/selectev.c index 8b8fff0f9..e47b1335d 100644 --- a/nx-X11/programs/Xserver/Xi/selectev.c +++ b/nx-X11/programs/Xserver/Xi/selectev.c @@ -110,16 +110,14 @@ ProcXSelectExtensionEvent(register ClientPtr client) REQUEST(xSelectExtensionEventReq); REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq); - if (stuff->length !=(sizeof(xSelectExtensionEventReq)>>2) + stuff->count) - { + if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count) { SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, BadLength); return Success; } pWin = (WindowPtr) LookupWindow(stuff->window, client); - if (!pWin) - { + if (!pWin) { client->errorValue = stuff->window; SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, BadWindow); @@ -127,15 +125,16 @@ ProcXSelectExtensionEvent(register ClientPtr client) } if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1], - stuff->count, tmp, NULL, X_SelectExtensionEvent)) != Success) + stuff->count, tmp, NULL, + X_SelectExtensionEvent)) != Success) return Success; for (i = 0; i < EMASKSIZE; i++) - if (tmp[i].dev != NULL) - { - if ((ret = SelectForWindow((DeviceIntPtr)tmp[i].dev, pWin, client, tmp[i].mask, - ExtExclusiveMasks[i], ExtValidMasks[i])) != Success) - { + if (tmp[i].dev != NULL) { + if ((ret = + SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client, + tmp[i].mask, ExtExclusiveMasks[i], + ExtValidMasks[i])) != Success) { SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, ret); return Success; diff --git a/nx-X11/programs/Xserver/Xi/sendexev.c b/nx-X11/programs/Xserver/Xi/sendexev.c index aeb3be683..c357fc7a5 100644 --- a/nx-X11/programs/Xserver/Xi/sendexev.c +++ b/nx-X11/programs/Xserver/Xi/sendexev.c @@ -98,8 +98,7 @@ SProcXSendExtensionEvent(register ClientPtr client) return BadLength; eventP = (xEvent *) & stuff[1]; - for (i=0; i<stuff->num_events; i++,eventP++) - { + for (i = 0; i < stuff->num_events; i++, eventP++) { proc = EventSwapVector[eventP->u.u.type & 0177]; if (proc == NotImplemented) /* no swapping proc; invalid event type? */ return (BadValue); @@ -132,18 +131,14 @@ ProcXSendExtensionEvent(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq); if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count + - (stuff->num_events * (sizeof (xEvent) >> 2))) - { - SendErrorToClient (client, IReqCode, X_SendExtensionEvent, 0, - BadLength); + (stuff->num_events * (sizeof(xEvent) >> 2))) { + SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadLength); return Success; } dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { - SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadDevice); return Success; } @@ -160,11 +155,9 @@ ProcXSendExtensionEvent(register ClientPtr client) first = ((xEvent *) & stuff[1]); if (!((EXTENSION_EVENT_BASE <= first->u.u.type) && - (first->u.u.type < lastEvent)) ) - { + (first->u.u.type < lastEvent))) { client->errorValue = first->u.u.type; - SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, - BadValue); + SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadValue); return Success; } @@ -174,8 +167,8 @@ ProcXSendExtensionEvent(register ClientPtr client) return Success; ret = (SendEvent(client, dev, stuff->destination, - stuff->propagate, (xEvent *)&stuff[1], tmp[stuff->deviceid].mask, - stuff->num_events)); + stuff->propagate, (xEvent *) & stuff[1], + tmp[stuff->deviceid].mask, stuff->num_events)); if (ret != Success) SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret); diff --git a/nx-X11/programs/Xserver/Xi/setbmap.c b/nx-X11/programs/Xserver/Xi/setbmap.c index 7bdbe9522..d7a5b6782 100644 --- a/nx-X11/programs/Xserver/Xi/setbmap.c +++ b/nx-X11/programs/Xserver/Xi/setbmap.c @@ -101,8 +101,7 @@ ProcXSetDeviceButtonMapping(register ClientPtr client) REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq); if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) + - stuff->map_length + 3)>>2) - { + stuff->map_length + 3) >> 2) { SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, BadLength); return Success; @@ -115,8 +114,7 @@ ProcXSetDeviceButtonMapping(register ClientPtr client) rep.status = MappingSuccess; dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, BadDevice); return Success; @@ -124,14 +122,10 @@ ProcXSetDeviceButtonMapping(register ClientPtr client) ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]); - if (ret == BadValue || ret == BadMatch) - { - SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, - ret); + if (ret == BadValue || ret == BadMatch) { + SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, ret); return Success; - } - else - { + } else { rep.status = ret; WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep); } diff --git a/nx-X11/programs/Xserver/Xi/setdval.c b/nx-X11/programs/Xserver/Xi/setdval.c index d9620a940..69a52757a 100644 --- a/nx-X11/programs/Xserver/Xi/setdval.c +++ b/nx-X11/programs/Xserver/Xi/setdval.c @@ -103,30 +103,22 @@ ProcXSetDeviceValuators(register ClientPtr client) rep.sequenceNumber = client->sequence; if (stuff->length != (sizeof(xSetDeviceValuatorsReq) >> 2) + - stuff->num_valuators) - { - SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0, - BadLength); + stuff->num_valuators) { + SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadLength); return Success; } dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { - SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadDevice); return Success; } - if (dev->valuator == NULL) - { - SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, - BadMatch); + if (dev->valuator == NULL) { + SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadMatch); return Success; } - if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) - { - SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, - BadValue); + if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) { + SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadValue); return Success; } @@ -134,7 +126,8 @@ ProcXSetDeviceValuators(register ClientPtr client) rep.status = AlreadyGrabbed; else rep.status = SetDeviceValuators(client, dev, (int *)&stuff[1], - stuff->first_valuator, stuff->num_valuators); + stuff->first_valuator, + stuff->num_valuators); if (rep.status != Success && rep.status != AlreadyGrabbed) SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, diff --git a/nx-X11/programs/Xserver/Xi/setfocus.c b/nx-X11/programs/Xserver/Xi/setfocus.c index 6f01852a9..18ef2927e 100644 --- a/nx-X11/programs/Xserver/Xi/setfocus.c +++ b/nx-X11/programs/Xserver/Xi/setfocus.c @@ -103,8 +103,7 @@ ProcXSetDeviceFocus(register ClientPtr client) REQUEST_SIZE_MATCH(xSetDeviceFocusReq); dev = LookupDeviceIntRec(stuff->device); - if (dev==NULL || !dev->focus) - { + if (dev == NULL || !dev->focus) { SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/setmmap.c b/nx-X11/programs/Xserver/Xi/setmmap.c index 3b51c2ecf..19630b521 100644 --- a/nx-X11/programs/Xserver/Xi/setmmap.c +++ b/nx-X11/programs/Xserver/Xi/setmmap.c @@ -100,8 +100,7 @@ ProcXSetDeviceModifierMapping(ClientPtr client) REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, BadDevice); return Success; @@ -113,18 +112,17 @@ ProcXSetDeviceModifierMapping(ClientPtr client) rep.sequenceNumber = client->sequence; ret = SetModifierMapping(client, dev, stuff->length, - (sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier, - (BYTE *)&stuff[1], &kp); + (sizeof(xSetDeviceModifierMappingReq) >> 2), + stuff->numKeyPerModifier, (BYTE *) & stuff[1], + &kp); - if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed) - { + if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) { rep.success = ret; if (ret == MappingSuccess) SendDeviceMappingNotify(MappingModifier, 0, 0, dev); - WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),&rep); - } - else - { + WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply), + &rep); + } else { if (ret == -1) ret = BadValue; SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, ret); diff --git a/nx-X11/programs/Xserver/Xi/setmode.c b/nx-X11/programs/Xserver/Xi/setmode.c index d63d4aa48..4f6f81605 100644 --- a/nx-X11/programs/Xserver/Xi/setmode.c +++ b/nx-X11/programs/Xserver/Xi/setmode.c @@ -102,13 +102,11 @@ ProcXSetDeviceMode(register ClientPtr client) rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadDevice); return Success; } - if (dev->valuator == NULL) - { + if (dev->valuator == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch); return Success; } @@ -119,8 +117,7 @@ ProcXSetDeviceMode(register ClientPtr client) if (rep.status == Success) dev->valuator->mode = stuff->mode; - else if (rep.status != AlreadyGrabbed) - { + else if (rep.status != AlreadyGrabbed) { SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/ungrdev.c b/nx-X11/programs/Xserver/Xi/ungrdev.c index 976adc94d..e84a1c3aa 100644 --- a/nx-X11/programs/Xserver/Xi/ungrdev.c +++ b/nx-X11/programs/Xserver/Xi/ungrdev.c @@ -99,8 +99,7 @@ ProcXUngrabDevice(register ClientPtr client) REQUEST_SIZE_MATCH(xUngrabDeviceReq); dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - { + if (dev == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/ungrdevb.c b/nx-X11/programs/Xserver/Xi/ungrdevb.c index 366b4335a..f5e086ef6 100644 --- a/nx-X11/programs/Xserver/Xi/ungrdevb.c +++ b/nx-X11/programs/Xserver/Xi/ungrdevb.c @@ -107,51 +107,39 @@ ProcXUngrabDeviceButton(ClientPtr client) REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadDevice); return Success; } - if (dev->button == NULL) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, - BadMatch); + if (dev->button == NULL) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch); return Success; } - if (stuff->modifier_device != UseXKeyboard) - { + if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) - { + if (mdev == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadDevice); return Success; } - if (mdev->key == NULL) - { + if (mdev->key == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch); return Success; } - } - else + } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); pWin = LookupWindow(stuff->grabWindow, client); - if (!pWin) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, - BadWindow); + if (!pWin) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadWindow); return Success; } if ((stuff->modifiers != AnyModifier) && - (stuff->modifiers & ~AllModifiersMask)) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, - BadValue); + (stuff->modifiers & ~AllModifiersMask)) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadValue); return Success; } diff --git a/nx-X11/programs/Xserver/Xi/ungrdevk.c b/nx-X11/programs/Xserver/Xi/ungrdevk.c index 89dcdcda3..42ebcd6ed 100644 --- a/nx-X11/programs/Xserver/Xi/ungrdevk.c +++ b/nx-X11/programs/Xserver/Xi/ungrdevk.c @@ -107,57 +107,43 @@ ProcXUngrabDeviceKey(ClientPtr client) REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, - BadDevice); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice); return Success; } - if (dev->key == NULL) - { + if (dev->key == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch); return Success; } - if (stuff->modifier_device != UseXKeyboard) - { + if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) - { + if (mdev == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice); return Success; } - if (mdev->key == NULL) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, - BadMatch); + if (mdev->key == NULL) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch); return Success; } - } - else + } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); pWin = LookupWindow(stuff->grabWindow, client); - if (!pWin) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, - BadWindow); + if (!pWin) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadWindow); return Success; } if (((stuff->key > dev->key->curKeySyms.maxKeyCode) || (stuff->key < dev->key->curKeySyms.minKeyCode)) - && (stuff->key != AnyKey)) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, - BadValue); + && (stuff->key != AnyKey)) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue); return Success; } if ((stuff->modifiers != AnyModifier) && - (stuff->modifiers & ~AllModifiersMask)) - { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, - BadValue); + (stuff->modifiers & ~AllModifiersMask)) { + SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue); return Success; } |