diff options
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/allowev.c | 6 | ||||
-rw-r--r-- | Xi/chdevcur.c | 6 | ||||
-rw-r--r-- | Xi/chgdctl.c | 6 | ||||
-rw-r--r-- | Xi/chgfctl.c | 279 | ||||
-rw-r--r-- | Xi/chgfctl.h | 42 | ||||
-rw-r--r-- | Xi/chgkbd.c | 6 | ||||
-rw-r--r-- | Xi/chgkmap.c | 10 | ||||
-rw-r--r-- | Xi/chgprop.c | 10 | ||||
-rw-r--r-- | Xi/chgptr.c | 6 | ||||
-rw-r--r-- | Xi/chgptr.h | 8 | ||||
-rw-r--r-- | Xi/chpkpair.c | 6 | ||||
-rw-r--r-- | Xi/closedev.c | 96 | ||||
-rw-r--r-- | Xi/closedev.h | 10 | ||||
-rw-r--r-- | Xi/devbell.c | 6 | ||||
-rw-r--r-- | Xi/exevents.c | 80 | ||||
-rw-r--r-- | Xi/exglobals.h | 2 | ||||
-rw-r--r-- | Xi/extinit.c | 445 | ||||
-rw-r--r-- | Xi/getbmap.c | 8 | ||||
-rw-r--r-- | Xi/getdctl.c | 229 | ||||
-rw-r--r-- | Xi/getdctl.h | 24 | ||||
-rw-r--r-- | Xi/getfctl.c | 216 | ||||
-rw-r--r-- | Xi/getfctl.h | 30 | ||||
-rw-r--r-- | Xi/getfocus.c | 6 | ||||
-rw-r--r-- | Xi/getkmap.c | 8 | ||||
-rw-r--r-- | Xi/getmmap.c | 6 | ||||
-rw-r--r-- | Xi/getprop.c | 8 | ||||
-rw-r--r-- | Xi/getselev.c | 8 | ||||
-rw-r--r-- | Xi/getvers.c | 8 | ||||
-rw-r--r-- | Xi/grabacc.c | 2 | ||||
-rw-r--r-- | Xi/grabdev.c | 10 | ||||
-rw-r--r-- | Xi/grabdevb.c | 8 | ||||
-rw-r--r-- | Xi/grabdevk.c | 8 | ||||
-rw-r--r-- | Xi/gtmotion.c | 8 | ||||
-rw-r--r-- | Xi/listdev.c | 260 | ||||
-rw-r--r-- | Xi/listdev.h | 38 | ||||
-rw-r--r-- | Xi/opendev.c | 8 | ||||
-rw-r--r-- | Xi/querydp.c | 8 | ||||
-rw-r--r-- | Xi/queryst.c | 10 | ||||
-rw-r--r-- | Xi/selectev.c | 10 | ||||
-rw-r--r-- | Xi/sendexev.c | 10 | ||||
-rw-r--r-- | Xi/setbmap.c | 8 | ||||
-rw-r--r-- | Xi/setdval.c | 8 | ||||
-rw-r--r-- | Xi/setfocus.c | 8 | ||||
-rw-r--r-- | Xi/setmmap.c | 6 | ||||
-rw-r--r-- | Xi/setmode.c | 8 | ||||
-rw-r--r-- | Xi/stubs.c | 6 | ||||
-rw-r--r-- | Xi/ungrdev.c | 6 | ||||
-rw-r--r-- | Xi/ungrdevb.c | 4 | ||||
-rw-r--r-- | Xi/ungrdevk.c | 4 | ||||
-rw-r--r-- | Xi/warpdevp.c | 6 |
50 files changed, 935 insertions, 1084 deletions
diff --git a/Xi/allowev.c b/Xi/allowev.c index c9e4c87d2..449d8811a 100644 --- a/Xi/allowev.c +++ b/Xi/allowev.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXAllowDeviceEvents(register ClientPtr client) +SProcXAllowDeviceEvents(ClientPtr client) { - register char n; + char n; REQUEST(xAllowDeviceEventsReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXAllowDeviceEvents(register ClientPtr client) */ int -ProcXAllowDeviceEvents(register ClientPtr client) +ProcXAllowDeviceEvents(ClientPtr client) { TimeStamp time; DeviceIntPtr thisdev; diff --git a/Xi/chdevcur.c b/Xi/chdevcur.c index fc4b0e01d..e69a26613 100644 --- a/Xi/chdevcur.c +++ b/Xi/chdevcur.c @@ -59,9 +59,9 @@ from the author. */ int -SProcXChangeDeviceCursor(register ClientPtr client) +SProcXChangeDeviceCursor(ClientPtr client) { - register char n; + char n; REQUEST(xChangeDeviceCursorReq); swaps(&stuff->length, n); @@ -69,7 +69,7 @@ SProcXChangeDeviceCursor(register ClientPtr client) return (ProcXChangeDeviceCursor(client)); } -int ProcXChangeDeviceCursor(register ClientPtr client) +int ProcXChangeDeviceCursor(ClientPtr client) { int err; WindowPtr pWin = NULL; diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index 899015a02..def3b702d 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeDeviceControl(register ClientPtr client) +SProcXChangeDeviceControl(ClientPtr client) { - register char n; + char n; REQUEST(xChangeDeviceControlReq); swaps(&stuff->length, n); @@ -287,7 +287,7 @@ void SRepXChangeDeviceControl(ClientPtr client, int size, xChangeDeviceControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c index d0acc593b..2e0e13cad 100644 --- a/Xi/chgfctl.c +++ b/Xi/chgfctl.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeFeedbackControl(register ClientPtr client) +SProcXChangeFeedbackControl(ClientPtr client) { - register char n; + char n; REQUEST(xChangeFeedbackControlReq); swaps(&stuff->length, n); @@ -89,141 +89,17 @@ SProcXChangeFeedbackControl(register ClientPtr client) return (ProcXChangeFeedbackControl(client)); } -/*********************************************************************** - * - * Change the control attributes. - * - */ - -int -ProcXChangeFeedbackControl(ClientPtr client) -{ - unsigned len; - DeviceIntPtr dev; - KbdFeedbackPtr k; - PtrFeedbackPtr p; - IntegerFeedbackPtr i; - StringFeedbackPtr s; - BellFeedbackPtr b; - LedFeedbackPtr l; - - REQUEST(xChangeFeedbackControlReq); - REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); - - len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, - BadDevice); - return Success; - } - - switch (stuff->feedbackid) { - case KbdFeedbackClass: - 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]); - return Success; - } - break; - case PtrFeedbackClass: - 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]); - return Success; - } - break; - case StringFeedbackClass: - { - register char n; - xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); - - if (client->swapped) { - swaps(&f->num_keysyms, n); - } - 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]); - return Success; - } - break; - } - case IntegerFeedbackClass: - 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]); - return Success; - } - break; - case LedFeedbackClass: - 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]); - return Success; - } - break; - case BellFeedbackClass: - 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]); - return Success; - } - break; - default: - break; - } - - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); - return Success; -} - /****************************************************************************** * * This procedure changes KbdFeedbackClass data. * */ -int +static int ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, KbdFeedbackPtr k, xKbdFeedbackCtl * f) { - register char n; + char n; KeybdCtrl kctrl; int t; int key = DO_ALL; @@ -351,11 +227,11 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, * */ -int +static int ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, PtrFeedbackPtr p, xPtrFeedbackCtl * f) { - register char n; + char n; PtrCtrl pctrl; /* might get BadValue part way through */ if (client->swapped) { @@ -422,12 +298,12 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, * */ -int +static int ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, IntegerFeedbackPtr i, xIntegerFeedbackCtl * f) { - register char n; + char n; if (client->swapped) { swaps(&f->length, n); @@ -445,13 +321,13 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, StringFeedbackPtr s, xStringFeedbackCtl * f) { - register char n; - register long *p; + char n; + long *p; int i, j; KeySym *syms, *sup_syms; @@ -495,12 +371,12 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, BellFeedbackPtr b, xBellFeedbackCtl * f) { - register char n; + char n; int t; BellCtrl bctrl; /* might get BadValue part way through */ @@ -560,11 +436,11 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, LedFeedbackPtr l, xLedFeedbackCtl * f) { - register char n; + char n; LedCtrl lctrl; /* might get BadValue part way through */ if (client->swapped) { @@ -585,3 +461,128 @@ ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, return Success; } + +/*********************************************************************** + * + * Change the control attributes. + * + */ + +int +ProcXChangeFeedbackControl(ClientPtr client) +{ + unsigned len; + DeviceIntPtr dev; + KbdFeedbackPtr k; + PtrFeedbackPtr p; + IntegerFeedbackPtr i; + StringFeedbackPtr s; + BellFeedbackPtr b; + LedFeedbackPtr l; + + REQUEST(xChangeFeedbackControlReq); + REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); + + len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); + dev = LookupDeviceIntRec(stuff->deviceid); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, + BadDevice); + return Success; + } + + switch (stuff->feedbackid) { + case KbdFeedbackClass: + 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]); + return Success; + } + break; + case PtrFeedbackClass: + 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]); + return Success; + } + break; + case StringFeedbackClass: + { + char n; + xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); + + if (client->swapped) { + swaps(&f->num_keysyms, n); + } + 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]); + return Success; + } + break; + } + case IntegerFeedbackClass: + 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]); + return Success; + } + break; + case LedFeedbackClass: + 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]); + return Success; + } + break; + case BellFeedbackClass: + 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]); + return Success; + } + break; + default: + break; + } + + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); + return Success; +} + diff --git a/Xi/chgfctl.h b/Xi/chgfctl.h index 81e1153ec..cfa9fc6b0 100644 --- a/Xi/chgfctl.h +++ b/Xi/chgfctl.h @@ -36,46 +36,4 @@ int SProcXChangeFeedbackControl(ClientPtr /* client */ int ProcXChangeFeedbackControl(ClientPtr /* client */ ); -int ChangeKbdFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - KbdFeedbackPtr /* k */ , - xKbdFeedbackCtl * /* f */ - ); - -int ChangePtrFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - PtrFeedbackPtr /* p */ , - xPtrFeedbackCtl * /* f */ - ); - -int ChangeIntegerFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - IntegerFeedbackPtr /* i */ , - xIntegerFeedbackCtl * /* f */ - ); - -int ChangeStringFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - StringFeedbackPtr /* s */ , - xStringFeedbackCtl * /* f */ - ); - -int ChangeBellFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - BellFeedbackPtr /* b */ , - xBellFeedbackCtl * /* f */ - ); - -int ChangeLedFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - LedFeedbackPtr /* l */ , - xLedFeedbackCtl * /* f */ - ); - #endif /* CHGFCTL_H */ diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c index 8134b4060..2cf8225b3 100644 --- a/Xi/chgkbd.c +++ b/Xi/chgkbd.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeKeyboardDevice(register ClientPtr client) +SProcXChangeKeyboardDevice(ClientPtr client) { - register char n; + char n; REQUEST(xChangeKeyboardDeviceReq); swaps(&stuff->length, n); @@ -96,7 +96,7 @@ SProcXChangeKeyboardDevice(register ClientPtr client) */ int -ProcXChangeKeyboardDevice(register ClientPtr client) +ProcXChangeKeyboardDevice(ClientPtr client) { REQUEST(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c index 047b899ed..eac520fd4 100644 --- a/Xi/chgkmap.c +++ b/Xi/chgkmap.c @@ -76,11 +76,11 @@ SOFTWARE. */ int -SProcXChangeDeviceKeyMapping(register ClientPtr client) +SProcXChangeDeviceKeyMapping(ClientPtr client) { - register char n; - register long *p; - register int i, count; + char n; + long *p; + int i, count; REQUEST(xChangeDeviceKeyMappingReq); swaps(&stuff->length, n); @@ -101,7 +101,7 @@ SProcXChangeDeviceKeyMapping(register ClientPtr client) */ int -ProcXChangeDeviceKeyMapping(register ClientPtr client) +ProcXChangeDeviceKeyMapping(ClientPtr client) { int ret; unsigned len; diff --git a/Xi/chgprop.c b/Xi/chgprop.c index bab4597b8..59a93c60b 100644 --- a/Xi/chgprop.c +++ b/Xi/chgprop.c @@ -78,11 +78,11 @@ SOFTWARE. */ int -SProcXChangeDeviceDontPropagateList(register ClientPtr client) +SProcXChangeDeviceDontPropagateList(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xChangeDeviceDontPropagateListReq); swaps(&stuff->length, n); @@ -104,7 +104,7 @@ SProcXChangeDeviceDontPropagateList(register ClientPtr client) */ int -ProcXChangeDeviceDontPropagateList(register ClientPtr client) +ProcXChangeDeviceDontPropagateList(ClientPtr client) { int i, rc; WindowPtr pWin; diff --git a/Xi/chgptr.c b/Xi/chgptr.c index 22c8a5f5e..a94906866 100644 --- a/Xi/chgptr.c +++ b/Xi/chgptr.c @@ -82,9 +82,9 @@ SOFTWARE. */ int -SProcXChangePointerDevice(register ClientPtr client) +SProcXChangePointerDevice(ClientPtr client) { - register char n; + char n; REQUEST(xChangePointerDeviceReq); swaps(&stuff->length, n); @@ -99,7 +99,7 @@ SProcXChangePointerDevice(register ClientPtr client) */ int -ProcXChangePointerDevice(register ClientPtr client) +ProcXChangePointerDevice(ClientPtr client) { REQUEST(xChangePointerDeviceReq); REQUEST_SIZE_MATCH(xChangePointerDeviceReq); diff --git a/Xi/chgptr.h b/Xi/chgptr.h index fb3b5cc39..2d8ab66e5 100644 --- a/Xi/chgptr.h +++ b/Xi/chgptr.h @@ -45,12 +45,4 @@ void SendEventToAllWindows(DeviceIntPtr /* dev */ , int /* count */ ); -void FindInterestedChildren( /* FIXME: could be static? */ - DeviceIntPtr /* dev */ , - WindowPtr /* p1 */ , - Mask /* mask */ , - xEvent * /* ev */ , - int /* count */ - ); - #endif /* CHGPTR_H */ diff --git a/Xi/chpkpair.c b/Xi/chpkpair.c index 8e79a7502..fcbdcdf2e 100644 --- a/Xi/chpkpair.c +++ b/Xi/chpkpair.c @@ -60,9 +60,9 @@ from the author. * */ -int SProcXChangePointerKeyboardPairing(register ClientPtr client) +int SProcXChangePointerKeyboardPairing(ClientPtr client) { - register char n; + char n; REQUEST(xChangePointerKeyboardPairingReq); swaps(&stuff->length, n); @@ -70,7 +70,7 @@ int SProcXChangePointerKeyboardPairing(register ClientPtr client) } int -ProcXChangePointerKeyboardPairing(register ClientPtr client) +ProcXChangePointerKeyboardPairing(ClientPtr client) { DeviceIntPtr pPointer, pKeyboard; int ret; diff --git a/Xi/closedev.c b/Xi/closedev.c index 7bdd3730f..8aebe1043 100644 --- a/Xi/closedev.c +++ b/Xi/closedev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXCloseDevice(register ClientPtr client) +SProcXCloseDevice(ClientPtr client) { - register char n; + char n; REQUEST(xCloseDeviceReq); swaps(&stuff->length, n); @@ -89,42 +89,29 @@ SProcXCloseDevice(register ClientPtr client) /*********************************************************************** * - * This procedure closes an input device. + * Clear out event selections and passive grabs from a window for the + * specified device. * */ -int -ProcXCloseDevice(register ClientPtr client) +static void +DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) { - int i; - WindowPtr pWin, p1; - DeviceIntPtr d; - - REQUEST(xCloseDeviceReq); - REQUEST_SIZE_MATCH(xCloseDeviceReq); - - d = LookupDeviceIntRec(stuff->deviceid); - if (d == NULL) { - SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice); - return Success; - } - - if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client)) - (*d->deviceGrab.DeactivateGrab) (d); /* release active grab */ + InputClientsPtr others; + OtherInputMasks *pOthers; + GrabPtr grab, next; - /* 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. */ + if ((pOthers = wOtherInputMasks(pWin)) != 0) + for (others = pOthers->inputClients; others; others = others->next) + if (SameClient(others, client)) + others->mask[dev->id] = NoEventMask; - for (i = 0; i < screenInfo.numScreens; i++) { - pWin = WindowTable[i]; - DeleteDeviceEvents(d, pWin, client); - p1 = pWin->firstChild; - DeleteEventsFromChildren(d, p1, client); + for (grab = wPassiveGrabs(pWin); grab; grab = next) { + next = grab->next; + if ((grab->device == dev) && + (client->clientAsMask == CLIENT_BITS(grab->resource))) + FreeResource(grab->resource, RT_NONE); } - - CloseInputDevice(d, client); - return Success; } /*********************************************************************** @@ -134,7 +121,7 @@ ProcXCloseDevice(register ClientPtr client) * */ -void +static void DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) { WindowPtr p2; @@ -149,27 +136,40 @@ DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) /*********************************************************************** * - * Clear out event selections and passive grabs from a window for the - * specified device. + * This procedure closes an input device. * */ -void -DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) +int +ProcXCloseDevice(ClientPtr client) { - InputClientsPtr others; - OtherInputMasks *pOthers; - GrabPtr grab, next; + int i; + WindowPtr pWin, p1; + DeviceIntPtr d; - if ((pOthers = wOtherInputMasks(pWin)) != 0) - for (others = pOthers->inputClients; others; others = others->next) - if (SameClient(others, client)) - others->mask[dev->id] = NoEventMask; + REQUEST(xCloseDeviceReq); + REQUEST_SIZE_MATCH(xCloseDeviceReq); - for (grab = wPassiveGrabs(pWin); grab; grab = next) { - next = grab->next; - if ((grab->device == dev) && - (client->clientAsMask == CLIENT_BITS(grab->resource))) - FreeResource(grab->resource, RT_NONE); + d = LookupDeviceIntRec(stuff->deviceid); + if (d == NULL) { + SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice); + return Success; } + + if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client)) + (*d->deviceGrab.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. */ + + for (i = 0; i < screenInfo.numScreens; i++) { + pWin = WindowTable[i]; + DeleteDeviceEvents(d, pWin, client); + p1 = pWin->firstChild; + DeleteEventsFromChildren(d, p1, client); + } + + CloseInputDevice(d, client); + return Success; } diff --git a/Xi/closedev.h b/Xi/closedev.h index 6853d5002..400aaa60b 100644 --- a/Xi/closedev.h +++ b/Xi/closedev.h @@ -36,14 +36,4 @@ int SProcXCloseDevice(ClientPtr /* client */ int ProcXCloseDevice(ClientPtr /* client */ ); -void DeleteEventsFromChildren(DeviceIntPtr /* dev */ , - WindowPtr /* p1 */ , - ClientPtr /* client */ - ); - -void DeleteDeviceEvents(DeviceIntPtr /* dev */ , - WindowPtr /* pWin */ , - ClientPtr /* client */ - ); - #endif /* CLOSEDEV_H */ diff --git a/Xi/devbell.c b/Xi/devbell.c index b11238620..ba873c7c7 100644 --- a/Xi/devbell.c +++ b/Xi/devbell.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXDeviceBell(register ClientPtr client) +SProcXDeviceBell(ClientPtr client) { - register char n; + char n; REQUEST(xDeviceBellReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXDeviceBell(register ClientPtr client) */ int -ProcXDeviceBell(register ClientPtr client) +ProcXDeviceBell(ClientPtr client) { DeviceIntPtr dev; KbdFeedbackPtr k; diff --git a/Xi/exevents.c b/Xi/exevents.c index 3e3f15a1d..26f3640b7 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -319,7 +319,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count) _X_EXPORT int InitProximityClassDeviceStruct(DeviceIntPtr dev) { - register ProximityClassPtr proxc; + ProximityClassPtr proxc; proxc = (ProximityClassPtr) xalloc(sizeof(ProximityClassRec)); if (!proxc) @@ -332,7 +332,7 @@ _X_EXPORT void InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval, int resolution, int min_res, int max_res) { - register AxisInfoPtr ax; + AxisInfoPtr ax; if (!dev || !dev->valuator) return; @@ -409,7 +409,7 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, void DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, - register WindowPtr pWin) + WindowPtr pWin) { deviceFocus event; @@ -734,9 +734,9 @@ MakeInputMasks(WindowPtr pWin) void RecalculateDeviceDeliverableEvents(WindowPtr pWin) { - register InputClientsPtr others; + InputClientsPtr others; struct _OtherInputMasks *inputMasks; /* default: NULL */ - register WindowPtr pChild, tmp; + WindowPtr pChild, tmp; int i; pChild = pWin; @@ -770,9 +770,9 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin) } int -InputClientGone(register WindowPtr pWin, XID id) +InputClientGone(WindowPtr pWin, XID id) { - register InputClientsPtr other, prev; + InputClientsPtr other, prev; if (!wOtherInputMasks(pWin)) return (Success); @@ -870,7 +870,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, int SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map) { - register int i; + int i; ButtonClassPtr b = dev->button; if (b == NULL) @@ -896,7 +896,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen, { KeyCode *map = NULL; int inputMapLen; - register int i; + int i; *k = dev->key; if (*k == NULL) @@ -1025,33 +1025,7 @@ ChangeKeyMapping(ClientPtr client, return client->noClientException; } -void -DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) -{ - int i; - DeviceIntPtr dev; - InputClientsPtr ic; - struct _OtherInputMasks *inputMasks; - - for (dev = inputInfo.devices; dev; dev = dev->next) { - if (dev == inputInfo.pointer || dev == inputInfo.keyboard) - continue; - DeleteDeviceFromAnyExtEvents(pWin, dev); - } - - for (dev = inputInfo.off_devices; dev; dev = dev->next) - DeleteDeviceFromAnyExtEvents(pWin, dev); - - if (freeResources) - while ((inputMasks = wOtherInputMasks(pWin)) != 0) { - ic = inputMasks->inputClients; - for (i = 0; i < EMASKSIZE; i++) - inputMasks->dontPropagateMask[i] = 0; - FreeResource(ic->resource, RT_NONE); - } -} - -void +static void DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) { WindowPtr parent; @@ -1116,6 +1090,32 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) dev->valuator->motionHintWindow = NullWindow; } +void +DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) +{ + int i; + DeviceIntPtr dev; + InputClientsPtr ic; + struct _OtherInputMasks *inputMasks; + + for (dev = inputInfo.devices; dev; dev = dev->next) { + if (dev == inputInfo.pointer || dev == inputInfo.keyboard) + continue; + DeleteDeviceFromAnyExtEvents(pWin, dev); + } + + for (dev = inputInfo.off_devices; dev; dev = dev->next) + DeleteDeviceFromAnyExtEvents(pWin, dev); + + if (freeResources) + while ((inputMasks = wOtherInputMasks(pWin)) != 0) { + ic = inputMasks->inputClients; + for (i = 0; i < EMASKSIZE; i++) + inputMasks->dontPropagateMask[i] = 0; + FreeResource(ic->resource, RT_NONE); + } +} + int MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) { @@ -1169,10 +1169,10 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, } } -Mask +static Mask DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) { - register InputClientsPtr other; + InputClientsPtr other; if (!wOtherInputMasks(pWin)) return 0; @@ -1185,7 +1185,7 @@ DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) } void -MaybeStopDeviceHint(register DeviceIntPtr dev, ClientPtr client) +MaybeStopDeviceHint(DeviceIntPtr dev, ClientPtr client) { WindowPtr pWin; GrabPtr grab = dev->deviceGrab.grab; @@ -1254,7 +1254,7 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents) * */ -void +static void FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, xEvent * ev, int count) { diff --git a/Xi/exglobals.h b/Xi/exglobals.h index 811375e25..8fcd907a3 100644 --- a/Xi/exglobals.h +++ b/Xi/exglobals.h @@ -37,7 +37,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. extern int IReqCode; extern int BadDevice; -extern int BadEvent; extern int BadMode; extern int DeviceBusy; extern int BadClass; @@ -46,7 +45,6 @@ extern Mask DevicePointerMotionMask; extern Mask DevicePointerMotionHintMask; extern Mask DeviceFocusChangeMask; extern Mask DeviceStateNotifyMask; -extern Mask ChangeDeviceNotifyMask; extern Mask DeviceMappingNotifyMask; extern Mask DeviceOwnerGrabButtonMask; extern Mask DeviceButtonGrabMask; diff --git a/Xi/extinit.c b/Xi/extinit.c index 971617ebb..9d921fa07 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -127,7 +127,7 @@ int ExtEventIndex; Mask ExtValidMasks[EMASKSIZE]; Mask ExtExclusiveMasks[EMASKSIZE]; -struct dev_type +static struct dev_type { Atom type; char *name; @@ -163,7 +163,7 @@ XExtEventInfo EventInfo[32]; int IReqCode = 0; int BadDevice = 0; -int BadEvent = 1; +static int BadEvent = 1; int BadMode = 2; int DeviceBusy = 3; int BadClass = 4; @@ -172,7 +172,7 @@ Mask DevicePointerMotionMask; Mask DevicePointerMotionHintMask; Mask DeviceFocusChangeMask; Mask DeviceStateNotifyMask; -Mask ChangeDeviceNotifyMask; +static Mask ChangeDeviceNotifyMask; Mask DeviceMappingNotifyMask; Mask DeviceOwnerGrabButtonMask; Mask DeviceButtonGrabMask; @@ -225,54 +225,6 @@ static XExtensionVersion thisversion = { XI_Present, XI_Add_DevicePresenceNotify_Minor }; -/********************************************************************** - * - * IExtensionInit - initialize the input extension. - * - * Called from InitExtensions in main() or from QueryExtension() if the - * extension is dynamically loaded. - * - * This extension has several events and errors. - * - */ - -void -XInputExtensionInit(void) -{ - ExtensionEntry *extEntry; - - extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, - SProcIDispatch, IResetProc, StandardMinorOpcode); - if (extEntry) { - IReqCode = extEntry->base; - AllExtensionVersions[IReqCode - 128] = thisversion; - MakeDeviceTypeAtoms(); - RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); - FixExtensionEvents(extEntry); - ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; - EventSwapVector[DeviceValuator] = SEventIDispatch; - EventSwapVector[DeviceKeyPress] = SEventIDispatch; - EventSwapVector[DeviceKeyRelease] = SEventIDispatch; - EventSwapVector[DeviceButtonPress] = SEventIDispatch; - EventSwapVector[DeviceButtonRelease] = SEventIDispatch; - EventSwapVector[DeviceMotionNotify] = SEventIDispatch; - EventSwapVector[DeviceFocusIn] = SEventIDispatch; - EventSwapVector[DeviceFocusOut] = SEventIDispatch; - EventSwapVector[ProximityIn] = SEventIDispatch; - EventSwapVector[ProximityOut] = SEventIDispatch; - EventSwapVector[DeviceStateNotify] = SEventIDispatch; - EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; - EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; - EventSwapVector[DeviceMappingNotify] = SEventIDispatch; - EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; - EventSwapVector[DeviceEnterNotify] = SEventIDispatch; - EventSwapVector[DeviceLeaveNotify] = SEventIDispatch; - EventSwapVector[PointerKeyboardPairingChangedNotify] = SEventIDispatch; - } else { - FatalError("IExtensionInit: AddExtensions failed\n"); - } -} - /************************************************************************* * * ProcIDispatch - main dispatch routine for requests to this extension. @@ -280,8 +232,8 @@ XInputExtensionInit(void) * */ -int -ProcIDispatch(register ClientPtr client) +static int +ProcIDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data == X_GetExtensionVersion) @@ -391,8 +343,8 @@ ProcIDispatch(register ClientPtr client) * */ -int -SProcIDispatch(register ClientPtr client) +static int +SProcIDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data == X_GetExtensionVersion) @@ -505,7 +457,7 @@ SProcIDispatch(register ClientPtr client) if (rep->RepType == X_##code) \ SRepX##code (client, len, (x##code##Reply *) rep) -void +static void SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) /* All we look at is the type field */ { /* This is common to all replies */ @@ -580,78 +532,17 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) } } -/***************************************************************************** - * - * SEventIDispatch - * - * Swap any events defined in this extension. - */ -#define DO_SWAP(func,type) func ((type *)from, (type *)to) - -void -SEventIDispatch(xEvent * from, xEvent * to) -{ - int type = from->u.u.type & 0177; - - if (type == DeviceValuator) - DO_SWAP(SEventDeviceValuator, deviceValuator); - else if (type == DeviceKeyPress) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceKeyRelease) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceButtonPress) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceButtonRelease) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceMotionNotify) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceFocusIn) - DO_SWAP(SEventFocus, deviceFocus); - else if (type == DeviceFocusOut) - DO_SWAP(SEventFocus, deviceFocus); - else if (type == ProximityIn) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == ProximityOut) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceStateNotify) - DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); - else if (type == DeviceKeyStateNotify) - DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); - else if (type == DeviceButtonStateNotify) - DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); - else if (type == DeviceMappingNotify) - DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); - else if (type == ChangeDeviceNotify) - DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); - else if (type == DeviceEnterNotify) - DO_SWAP(SDeviceEnterNotifyEvent, deviceEnterNotify); - else if (type == DeviceLeaveNotify) - DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify); - else if (type == PointerKeyboardPairingChangedNotify) - DO_SWAP(SPointerKeyboardPairingChangedNotifyEvent, pairingChangedNotify); - else { - FatalError("XInputExtension: Impossible event!\n"); - } -} - /************************************************************************ * * This function swaps the DeviceValuator event. * */ -void +static void SEventDeviceValuator(deviceValuator * from, deviceValuator * to) { - register char n; - register int i; + char n; + int i; INT32 *ip B32; *to = *from; @@ -663,10 +554,10 @@ SEventDeviceValuator(deviceValuator * from, deviceValuator * to) } } -void +static void SEventFocus(deviceFocus * from, deviceFocus * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); @@ -674,11 +565,11 @@ SEventFocus(deviceFocus * from, deviceFocus * to) swapl(&to->window, n); } -void +static void SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) { - register int i; - register char n; + int i; + char n; INT32 *ip B32; *to = *from; @@ -690,50 +581,50 @@ SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) } } -void +static void SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from, deviceKeyStateNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); } -void +static void SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, deviceButtonStateNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); } -void +static void SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); swapl(&to->time, n); } -void +static void SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); swapl(&to->time, n); } -void +static void SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber,n); @@ -741,18 +632,20 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to swaps(&to->control, n); } -void SDeviceEnterNotifyEvent (deviceEnterNotify *from, deviceEnterNotify *to) +static void +SDeviceEnterNotifyEvent (deviceEnterNotify *from, deviceEnterNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber,n); swapl(&to->time, n); } -void SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to) +static void +SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber,n); @@ -766,23 +659,117 @@ void SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to) swaps(&to->eventY, n); } -void SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify *from, +static void +SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify *from, pairingChangedNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); swapl(&to->time, n); } +/************************************************************************** + * + * Allow the specified event to have its propagation suppressed. + * The default is to not allow suppression of propagation. + * + */ + +static void +AllowPropagateSuppress(Mask mask) +{ + int i; + + for (i = 0; i < MAX_DEVICES; i++) + PropagateMask[i] |= mask; +} + +/************************************************************************** + * + * Return the next available extension event mask. + * + */ + +static Mask +GetNextExtEventMask(void) +{ + int i; + Mask mask = lastExtEventMask; + + if (lastExtEventMask == 0) { + FatalError("GetNextExtEventMask: no more events are available."); + } + lastExtEventMask <<= 1; + + for (i = 0; i < MAX_DEVICES; i++) + ExtValidMasks[i] |= mask; + return mask; +} + +/************************************************************************** + * + * Record an event mask where there is no unique corresponding event type. + * We can't call SetMaskForEvent, since that would clobber the existing + * mask for that event. MotionHint and ButtonMotion are examples. + * + * Since extension event types will never be less than 64, we can use + * 0-63 in the EventInfo array as the "type" to be used to look up this + * mask. This means that the corresponding macros such as + * DevicePointerMotionHint must have access to the same constants. + * + */ + +static void +SetEventInfo(Mask mask, int constant) +{ + EventInfo[ExtEventIndex].mask = mask; + EventInfo[ExtEventIndex++].type = constant; +} + +/************************************************************************** + * + * Allow the specified event to be restricted to being selected by one + * client at a time. + * The default is to allow more than one client to select the event. + * + */ + +static void +SetExclusiveAccess(Mask mask) +{ + int i; + + for (i = 0; i < MAX_DEVICES; i++) + ExtExclusiveMasks[i] |= mask; +} + +/************************************************************************** + * + * Assign the specified mask to the specified event. + * + */ + +static void +SetMaskForExtEvent(Mask mask, int event) +{ + + EventInfo[ExtEventIndex].mask = mask; + EventInfo[ExtEventIndex++].type = event; + + if ((event < LASTEvent) || (event >= 128)) + FatalError("MaskForExtensionEvent: bogus event number"); + SetMaskForEvent(mask, event); +} + /************************************************************************ * * This function sets up extension event types and masks. * */ -void +static void FixExtensionEvents(ExtensionEntry * extEntry) { Mask mask; @@ -905,7 +892,7 @@ FixExtensionEvents(ExtensionEntry * extEntry) * */ -void +static void RestoreExtensionEvents(void) { int i; @@ -956,7 +943,7 @@ RestoreExtensionEvents(void) * */ -void +static void IResetProc(ExtensionEntry * unused) { @@ -989,7 +976,7 @@ IResetProc(ExtensionEntry * unused) * */ -Bool +_X_EXPORT Bool DeviceIsPointerType(DeviceIntPtr dev) { if (dev_type[1].type == dev->type) @@ -1019,7 +1006,7 @@ AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name) * */ -void +static void MakeDeviceTypeAtoms(void) { int i; @@ -1052,95 +1039,113 @@ LookupDeviceIntRec(CARD8 id) return NULL; } -/************************************************************************** - * - * Allow the specified event to be restricted to being selected by one - * client at a time. - * The default is to allow more than one client to select the event. - * - */ - -void -SetExclusiveAccess(Mask mask) -{ - int i; - - for (i = 0; i < MAX_DEVICES; i++) - ExtExclusiveMasks[i] |= mask; -} - -/************************************************************************** - * - * Allow the specified event to have its propagation suppressed. - * The default is to not allow suppression of propagation. - * - */ - -void -AllowPropagateSuppress(Mask mask) -{ - int i; - - for (i = 0; i < MAX_DEVICES; i++) - PropagateMask[i] |= mask; -} - -/************************************************************************** +/***************************************************************************** * - * Return the next available extension event mask. + * SEventIDispatch * + * Swap any events defined in this extension. */ +#define DO_SWAP(func,type) func ((type *)from, (type *)to) -Mask -GetNextExtEventMask(void) +static void +SEventIDispatch(xEvent * from, xEvent * to) { - int i; - Mask mask = lastExtEventMask; + int type = from->u.u.type & 0177; - if (lastExtEventMask == 0) { - FatalError("GetNextExtEventMask: no more events are available."); + if (type == DeviceValuator) + DO_SWAP(SEventDeviceValuator, deviceValuator); + else if (type == DeviceKeyPress) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceKeyRelease) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceButtonPress) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceButtonRelease) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceMotionNotify) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceFocusIn) + DO_SWAP(SEventFocus, deviceFocus); + else if (type == DeviceFocusOut) + DO_SWAP(SEventFocus, deviceFocus); + else if (type == ProximityIn) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == ProximityOut) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceStateNotify) + DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); + else if (type == DeviceKeyStateNotify) + DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); + else if (type == DeviceButtonStateNotify) + DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); + else if (type == DeviceMappingNotify) + DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); + else if (type == ChangeDeviceNotify) + DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); + else if (type == DevicePresenceNotify) + DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify); + else if (type == DeviceEnterNotify) + DO_SWAP(SDeviceEnterNotifyEvent, deviceEnterNotify); + else if (type == DeviceLeaveNotify) + DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify); + else if (type == PointerKeyboardPairingChangedNotify) + DO_SWAP(SPointerKeyboardPairingChangedNotifyEvent, pairingChangedNotify); + else { + FatalError("XInputExtension: Impossible event!\n"); } - lastExtEventMask <<= 1; - - for (i = 0; i < MAX_DEVICES; i++) - ExtValidMasks[i] |= mask; - return mask; } -/************************************************************************** - * - * Assign the specified mask to the specified event. +/********************************************************************** * - */ - -void -SetMaskForExtEvent(Mask mask, int event) -{ - - EventInfo[ExtEventIndex].mask = mask; - EventInfo[ExtEventIndex++].type = event; - - if ((event < LASTEvent) || (event >= 128)) - FatalError("MaskForExtensionEvent: bogus event number"); - SetMaskForEvent(mask, event); -} - -/************************************************************************** + * IExtensionInit - initialize the input extension. * - * Record an event mask where there is no unique corresponding event type. - * We can't call SetMaskForEvent, since that would clobber the existing - * mask for that event. MotionHint and ButtonMotion are examples. + * Called from InitExtensions in main() or from QueryExtension() if the + * extension is dynamically loaded. * - * Since extension event types will never be less than 64, we can use - * 0-63 in the EventInfo array as the "type" to be used to look up this - * mask. This means that the corresponding macros such as - * DevicePointerMotionHint must have access to the same constants. + * This extension has several events and errors. * */ void -SetEventInfo(Mask mask, int constant) +XInputExtensionInit(void) { - EventInfo[ExtEventIndex].mask = mask; - EventInfo[ExtEventIndex++].type = constant; + ExtensionEntry *extEntry; + + extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, + SProcIDispatch, IResetProc, StandardMinorOpcode); + if (extEntry) { + IReqCode = extEntry->base; + AllExtensionVersions[IReqCode - 128] = thisversion; + MakeDeviceTypeAtoms(); + RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); + FixExtensionEvents(extEntry); + ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; + EventSwapVector[DeviceValuator] = SEventIDispatch; + EventSwapVector[DeviceKeyPress] = SEventIDispatch; + EventSwapVector[DeviceKeyRelease] = SEventIDispatch; + EventSwapVector[DeviceButtonPress] = SEventIDispatch; + EventSwapVector[DeviceButtonRelease] = SEventIDispatch; + EventSwapVector[DeviceMotionNotify] = SEventIDispatch; + EventSwapVector[DeviceFocusIn] = SEventIDispatch; + EventSwapVector[DeviceFocusOut] = SEventIDispatch; + EventSwapVector[ProximityIn] = SEventIDispatch; + EventSwapVector[ProximityOut] = SEventIDispatch; + EventSwapVector[DeviceStateNotify] = SEventIDispatch; + EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; + EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; + EventSwapVector[DeviceMappingNotify] = SEventIDispatch; + EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; + EventSwapVector[DeviceEnterNotify] = SEventIDispatch; + EventSwapVector[DeviceLeaveNotify] = SEventIDispatch; + EventSwapVector[PointerKeyboardPairingChangedNotify] = SEventIDispatch; + } else { + FatalError("IExtensionInit: AddExtensions failed\n"); + } } diff --git a/Xi/getbmap.c b/Xi/getbmap.c index 32874764b..5e8cf07fb 100644 --- a/Xi/getbmap.c +++ b/Xi/getbmap.c @@ -74,9 +74,9 @@ SOFTWARE. */ int -SProcXGetDeviceButtonMapping(register ClientPtr client) +SProcXGetDeviceButtonMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceButtonMappingReq); swaps(&stuff->length, n); @@ -90,7 +90,7 @@ SProcXGetDeviceButtonMapping(register ClientPtr client) */ int -ProcXGetDeviceButtonMapping(register ClientPtr client) +ProcXGetDeviceButtonMapping(ClientPtr client) { DeviceIntPtr dev; xGetDeviceButtonMappingReply rep; @@ -136,7 +136,7 @@ void SRepXGetDeviceButtonMapping(ClientPtr client, int size, xGetDeviceButtonMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getdctl.c b/Xi/getdctl.c index d738ef83b..88f061ee0 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceControl(register ClientPtr client) +SProcXGetDeviceControl(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceControlReq); swaps(&stuff->length, n); @@ -88,116 +88,15 @@ SProcXGetDeviceControl(register ClientPtr client) /*********************************************************************** * - * Get the state of the specified device control. - * - */ - -int -ProcXGetDeviceControl(ClientPtr client) -{ - int total_length = 0; - char *buf, *savbuf; - register DeviceIntPtr dev; - xGetDeviceControlReply rep; - - REQUEST(xGetDeviceControlReq); - REQUEST_SIZE_MATCH(xGetDeviceControlReq); - - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice); - return Success; - } - - rep.repType = X_Reply; - rep.RepType = X_GetDeviceControl; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - switch (stuff->control) { - case DEVICE_RESOLUTION: - if (!dev->valuator) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, - BadMatch); - return Success; - } - total_length = sizeof(xDeviceResolutionState) + - (3 * sizeof(int) * dev->valuator->numAxes); - break; - case DEVICE_ABS_CALIB: - if (!dev->absolute) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, - BadMatch); - return Success; - } - - total_length = sizeof(xDeviceAbsCalibCtl); - break; - case DEVICE_ABS_AREA: - if (!dev->absolute) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, - BadMatch); - return Success; - } - - total_length = sizeof(xDeviceAbsAreaCtl); - break; - case DEVICE_CORE: - total_length = sizeof(xDeviceCoreCtl); - break; - case DEVICE_ENABLE: - total_length = sizeof(xDeviceEnableCtl); - break; - default: - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); - return Success; - } - - buf = (char *)xalloc(total_length); - if (!buf) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc); - return Success; - } - savbuf = buf; - - switch (stuff->control) { - case DEVICE_RESOLUTION: - CopySwapDeviceResolution(client, dev->valuator, buf, total_length); - break; - case DEVICE_ABS_CALIB: - CopySwapDeviceAbsCalib(client, dev->absolute, buf); - break; - case DEVICE_ABS_AREA: - CopySwapDeviceAbsArea(client, dev->absolute, buf); - break; - case DEVICE_CORE: - CopySwapDeviceCore(client, dev, buf); - break; - case DEVICE_ENABLE: - CopySwapDeviceEnable(client, dev, buf); - break; - default: - break; - } - - rep.length = (total_length + 3) >> 2; - WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep); - WriteToClient(client, total_length, savbuf); - xfree(savbuf); - return Success; -} - -/*********************************************************************** - * * This procedure copies DeviceResolution data, swapping if necessary. * */ -void +static void CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, int length) { - register char n; + char n; AxisInfoPtr a; xDeviceResolutionState *r; int i, *iptr; @@ -225,10 +124,10 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, } } -void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, +static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, char *buf) { - register char n; + char n; xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf; calib->control = DEVICE_ABS_CALIB; @@ -256,10 +155,10 @@ void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, } } -void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, +static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, char *buf) { - register char n; + char n; xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf; area->control = DEVICE_ABS_AREA; @@ -283,9 +182,9 @@ void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, } } -void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) +static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) { - register char n; + char n; xDeviceCoreState *c = (xDeviceCoreState *) buf; c->control = DEVICE_CORE; @@ -300,9 +199,9 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) } } -void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) +static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) { - register char n; + char n; xDeviceEnableState *e = (xDeviceEnableState *) buf; e->control = DEVICE_ENABLE; @@ -316,7 +215,6 @@ void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) } } - /*********************************************************************** * * This procedure writes the reply for the xGetDeviceControl function, @@ -327,9 +225,110 @@ void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) void SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); WriteToClient(client, size, (char *)rep); } + +/*********************************************************************** + * + * Get the state of the specified device control. + * + */ + +int +ProcXGetDeviceControl(ClientPtr client) +{ + int total_length = 0; + char *buf, *savbuf; + DeviceIntPtr dev; + xGetDeviceControlReply rep; + + REQUEST(xGetDeviceControlReq); + REQUEST_SIZE_MATCH(xGetDeviceControlReq); + + dev = LookupDeviceIntRec(stuff->deviceid); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice); + return Success; + } + + rep.repType = X_Reply; + rep.RepType = X_GetDeviceControl; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + switch (stuff->control) { + case DEVICE_RESOLUTION: + if (!dev->valuator) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, + BadMatch); + return Success; + } + total_length = sizeof(xDeviceResolutionState) + + (3 * sizeof(int) * dev->valuator->numAxes); + break; + case DEVICE_ABS_CALIB: + if (!dev->absolute) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, + BadMatch); + return Success; + } + + total_length = sizeof(xDeviceAbsCalibCtl); + break; + case DEVICE_ABS_AREA: + if (!dev->absolute) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, + BadMatch); + return Success; + } + + total_length = sizeof(xDeviceAbsAreaCtl); + break; + case DEVICE_CORE: + total_length = sizeof(xDeviceCoreCtl); + break; + case DEVICE_ENABLE: + total_length = sizeof(xDeviceEnableCtl); + break; + default: + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); + return Success; + } + + buf = (char *)xalloc(total_length); + if (!buf) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc); + return Success; + } + savbuf = buf; + + switch (stuff->control) { + case DEVICE_RESOLUTION: + CopySwapDeviceResolution(client, dev->valuator, buf, total_length); + break; + case DEVICE_ABS_CALIB: + CopySwapDeviceAbsCalib(client, dev->absolute, buf); + break; + case DEVICE_ABS_AREA: + CopySwapDeviceAbsArea(client, dev->absolute, buf); + break; + case DEVICE_CORE: + CopySwapDeviceCore(client, dev, buf); + break; + case DEVICE_ENABLE: + CopySwapDeviceEnable(client, dev, buf); + break; + default: + break; + } + + rep.length = (total_length + 3) >> 2; + WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep); + WriteToClient(client, total_length, savbuf); + xfree(savbuf); + return Success; +} diff --git a/Xi/getdctl.h b/Xi/getdctl.h index 36868d8be..19c189f36 100644 --- a/Xi/getdctl.h +++ b/Xi/getdctl.h @@ -36,30 +36,6 @@ int SProcXGetDeviceControl(ClientPtr /* client */ int ProcXGetDeviceControl(ClientPtr /* client */ ); -void CopySwapDeviceResolution(ClientPtr /* client */ , - ValuatorClassPtr /* v */ , - char * /* buf */ , - int /* length */ - ); - -void CopySwapDeviceAbsCalib (ClientPtr client, - AbsoluteClassPtr dts, - char *buf); - -void CopySwapDeviceAbsArea (ClientPtr client, - AbsoluteClassPtr dts, - char *buf); - -void CopySwapDeviceCore(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - char * /* buf */ - ); - -void CopySwapDeviceEnable(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - char * /* buf */ - ); - void SRepXGetDeviceControl(ClientPtr /* client */ , int /* size */ , xGetDeviceControlReply * /* rep */ diff --git a/Xi/getfctl.c b/Xi/getfctl.c index 870348fbb..5ca90dbf0 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetFeedbackControl(register ClientPtr client) +SProcXGetFeedbackControl(ClientPtr client) { - register char n; + char n; REQUEST(xGetFeedbackControlReq); swaps(&stuff->length, n); @@ -86,108 +86,15 @@ SProcXGetFeedbackControl(register ClientPtr client) /*********************************************************************** * - * Get the feedback control state. - * - */ - -int -ProcXGetFeedbackControl(ClientPtr client) -{ - int total_length = 0; - char *buf, *savbuf; - register DeviceIntPtr dev; - KbdFeedbackPtr k; - PtrFeedbackPtr p; - IntegerFeedbackPtr i; - StringFeedbackPtr s; - BellFeedbackPtr b; - LedFeedbackPtr l; - xGetFeedbackControlReply rep; - - REQUEST(xGetFeedbackControlReq); - REQUEST_SIZE_MATCH(xGetFeedbackControlReq); - - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice); - return Success; - } - - rep.repType = X_Reply; - rep.RepType = X_GetFeedbackControl; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.num_feedbacks = 0; - - for (k = dev->kbdfeed; k; k = k->next) { - rep.num_feedbacks++; - total_length += sizeof(xKbdFeedbackState); - } - for (p = dev->ptrfeed; p; p = p->next) { - rep.num_feedbacks++; - total_length += sizeof(xPtrFeedbackState); - } - 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) { - rep.num_feedbacks++; - total_length += sizeof(xIntegerFeedbackState); - } - for (l = dev->leds; l; l = l->next) { - rep.num_feedbacks++; - total_length += sizeof(xLedFeedbackState); - } - 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); - return Success; - } - - buf = (char *)xalloc(total_length); - if (!buf) { - SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc); - return Success; - } - savbuf = buf; - - for (k = dev->kbdfeed; k; k = k->next) - CopySwapKbdFeedback(client, k, &buf); - for (p = dev->ptrfeed; p; p = p->next) - CopySwapPtrFeedback(client, p, &buf); - for (s = dev->stringfeed; s; s = s->next) - CopySwapStringFeedback(client, s, &buf); - for (i = dev->intfeed; i; i = i->next) - CopySwapIntegerFeedback(client, i, &buf); - for (l = dev->leds; l; l = l->next) - CopySwapLedFeedback(client, l, &buf); - for (b = dev->bell; b; b = b->next) - CopySwapBellFeedback(client, b, &buf); - - rep.length = (total_length + 3) >> 2; - WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep); - WriteToClient(client, total_length, savbuf); - xfree(savbuf); - return Success; -} - -/*********************************************************************** - * * This procedure copies KbdFeedbackClass data, swapping if necessary. * */ -void +static void CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) { int i; - register char n; + char n; xKbdFeedbackState *k2; k2 = (xKbdFeedbackState *) * buf; @@ -218,10 +125,10 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) * */ -void +static void CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) { - register char n; + char n; xPtrFeedbackState *p2; p2 = (xPtrFeedbackState *) * buf; @@ -246,10 +153,10 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) * */ -void +static void CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) { - register char n; + char n; xIntegerFeedbackState *i2; i2 = (xIntegerFeedbackState *) * buf; @@ -274,11 +181,11 @@ CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) * */ -void +static void CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) { int i; - register char n; + char n; xStringFeedbackState *s2; KeySym *kptr; @@ -311,10 +218,10 @@ CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) * */ -void +static void CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) { - register char n; + char n; xLedFeedbackState *l2; l2 = (xLedFeedbackState *) * buf; @@ -337,10 +244,10 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) * */ -void +static void CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf) { - register char n; + char n; xBellFeedbackState *b2; b2 = (xBellFeedbackState *) * buf; @@ -369,10 +276,103 @@ void SRepXGetFeedbackControl(ClientPtr client, int size, xGetFeedbackControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); swaps(&rep->num_feedbacks, n); WriteToClient(client, size, (char *)rep); } + +/*********************************************************************** + * + * Get the feedback control state. + * + */ + +int +ProcXGetFeedbackControl(ClientPtr client) +{ + int total_length = 0; + char *buf, *savbuf; + DeviceIntPtr dev; + KbdFeedbackPtr k; + PtrFeedbackPtr p; + IntegerFeedbackPtr i; + StringFeedbackPtr s; + BellFeedbackPtr b; + LedFeedbackPtr l; + xGetFeedbackControlReply rep; + + REQUEST(xGetFeedbackControlReq); + REQUEST_SIZE_MATCH(xGetFeedbackControlReq); + + dev = LookupDeviceIntRec(stuff->deviceid); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice); + return Success; + } + + rep.repType = X_Reply; + rep.RepType = X_GetFeedbackControl; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.num_feedbacks = 0; + + for (k = dev->kbdfeed; k; k = k->next) { + rep.num_feedbacks++; + total_length += sizeof(xKbdFeedbackState); + } + for (p = dev->ptrfeed; p; p = p->next) { + rep.num_feedbacks++; + total_length += sizeof(xPtrFeedbackState); + } + 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) { + rep.num_feedbacks++; + total_length += sizeof(xIntegerFeedbackState); + } + for (l = dev->leds; l; l = l->next) { + rep.num_feedbacks++; + total_length += sizeof(xLedFeedbackState); + } + 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); + return Success; + } + + buf = (char *)xalloc(total_length); + if (!buf) { + SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc); + return Success; + } + savbuf = buf; + + for (k = dev->kbdfeed; k; k = k->next) + CopySwapKbdFeedback(client, k, &buf); + for (p = dev->ptrfeed; p; p = p->next) + CopySwapPtrFeedback(client, p, &buf); + for (s = dev->stringfeed; s; s = s->next) + CopySwapStringFeedback(client, s, &buf); + for (i = dev->intfeed; i; i = i->next) + CopySwapIntegerFeedback(client, i, &buf); + for (l = dev->leds; l; l = l->next) + CopySwapLedFeedback(client, l, &buf); + for (b = dev->bell; b; b = b->next) + CopySwapBellFeedback(client, b, &buf); + + rep.length = (total_length + 3) >> 2; + WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep); + WriteToClient(client, total_length, savbuf); + xfree(savbuf); + return Success; +} diff --git a/Xi/getfctl.h b/Xi/getfctl.h index 7d2d17ab1..0ad58aa2b 100644 --- a/Xi/getfctl.h +++ b/Xi/getfctl.h @@ -36,36 +36,6 @@ int SProcXGetFeedbackControl(ClientPtr /* client */ int ProcXGetFeedbackControl(ClientPtr /* client */ ); -void CopySwapKbdFeedback(ClientPtr /* client */ , - KbdFeedbackPtr /* k */ , - char ** /* buf */ - ); - -void CopySwapPtrFeedback(ClientPtr /* client */ , - PtrFeedbackPtr /* p */ , - char ** /* buf */ - ); - -void CopySwapIntegerFeedback(ClientPtr /* client */ , - IntegerFeedbackPtr /* i */ , - char ** /* buf */ - ); - -void CopySwapStringFeedback(ClientPtr /* client */ , - StringFeedbackPtr /* s */ , - char ** /* buf */ - ); - -void CopySwapLedFeedback(ClientPtr /* client */ , - LedFeedbackPtr /* l */ , - char ** /* buf */ - ); - -void CopySwapBellFeedback(ClientPtr /* client */ , - BellFeedbackPtr /* b */ , - char ** /* buf */ - ); - void SRepXGetFeedbackControl(ClientPtr /* client */ , int /* size */ , xGetFeedbackControlReply * /* rep */ diff --git a/Xi/getfocus.c b/Xi/getfocus.c index 1bcb67321..245b5f1b4 100644 --- a/Xi/getfocus.c +++ b/Xi/getfocus.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceFocus(register ClientPtr client) +SProcXGetDeviceFocus(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceFocusReq); swaps(&stuff->length, n); @@ -138,7 +138,7 @@ ProcXGetDeviceFocus(ClientPtr client) void SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getkmap.c b/Xi/getkmap.c index 041e2c69f..989f3d57d 100644 --- a/Xi/getkmap.c +++ b/Xi/getkmap.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXGetDeviceKeyMapping(register ClientPtr client) +SProcXGetDeviceKeyMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceKeyMappingReq); swaps(&stuff->length, n); @@ -92,7 +92,7 @@ SProcXGetDeviceKeyMapping(register ClientPtr client) */ int -ProcXGetDeviceKeyMapping(register ClientPtr client) +ProcXGetDeviceKeyMapping(ClientPtr client) { xGetDeviceKeyMappingReply rep; DeviceIntPtr dev; @@ -154,7 +154,7 @@ void SRepXGetDeviceKeyMapping(ClientPtr client, int size, xGetDeviceKeyMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getmmap.c b/Xi/getmmap.c index e664dc910..038937ef7 100644 --- a/Xi/getmmap.c +++ b/Xi/getmmap.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceModifierMapping(register ClientPtr client) +SProcXGetDeviceModifierMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceModifierMappingReq); swaps(&stuff->length, n); @@ -141,7 +141,7 @@ void SRepXGetDeviceModifierMapping(ClientPtr client, int size, xGetDeviceModifierMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getprop.c b/Xi/getprop.c index 058c59514..6fa1986f4 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -79,9 +79,9 @@ extern int ExtEventIndex; */ int -SProcXGetDeviceDontPropagateList(register ClientPtr client) +SProcXGetDeviceDontPropagateList(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceDontPropagateListReq); swaps(&stuff->length, n); @@ -97,7 +97,7 @@ SProcXGetDeviceDontPropagateList(register ClientPtr client) */ int -ProcXGetDeviceDontPropagateList(register ClientPtr client) +ProcXGetDeviceDontPropagateList(ClientPtr client) { CARD16 count = 0; int i, rc; @@ -187,7 +187,7 @@ void SRepXGetDeviceDontPropagateList(ClientPtr client, int size, xGetDeviceDontPropagateListReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getselev.c b/Xi/getselev.c index 533c66cd7..9c5f2191c 100644 --- a/Xi/getselev.c +++ b/Xi/getselev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXGetSelectedExtensionEvents(register ClientPtr client) +SProcXGetSelectedExtensionEvents(ClientPtr client) { - register char n; + char n; REQUEST(xGetSelectedExtensionEventsReq); swaps(&stuff->length, n); @@ -96,7 +96,7 @@ SProcXGetSelectedExtensionEvents(register ClientPtr client) */ int -ProcXGetSelectedExtensionEvents(register ClientPtr client) +ProcXGetSelectedExtensionEvents(ClientPtr client) { int i, rc, total_length = 0; xGetSelectedExtensionEventsReply rep; @@ -177,7 +177,7 @@ void SRepXGetSelectedExtensionEvents(ClientPtr client, int size, xGetSelectedExtensionEventsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getvers.c b/Xi/getvers.c index c5f1750be..b3f4c1c67 100644 --- a/Xi/getvers.c +++ b/Xi/getvers.c @@ -76,9 +76,9 @@ XExtensionVersion AllExtensionVersions[128]; */ int -SProcXGetExtensionVersion(register ClientPtr client) +SProcXGetExtensionVersion(ClientPtr client) { - register char n; + char n; REQUEST(xGetExtensionVersionReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXGetExtensionVersion(register ClientPtr client) */ int -ProcXGetExtensionVersion(register ClientPtr client) +ProcXGetExtensionVersion(ClientPtr client) { xGetExtensionVersionReply rep; @@ -136,7 +136,7 @@ void SRepXGetExtensionVersion(ClientPtr client, int size, xGetExtensionVersionReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/grabacc.c b/Xi/grabacc.c index db9c9f2ca..59888ee15 100644 --- a/Xi/grabacc.c +++ b/Xi/grabacc.c @@ -93,7 +93,7 @@ void SRepXGrabAccessControl(ClientPtr client, int size, xGrabAccessControlReply* rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/grabdev.c b/Xi/grabdev.c index 3af2346e3..e2809efb1 100644 --- a/Xi/grabdev.c +++ b/Xi/grabdev.c @@ -79,11 +79,11 @@ extern int ExtEventIndex; */ int -SProcXGrabDevice(register ClientPtr client) +SProcXGrabDevice(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceReq); swaps(&stuff->length, n); @@ -202,7 +202,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count, void SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c index d79a36c8d..0b8a978e7 100644 --- a/Xi/grabdevb.c +++ b/Xi/grabdevb.c @@ -77,11 +77,11 @@ SOFTWARE. */ int -SProcXGrabDeviceButton(register ClientPtr client) +SProcXGrabDeviceButton(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceButtonReq); swaps(&stuff->length, n); diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c index 1120149d3..297072b6f 100644 --- a/Xi/grabdevk.c +++ b/Xi/grabdevk.c @@ -77,11 +77,11 @@ SOFTWARE. */ int -SProcXGrabDeviceKey(register ClientPtr client) +SProcXGrabDeviceKey(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceKeyReq); swaps(&stuff->length, n); diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index 435ab0bfd..cfc7f89f3 100644 --- a/Xi/gtmotion.c +++ b/Xi/gtmotion.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceMotionEvents(register ClientPtr client) +SProcXGetDeviceMotionEvents(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceMotionEventsReq); swaps(&stuff->length, n); @@ -162,7 +162,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client) WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); if (nEvents) { if (client->swapped) { - register char n; + char n; bufptr = coords; for (i = 0; i < nEvents * (axes + 1); i++) { @@ -188,7 +188,7 @@ void SRepXGetDeviceMotionEvents(ClientPtr client, int size, xGetDeviceMotionEventsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/listdev.c b/Xi/listdev.c index 33266ae4c..a9fd40156 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXListInputDevices(register ClientPtr client) +SProcXListInputDevices(ClientPtr client) { - register char n; + char n; REQUEST(xListInputDevicesReq); swaps(&stuff->length, n); @@ -88,80 +88,12 @@ SProcXListInputDevices(register ClientPtr client) /*********************************************************************** * - * This procedure lists the input devices available to the server. - * - */ - -int -ProcXListInputDevices(register ClientPtr client) -{ - xListInputDevicesReply rep; - int numdevs = 0; - int namesize = 1; /* need 1 extra byte for strcpy */ - int size = 0; - int total_length; - char *devbuf; - char *classbuf; - char *namebuf; - char *savbuf; - xDeviceInfo *dev; - DeviceIntPtr d; - - REQUEST_SIZE_MATCH(xListInputDevicesReq); - - rep.repType = X_Reply; - rep.RepType = X_ListInputDevices; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - AddOtherInputDevices(); - - SizeDeviceInfo(inputInfo.keyboard, &namesize, &size); - SizeDeviceInfo(inputInfo.pointer, &namesize, &size); - numdevs = 2; - - for (d = inputInfo.devices; d; d = d->next) { - SizeDeviceInfo(d, &namesize, &size); - numdevs++; - } - for (d = inputInfo.off_devices; d; d = d->next) { - SizeDeviceInfo(d, &namesize, &size); - numdevs++; - } - - total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; - devbuf = (char *)xalloc(total_length); - classbuf = devbuf + (numdevs * sizeof(xDeviceInfo)); - namebuf = classbuf + size; - savbuf = devbuf; - - dev = (xDeviceInfoPtr) devbuf; - ListDeviceInfo(client, inputInfo.keyboard, dev++, - &devbuf, &classbuf, &namebuf); - ListDeviceInfo(client, inputInfo.pointer, dev++, - &devbuf, &classbuf, &namebuf); - - for (d = inputInfo.devices; d; d = d->next, dev++) - ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); - for (d = inputInfo.off_devices; d; d = d->next, dev++) - ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); - - rep.ndevices = numdevs; - rep.length = (total_length + 3) >> 2; - WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep); - WriteToClient(client, total_length, savbuf); - xfree(savbuf); - return Success; -} - -/*********************************************************************** - * * This procedure calculates the size of the information to be returned * for an input device. * */ -void +static void SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) { int chunks; @@ -182,32 +114,6 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) /*********************************************************************** * - * This procedure lists information to be returned for an input device. - * - */ - -void -ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, - char **devbuf, char **classbuf, char **namebuf) -{ - CopyDeviceName(namebuf, d->name); - CopySwapDevice(client, d, 0, devbuf); - if (d->key != NULL) { - CopySwapKeyClass(client, d->key, classbuf); - dev->num_classes++; - } - if (d->button != NULL) { - CopySwapButtonClass(client, d->button, classbuf); - dev->num_classes++; - } - if (d->valuator != NULL) { - dev->num_classes += - CopySwapValuatorClass(client, d->valuator, classbuf); - } -} - -/*********************************************************************** - * * This procedure copies data to the DeviceInfo struct, swapping if necessary. * * We need the extra byte in the allocated buffer, because the trailing null @@ -216,7 +122,7 @@ ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, * */ -void +static void CopyDeviceName(char **namebuf, char *name) { char *nameptr = (char *)*namebuf; @@ -233,15 +139,37 @@ CopyDeviceName(char **namebuf, char *name) /*********************************************************************** * + * This procedure copies ButtonClass information, swapping if necessary. + * + */ + +static void +CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf) +{ + char n; + xButtonInfoPtr b2; + + b2 = (xButtonInfoPtr) * buf; + b2->class = ButtonClass; + b2->length = sizeof(xButtonInfo); + b2->num_buttons = b->numButtons; + if (client->swapped) { + swaps(&b2->num_buttons, n); /* macro - braces are required */ + } + *buf += sizeof(xButtonInfo); +} + +/*********************************************************************** + * * This procedure copies data to the DeviceInfo struct, swapping if necessary. * */ -void -CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, +static void +CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf) { - register char n; + char n; xDeviceInfoPtr dev; dev = (xDeviceInfoPtr) * buf; @@ -271,10 +199,10 @@ CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, * */ -void -CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) +static void +CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf) { - register char n; + char n; xKeyInfoPtr k2; k2 = (xKeyInfoPtr) * buf; @@ -291,28 +219,6 @@ CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) /*********************************************************************** * - * This procedure copies ButtonClass information, swapping if necessary. - * - */ - -void -CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) -{ - register char n; - xButtonInfoPtr b2; - - b2 = (xButtonInfoPtr) * buf; - b2->class = ButtonClass; - b2->length = sizeof(xButtonInfo); - b2->num_buttons = b->numButtons; - if (client->swapped) { - swaps(&b2->num_buttons, n); /* macro - braces are required */ - } - *buf += sizeof(xButtonInfo); -} - -/*********************************************************************** - * * This procedure copies ValuatorClass information, swapping if necessary. * * Devices may have up to 255 valuators. The length of a ValuatorClass is @@ -323,11 +229,11 @@ CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) * */ -int -CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) +static int +CopySwapValuatorClass(ClientPtr client, ValuatorClassPtr v, char **buf) { int i, j, axes, t_axes; - register char n; + char n; xValuatorInfoPtr v2; AxisInfo *a; xAxisInfoPtr a2; @@ -368,6 +274,100 @@ CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) /*********************************************************************** * + * This procedure lists information to be returned for an input device. + * + */ + +static void +ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, + char **devbuf, char **classbuf, char **namebuf) +{ + CopyDeviceName(namebuf, d->name); + CopySwapDevice(client, d, 0, devbuf); + if (d->key != NULL) { + CopySwapKeyClass(client, d->key, classbuf); + dev->num_classes++; + } + if (d->button != NULL) { + CopySwapButtonClass(client, d->button, classbuf); + dev->num_classes++; + } + if (d->valuator != NULL) { + dev->num_classes += + CopySwapValuatorClass(client, d->valuator, classbuf); + } +} + +/*********************************************************************** + * + * This procedure lists the input devices available to the server. + * + */ + +int +ProcXListInputDevices(ClientPtr client) +{ + xListInputDevicesReply rep; + int numdevs = 0; + int namesize = 1; /* need 1 extra byte for strcpy */ + int size = 0; + int total_length; + char *devbuf; + char *classbuf; + char *namebuf; + char *savbuf; + xDeviceInfo *dev; + DeviceIntPtr d; + + REQUEST_SIZE_MATCH(xListInputDevicesReq); + + rep.repType = X_Reply; + rep.RepType = X_ListInputDevices; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + AddOtherInputDevices(); + + SizeDeviceInfo(inputInfo.keyboard, &namesize, &size); + SizeDeviceInfo(inputInfo.pointer, &namesize, &size); + numdevs = 2; + + for (d = inputInfo.devices; d; d = d->next) { + SizeDeviceInfo(d, &namesize, &size); + numdevs++; + } + for (d = inputInfo.off_devices; d; d = d->next) { + SizeDeviceInfo(d, &namesize, &size); + numdevs++; + } + + total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; + devbuf = (char *)xalloc(total_length); + classbuf = devbuf + (numdevs * sizeof(xDeviceInfo)); + namebuf = classbuf + size; + savbuf = devbuf; + + dev = (xDeviceInfoPtr) devbuf; + ListDeviceInfo(client, inputInfo.keyboard, dev++, + &devbuf, &classbuf, &namebuf); + ListDeviceInfo(client, inputInfo.pointer, dev++, + &devbuf, &classbuf, &namebuf); + + for (d = inputInfo.devices; d; d = d->next, dev++) + ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); + for (d = inputInfo.off_devices; d; d = d->next, dev++) + ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); + + rep.ndevices = numdevs; + rep.length = (total_length + 3) >> 2; + WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep); + WriteToClient(client, total_length, savbuf); + xfree(savbuf); + return Success; +} + +/*********************************************************************** + * * This procedure writes the reply for the XListInputDevices function, * if the client and server have a different byte ordering. * @@ -376,7 +376,7 @@ CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) void SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/listdev.h b/Xi/listdev.h index bdd67ce70..db376decf 100644 --- a/Xi/listdev.h +++ b/Xi/listdev.h @@ -36,44 +36,6 @@ int SProcXListInputDevices(ClientPtr /* client */ int ProcXListInputDevices(ClientPtr /* client */ ); -void SizeDeviceInfo(DeviceIntPtr /* d */ , - int * /* namesize */ , - int * /* size */ - ); - -void ListDeviceInfo(ClientPtr /* client */ , - DeviceIntPtr /* d */ , - xDeviceInfoPtr /* dev */ , - char ** /* devbuf */ , - char ** /* classbuf */ , - char ** /* namebuf */ - ); - -void CopyDeviceName(char ** /* namebuf */ , - char * /* name */ - ); - -void CopySwapDevice(ClientPtr /* client */ , - DeviceIntPtr /* d */ , - int /* num_classes */ , - char ** /* buf */ - ); - -void CopySwapKeyClass(ClientPtr /* client */ , - KeyClassPtr /* k */ , - char ** /* buf */ - ); - -void CopySwapButtonClass(ClientPtr /* client */ , - ButtonClassPtr /* b */ , - char ** /* buf */ - ); - -int CopySwapValuatorClass(ClientPtr /* client */ , - ValuatorClassPtr /* v */ , - char ** /* buf */ - ); - void SRepXListInputDevices(ClientPtr /* client */ , int /* size */ , xListInputDevicesReply * /* rep */ diff --git a/Xi/opendev.c b/Xi/opendev.c index 636106815..4b7b6a64f 100644 --- a/Xi/opendev.c +++ b/Xi/opendev.c @@ -79,9 +79,9 @@ extern CARD8 event_base[]; */ int -SProcXOpenDevice(register ClientPtr client) +SProcXOpenDevice(ClientPtr client) { - register char n; + char n; REQUEST(xOpenDeviceReq); swaps(&stuff->length, n); @@ -95,7 +95,7 @@ SProcXOpenDevice(register ClientPtr client) */ int -ProcXOpenDevice(register ClientPtr client) +ProcXOpenDevice(ClientPtr client) { xInputClassInfo evbase[numInputClasses]; Bool enableit = FALSE; @@ -179,7 +179,7 @@ ProcXOpenDevice(register ClientPtr client) void SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/querydp.c b/Xi/querydp.c index af93fed2f..d2ed0b80a 100644 --- a/Xi/querydp.c +++ b/Xi/querydp.c @@ -62,9 +62,9 @@ from the author. */ int -SProcXQueryDevicePointer(register ClientPtr client) +SProcXQueryDevicePointer(ClientPtr client) { - register char n; + char n; REQUEST(xQueryDevicePointerReq); swaps(&stuff->length, n); @@ -72,7 +72,7 @@ SProcXQueryDevicePointer(register ClientPtr client) } int -ProcXQueryDevicePointer(register ClientPtr client) +ProcXQueryDevicePointer(ClientPtr client) { int rc; xQueryDevicePointerReply rep; @@ -158,7 +158,7 @@ void SRepXQueryDevicePointer(ClientPtr client, int size, xQueryDevicePointerReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/queryst.c b/Xi/queryst.c index c4cc5a2e6..972cd2c80 100644 --- a/Xi/queryst.c +++ b/Xi/queryst.c @@ -58,9 +58,9 @@ from The Open Group. */ int -SProcXQueryDeviceState(register ClientPtr client) +SProcXQueryDeviceState(ClientPtr client) { - register char n; + char n; REQUEST(xQueryDeviceStateReq); swaps(&stuff->length, n); @@ -74,9 +74,9 @@ SProcXQueryDeviceState(register ClientPtr client) */ int -ProcXQueryDeviceState(register ClientPtr client) +ProcXQueryDeviceState(ClientPtr client) { - register char n; + char n; int i; int num_classes = 0; int total_length = 0; @@ -187,7 +187,7 @@ ProcXQueryDeviceState(register ClientPtr client) void SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/selectev.c b/Xi/selectev.c index 8c893ca1e..d52db1b81 100644 --- a/Xi/selectev.c +++ b/Xi/selectev.c @@ -128,11 +128,11 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win, */ int -SProcXSelectExtensionEvent(register ClientPtr client) +SProcXSelectExtensionEvent(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xSelectExtensionEventReq); swaps(&stuff->length, n); @@ -154,7 +154,7 @@ SProcXSelectExtensionEvent(register ClientPtr client) */ int -ProcXSelectExtensionEvent(register ClientPtr client) +ProcXSelectExtensionEvent(ClientPtr client) { int ret; int i; diff --git a/Xi/sendexev.c b/Xi/sendexev.c index c2763bb22..eac9abe14 100644 --- a/Xi/sendexev.c +++ b/Xi/sendexev.c @@ -80,11 +80,11 @@ extern int lastEvent; /* Defined in extension.c */ */ int -SProcXSendExtensionEvent(register ClientPtr client) +SProcXSendExtensionEvent(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; xEvent eventT; xEvent *eventP; EventSwapPtr proc; @@ -119,7 +119,7 @@ SProcXSendExtensionEvent(register ClientPtr client) */ int -ProcXSendExtensionEvent(register ClientPtr client) +ProcXSendExtensionEvent(ClientPtr client) { int ret; DeviceIntPtr dev; diff --git a/Xi/setbmap.c b/Xi/setbmap.c index 14b1689f5..bdfa513dd 100644 --- a/Xi/setbmap.c +++ b/Xi/setbmap.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXSetDeviceButtonMapping(register ClientPtr client) +SProcXSetDeviceButtonMapping(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceButtonMappingReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXSetDeviceButtonMapping(register ClientPtr client) */ int -ProcXSetDeviceButtonMapping(register ClientPtr client) +ProcXSetDeviceButtonMapping(ClientPtr client) { int ret; xSetDeviceButtonMappingReply rep; @@ -149,7 +149,7 @@ void SRepXSetDeviceButtonMapping(ClientPtr client, int size, xSetDeviceButtonMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setdval.c b/Xi/setdval.c index ce9b02d2f..61b98c790 100644 --- a/Xi/setdval.c +++ b/Xi/setdval.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXSetDeviceValuators(register ClientPtr client) +SProcXSetDeviceValuators(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceValuatorsReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXSetDeviceValuators(register ClientPtr client) */ int -ProcXSetDeviceValuators(register ClientPtr client) +ProcXSetDeviceValuators(ClientPtr client) { DeviceIntPtr dev; xSetDeviceValuatorsReply rep; @@ -152,7 +152,7 @@ void SRepXSetDeviceValuators(ClientPtr client, int size, xSetDeviceValuatorsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setfocus.c b/Xi/setfocus.c index 59fe0768c..aaf88ce6f 100644 --- a/Xi/setfocus.c +++ b/Xi/setfocus.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXSetDeviceFocus(register ClientPtr client) +SProcXSetDeviceFocus(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceFocusReq); swaps(&stuff->length, n); @@ -97,10 +97,10 @@ SProcXSetDeviceFocus(register ClientPtr client) */ int -ProcXSetDeviceFocus(register ClientPtr client) +ProcXSetDeviceFocus(ClientPtr client) { int ret; - register DeviceIntPtr dev; + DeviceIntPtr dev; REQUEST(xSetDeviceFocusReq); REQUEST_SIZE_MATCH(xSetDeviceFocusReq); diff --git a/Xi/setmmap.c b/Xi/setmmap.c index 645f246bd..00784995a 100644 --- a/Xi/setmmap.c +++ b/Xi/setmmap.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXSetDeviceModifierMapping(register ClientPtr client) +SProcXSetDeviceModifierMapping(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceModifierMappingReq); swaps(&stuff->length, n); @@ -145,7 +145,7 @@ void SRepXSetDeviceModifierMapping(ClientPtr client, int size, xSetDeviceModifierMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setmode.c b/Xi/setmode.c index ff5a3bcfc..00d340055 100644 --- a/Xi/setmode.c +++ b/Xi/setmode.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXSetDeviceMode(register ClientPtr client) +SProcXSetDeviceMode(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceModeReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXSetDeviceMode(register ClientPtr client) */ int -ProcXSetDeviceMode(register ClientPtr client) +ProcXSetDeviceMode(ClientPtr client) { DeviceIntPtr dev; xSetDeviceModeReply rep; @@ -139,7 +139,7 @@ ProcXSetDeviceMode(register ClientPtr client) void SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/stubs.c b/Xi/stubs.c index e2ed1ceff..ed041b815 100644 --- a/Xi/stubs.c +++ b/Xi/stubs.c @@ -168,7 +168,7 @@ OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) */ int -SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode) +SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) { return BadMatch; } @@ -186,7 +186,7 @@ SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode) */ int -SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev, +SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, int *valuators, int first_valuator, int num_valuators) { return BadMatch; @@ -201,7 +201,7 @@ SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev, */ int -ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev, +ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) { switch (control->control) { diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c index a028a228f..b2b71694d 100644 --- a/Xi/ungrdev.c +++ b/Xi/ungrdev.c @@ -74,9 +74,9 @@ SOFTWARE. */ int -SProcXUngrabDevice(register ClientPtr client) +SProcXUngrabDevice(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceReq); swaps(&stuff->length, n); @@ -92,7 +92,7 @@ SProcXUngrabDevice(register ClientPtr client) */ int -ProcXUngrabDevice(register ClientPtr client) +ProcXUngrabDevice(ClientPtr client) { DeviceIntPtr dev; GrabPtr grab; diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c index b75916f42..5e0a66328 100644 --- a/Xi/ungrdevb.c +++ b/Xi/ungrdevb.c @@ -80,9 +80,9 @@ SOFTWARE. */ int -SProcXUngrabDeviceButton(register ClientPtr client) +SProcXUngrabDeviceButton(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceButtonReq); swaps(&stuff->length, n); diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c index e8c006ae6..7b06d6e09 100644 --- a/Xi/ungrdevk.c +++ b/Xi/ungrdevk.c @@ -80,9 +80,9 @@ SOFTWARE. */ int -SProcXUngrabDeviceKey(register ClientPtr client) +SProcXUngrabDeviceKey(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceKeyReq); swaps(&stuff->length, n); diff --git a/Xi/warpdevp.c b/Xi/warpdevp.c index 8df7e14db..82d71d524 100644 --- a/Xi/warpdevp.c +++ b/Xi/warpdevp.c @@ -59,9 +59,9 @@ from the author. */ int -SProcXWarpDevicePointer(register ClientPtr client) +SProcXWarpDevicePointer(ClientPtr client) { - register char n; + char n; REQUEST(xWarpDevicePointerReq); swaps(&stuff->length, n); @@ -69,7 +69,7 @@ SProcXWarpDevicePointer(register ClientPtr client) } int -ProcXWarpDevicePointer(register ClientPtr client) +ProcXWarpDevicePointer(ClientPtr client) { int err; int x, y; |