From 8e188629fde213f29cfaf62c4ea3abd0520a0f41 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 15 Feb 2018 21:41:19 +0100 Subject: Xi: small formatting changes to match Xorg 7.1's Xi --- nx-X11/programs/Xserver/Xi/chgfctl.c | 7 ++++--- nx-X11/programs/Xserver/Xi/chgprop.c | 4 ++-- nx-X11/programs/Xserver/Xi/devbell.c | 6 +++--- nx-X11/programs/Xserver/Xi/exevents.c | 18 +++++++++++------- nx-X11/programs/Xserver/Xi/extinit.c | 8 ++++---- nx-X11/programs/Xserver/Xi/getselev.c | 4 ++-- nx-X11/programs/Xserver/Xi/grabdev.c | 10 ++++------ nx-X11/programs/Xserver/Xi/grabdevb.c | 10 +++++----- nx-X11/programs/Xserver/Xi/grabdevk.c | 2 +- nx-X11/programs/Xserver/Xi/listdev.c | 4 ++-- nx-X11/programs/Xserver/Xi/opendev.c | 2 +- nx-X11/programs/Xserver/Xi/selectev.c | 1 + nx-X11/programs/Xserver/Xi/sendexev.c | 14 +++++++------- nx-X11/programs/Xserver/Xi/setmmap.c | 3 +-- nx-X11/programs/Xserver/Xi/stubs.c | 1 - 15 files changed, 48 insertions(+), 46 deletions(-) diff --git a/nx-X11/programs/Xserver/Xi/chgfctl.c b/nx-X11/programs/Xserver/Xi/chgfctl.c index 24e30fbe6..31cb0a09e 100644 --- a/nx-X11/programs/Xserver/Xi/chgfctl.c +++ b/nx-X11/programs/Xserver/Xi/chgfctl.c @@ -147,9 +147,9 @@ ProcXChangeFeedbackControl(ClientPtr client) xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); if (client->swapped) { - if (len < (sizeof(xStringFeedbackCtl) + 3) >> 2) - return BadLength; - swaps(&f->num_keysyms); + if (len < (sizeof(xStringFeedbackCtl) + 3) >> 2) + return BadLength; + swaps(&f->num_keysyms); } if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, @@ -309,6 +309,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, if (mask & DvAutoRepeatMode) { int inx = (key >> 3); int kmask = (1 << (key & 7)); + t = (CARD8) f->auto_repeat_mode; if (t == AutoRepeatModeOff) { if (key == DO_ALL) diff --git a/nx-X11/programs/Xserver/Xi/chgprop.c b/nx-X11/programs/Xserver/Xi/chgprop.c index bdff7ceee..b8d0403bf 100644 --- a/nx-X11/programs/Xserver/Xi/chgprop.c +++ b/nx-X11/programs/Xserver/Xi/chgprop.c @@ -85,7 +85,7 @@ SProcXChangeDeviceDontPropagateList(register ClientPtr client) swapl(&stuff->window); swaps(&stuff->count); REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq, - stuff->count * sizeof(CARD32)); + stuff->count * sizeof(CARD32)); SwapLongs((CARD32 *) (&stuff[1]), stuff->count); return (ProcXChangeDeviceDontPropagateList(client)); } @@ -131,7 +131,7 @@ ProcXChangeDeviceDontPropagateList(register ClientPtr client) if (CreateMaskFromList(client, (XEventClass *) & stuff[1], stuff->count, tmp, NULL, - X_ChangeDeviceDontPropagateList) != Success) + X_ChangeDeviceDontPropagateList) != Success) return Success; others = wOtherInputMasks(pWin); diff --git a/nx-X11/programs/Xserver/Xi/devbell.c b/nx-X11/programs/Xserver/Xi/devbell.c index f594e7f36..a7091752b 100644 --- a/nx-X11/programs/Xserver/Xi/devbell.c +++ b/nx-X11/programs/Xserver/Xi/devbell.c @@ -96,7 +96,7 @@ ProcXDeviceBell(register ClientPtr client) int base; int newpercent; CARD8 class; - void *ctrl; + void * ctrl; BellProcPtr proc; REQUEST(xDeviceBellReq); @@ -125,7 +125,7 @@ ProcXDeviceBell(register ClientPtr client) } base = k->ctrl.bell; proc = k->BellProc; - ctrl = (void *)&(k->ctrl); + ctrl = (void *) &(k->ctrl); class = KbdFeedbackClass; } else if (stuff->feedbackclass == BellFeedbackClass) { for (b = dev->bell; b; b = b->next) @@ -138,7 +138,7 @@ ProcXDeviceBell(register ClientPtr client) } base = b->ctrl.percent; proc = b->BellProc; - ctrl = (void *)&(b->ctrl); + ctrl = (void *) &(b->ctrl); class = BellFeedbackClass; } else { client->errorValue = stuff->feedbackclass; diff --git a/nx-X11/programs/Xserver/Xi/exevents.c b/nx-X11/programs/Xserver/Xi/exevents.c index 7fd779aff..92b9f08ec 100644 --- a/nx-X11/programs/Xserver/Xi/exevents.c +++ b/nx-X11/programs/Xserver/Xi/exevents.c @@ -130,9 +130,10 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) } if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; + eventinfo.events = (xEventPtr) xE; eventinfo.count = count; - CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); + CallCallbacks(&DeviceEventCallback, (void *) & eventinfo); } for (i = 1; i < count; i++) if ((++xV)->type == DeviceValuator) { @@ -180,7 +181,7 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) xE->u.u.type = DeviceKeyRelease; ProcessOtherEvent(xE, other, count); xE->u.u.type = DeviceKeyPress; - /* release can have side effects, don't fall through */ + /* release can have side effects, don't fall through */ ProcessOtherEvent(xE, other, count); } return; @@ -191,7 +192,7 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) k->prev_state = k->state; for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { if (mask & modifiers) { - /* This key affects modifier "i" */ + /* This key affects modifier "i" */ k->modifierKeyCount[i]++; k->state |= mask; modifiers &= ~mask; @@ -212,7 +213,7 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) k->prev_state = k->state; for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { if (mask & modifiers) { - /* This key affects modifier "i" */ + /* This key affects modifier "i" */ if (--k->modifierKeyCount[i] <= 0) { k->modifierKeyCount[i] = 0; k->state &= ~mask; @@ -320,6 +321,7 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, } if (v) { int nval = v->numAxes - first; + ev->classes_reported |= (1 << ValuatorClass); ev->classes_reported |= (dev->valuator->mode << ModeBitsShift); ev->num_valuators = nval < 3 ? nval : 3; @@ -660,7 +662,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx) others->resource = FakeClientID(client->index); others->next = pWin->optional->inputMasks->inputClients; pWin->optional->inputMasks->inputClients = others; - if (!AddResource(others->resource, RT_INPUTCLIENT, (void *)pWin)) + if (!AddResource(others->resource, RT_INPUTCLIENT, (void *) pWin)) return BadAlloc; return Success; } @@ -721,6 +723,7 @@ int InputClientGone(register WindowPtr pWin, XID id) { register InputClientsPtr other, prev; + if (!wOtherInputMasks(pWin)) return (Success); prev = 0; @@ -876,7 +879,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen, */ if (!AllModifierKeysAreUp(dev, (*k)->modifierKeyMap, (int)(*k)->maxKeysPerModifier, inputMap, - (int)numKeyPerModifier) + (int)numKeyPerModifier) || !AllModifierKeysAreUp(dev, inputMap, (int)numKeyPerModifier, (*k)->modifierKeyMap, (int)(*k)->maxKeysPerModifier)) { @@ -1131,6 +1134,7 @@ MaybeStopDeviceHint(register DeviceIntPtr dev, ClientPtr client) { WindowPtr pWin; GrabPtr grab = dev->grab; + pWin = dev->valuator->motionHintWindow; if ((grab && SameClient(grab, client) && @@ -1140,7 +1144,7 @@ MaybeStopDeviceHint(register DeviceIntPtr dev, ClientPtr client) DevicePointerMotionHintMask)))) || (!grab && (DeviceEventMaskForClient(dev, pWin, client) & - DevicePointerMotionHintMask))) + DevicePointerMotionHintMask))) dev->valuator->motionHintWindow = NullWindow; } diff --git a/nx-X11/programs/Xserver/Xi/extinit.c b/nx-X11/programs/Xserver/Xi/extinit.c index b727cfe37..4f1a0c5ad 100644 --- a/nx-X11/programs/Xserver/Xi/extinit.c +++ b/nx-X11/programs/Xserver/Xi/extinit.c @@ -203,8 +203,8 @@ Mask PropagateMask[MAX_DEVICES]; static XExtensionVersion thisversion = {XI_Present, - SERVER_XI_MAJOR_VERSION, - SERVER_XI_MINOR_VERSION, + SERVER_XI_MAJOR_VERSION, + SERVER_XI_MINOR_VERSION, }; /********************************************************************** @@ -443,7 +443,7 @@ SProcIDispatch(register ClientPtr client) void SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) /* All we look at is the type field */ -{ /* This is common to all replies */ +{ /* This is common to all replies */ if (rep->RepType == X_GetExtensionVersion) SRepXGetExtensionVersion(client, len, (xGetExtensionVersionReply *) rep); @@ -822,7 +822,7 @@ IResetProc(ExtensionEntry * unused) * */ -void + void AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name) { dev->type = type; diff --git a/nx-X11/programs/Xserver/Xi/getselev.c b/nx-X11/programs/Xserver/Xi/getselev.c index 21f6d8090..b36b833d3 100644 --- a/nx-X11/programs/Xserver/Xi/getselev.c +++ b/nx-X11/programs/Xserver/Xi/getselev.c @@ -125,13 +125,13 @@ ProcXGetSelectedExtensionEvents(register ClientPtr client) 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); + &rep.all_clients_count, COUNT); for (others = pOthers->inputClients; others; others = others->next) if (SameClient(others, client)) { for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(NULL, others->mask[i], i, - &rep.this_client_count, COUNT); + &rep.this_client_count, COUNT); break; } diff --git a/nx-X11/programs/Xserver/Xi/grabdev.c b/nx-X11/programs/Xserver/Xi/grabdev.c index b99a44eac..dc95e7cf5 100644 --- a/nx-X11/programs/Xserver/Xi/grabdev.c +++ b/nx-X11/programs/Xserver/Xi/grabdev.c @@ -51,7 +51,6 @@ SOFTWARE. * */ - #ifdef HAVE_DIX_CONFIG_H #include #endif @@ -89,8 +88,8 @@ SProcXGrabDevice(register ClientPtr client) swaps(&stuff->event_count); if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count) - return BadLength; - + return BadLength; + SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); return (ProcXGrabDevice(client)); @@ -131,11 +130,11 @@ ProcXGrabDevice(ClientPtr client) if (CreateMaskFromList(client, (XEventClass *) & stuff[1], stuff->event_count, tmp, dev, - X_GrabDevice) != Success) + X_GrabDevice) != Success) return Success; error = GrabDevice(client, dev, stuff->this_device_mode, - stuff->other_devices_mode, stuff->grabWindow, + stuff->other_devices_mode, stuff->grabWindow, stuff->ownerEvents, stuff->time, tmp[stuff->deviceid].mask, &rep.status); @@ -147,7 +146,6 @@ ProcXGrabDevice(ClientPtr client) return Success; } - /*********************************************************************** * * This procedure creates an event mask from a list of XEventClasses. diff --git a/nx-X11/programs/Xserver/Xi/grabdevb.c b/nx-X11/programs/Xserver/Xi/grabdevb.c index 469658b23..922a819fc 100644 --- a/nx-X11/programs/Xserver/Xi/grabdevb.c +++ b/nx-X11/programs/Xserver/Xi/grabdevb.c @@ -85,7 +85,7 @@ SProcXGrabDeviceButton(register ClientPtr client) swaps(&stuff->modifiers); swaps(&stuff->event_count); REQUEST_FIXED_SIZE(xGrabDeviceButtonReq, - stuff->event_count * sizeof(CARD32)); + stuff->event_count * sizeof(CARD32)); SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); return (ProcXGrabDeviceButton(client)); @@ -139,12 +139,12 @@ ProcXGrabDeviceButton(ClientPtr client) if ((ret = CreateMaskFromList(client, class, stuff->event_count, tmp, dev, - X_GrabDeviceButton)) != Success) + 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 29498b08a..aceeec170 100644 --- a/nx-X11/programs/Xserver/Xi/grabdevk.c +++ b/nx-X11/programs/Xserver/Xi/grabdevk.c @@ -135,7 +135,7 @@ ProcXGrabDeviceKey(ClientPtr client) if ((ret = CreateMaskFromList(client, class, stuff->event_count, tmp, dev, - X_GrabDeviceKey)) != Success) + X_GrabDeviceKey)) != Success) return Success; ret = GrabKey(client, dev, stuff->this_device_mode, diff --git a/nx-X11/programs/Xserver/Xi/listdev.c b/nx-X11/programs/Xserver/Xi/listdev.c index ba32d5494..bd62fa022 100644 --- a/nx-X11/programs/Xserver/Xi/listdev.c +++ b/nx-X11/programs/Xserver/Xi/listdev.c @@ -121,7 +121,7 @@ ProcXListInputDevices(register ClientPtr client) SizeDeviceInfo(d, &namesize, &size); total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; - devbuf = (char *)calloc(1, total_length); + devbuf = (char *) calloc (1, total_length); classbuf = devbuf + (numdevs * sizeof(xDeviceInfo)); namebuf = classbuf + size; savbuf = devbuf; @@ -162,7 +162,7 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) if (d->valuator != NULL) { chunks = ((int)d->valuator->numAxes + 19) / VPC; *size += (chunks * sizeof(xValuatorInfo) + - d->valuator->numAxes * sizeof(xAxisInfo)); + d->valuator->numAxes * sizeof(xAxisInfo)); } } diff --git a/nx-X11/programs/Xserver/Xi/opendev.c b/nx-X11/programs/Xserver/Xi/opendev.c index 975ed5169..5927546de 100644 --- a/nx-X11/programs/Xserver/Xi/opendev.c +++ b/nx-X11/programs/Xserver/Xi/opendev.c @@ -163,7 +163,7 @@ ProcXOpenDevice(register ClientPtr client) rep.length = (j * sizeof(xInputClassInfo) + 3) >> 2; rep.num_classes = j; WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep); - WriteToClient(client, j * sizeof(xInputClassInfo), evbase); + WriteToClient(client, j * sizeof (xInputClassInfo), evbase); return (Success); } diff --git a/nx-X11/programs/Xserver/Xi/selectev.c b/nx-X11/programs/Xserver/Xi/selectev.c index e47b1335d..bb3d11b19 100644 --- a/nx-X11/programs/Xserver/Xi/selectev.c +++ b/nx-X11/programs/Xserver/Xi/selectev.c @@ -51,6 +51,7 @@ SOFTWARE. * */ + #ifdef HAVE_DIX_CONFIG_H #include #endif diff --git a/nx-X11/programs/Xserver/Xi/sendexev.c b/nx-X11/programs/Xserver/Xi/sendexev.c index c357fc7a5..ef7b9c4e9 100644 --- a/nx-X11/programs/Xserver/Xi/sendexev.c +++ b/nx-X11/programs/Xserver/Xi/sendexev.c @@ -94,8 +94,8 @@ SProcXSendExtensionEvent(register ClientPtr client) swaps(&stuff->count); if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count + - (stuff->num_events * (sizeof(xEvent) >> 2))) - return BadLength; + (stuff->num_events * (sizeof(xEvent) >> 2))) + return BadLength; eventP = (xEvent *) & stuff[1]; for (i = 0; i < stuff->num_events; i++, eventP++) { @@ -106,7 +106,7 @@ SProcXSendExtensionEvent(register ClientPtr client) *eventP = eventT; } - p = (CARD32 *) (((xEvent *) & stuff[1]) + stuff->num_events); + p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events); SwapLongs(p, stuff->count); return (ProcXSendExtensionEvent(client)); } @@ -146,10 +146,10 @@ ProcXSendExtensionEvent(register ClientPtr client) the previous code here returned the unitialized variable ret, so using Success we have defined returncode at least. FIXME: Upstream works different here, we must check this! - */ + */ if (stuff->num_events == 0) - /* return ret; */ - return Success; + /* return ret; */ + return Success; /* The client's event type must be one defined by an extension. */ @@ -163,7 +163,7 @@ ProcXSendExtensionEvent(register ClientPtr client) list = (XEventClass *) (first + stuff->num_events); if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev, - X_SendExtensionEvent)) != Success) + X_SendExtensionEvent)) != Success) return Success; ret = (SendEvent(client, dev, stuff->destination, diff --git a/nx-X11/programs/Xserver/Xi/setmmap.c b/nx-X11/programs/Xserver/Xi/setmmap.c index 19630b521..74e08210e 100644 --- a/nx-X11/programs/Xserver/Xi/setmmap.c +++ b/nx-X11/programs/Xserver/Xi/setmmap.c @@ -112,7 +112,7 @@ ProcXSetDeviceModifierMapping(ClientPtr client) rep.sequenceNumber = client->sequence; ret = SetModifierMapping(client, dev, stuff->length, - (sizeof(xSetDeviceModifierMappingReq) >> 2), + (sizeof(xSetDeviceModifierMappingReq) >> 2), stuff->numKeyPerModifier, (BYTE *) & stuff[1], &kp); @@ -128,7 +128,6 @@ ProcXSetDeviceModifierMapping(ClientPtr client) SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, ret); } - return Success; } diff --git a/nx-X11/programs/Xserver/Xi/stubs.c b/nx-X11/programs/Xserver/Xi/stubs.c index a45ffa51b..c25c739a2 100644 --- a/nx-X11/programs/Xserver/Xi/stubs.c +++ b/nx-X11/programs/Xserver/Xi/stubs.c @@ -99,7 +99,6 @@ ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev) return BadMatch; } - /*********************************************************************** * * Caller: ProcXChangePointerDevice -- cgit v1.2.3