105b261ecSmrg/************************************************************
205b261ecSmrgCopyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
305b261ecSmrg
405b261ecSmrgPermission to use, copy, modify, and distribute this
505b261ecSmrgsoftware and its documentation for any purpose and without
605b261ecSmrgfee is hereby granted, provided that the above copyright
705b261ecSmrgnotice appear in all copies and that both that copyright
805b261ecSmrgnotice and this permission notice appear in supporting
935c4bbdfSmrgdocumentation, and that the name of Silicon Graphics not be
1035c4bbdfSmrgused in advertising or publicity pertaining to distribution
1105b261ecSmrgof the software without specific prior written permission.
1235c4bbdfSmrgSilicon Graphics makes no representation about the suitability
1305b261ecSmrgof this software for any purpose. It is provided "as is"
1405b261ecSmrgwithout any express or implied warranty.
1505b261ecSmrg
1635c4bbdfSmrgSILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
1735c4bbdfSmrgSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1805b261ecSmrgAND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
1935c4bbdfSmrgGRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
2035c4bbdfSmrgDAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
2135c4bbdfSmrgDATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
2205b261ecSmrgOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
2305b261ecSmrgTHE USE OR PERFORMANCE OF THIS SOFTWARE.
2405b261ecSmrg
2505b261ecSmrg********************************************************/
2605b261ecSmrg
2705b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
2805b261ecSmrg#include <dix-config.h>
2905b261ecSmrg#endif
3005b261ecSmrg
3105b261ecSmrg#include "stdio.h"
3205b261ecSmrg#include <X11/X.h>
3305b261ecSmrg#include <X11/Xproto.h>
3405b261ecSmrg#include "misc.h"
3505b261ecSmrg#include "inputstr.h"
3605b261ecSmrg#include <xkbsrv.h>
374642e01fSmrg#include "xkbstr.h"
3805b261ecSmrg#include "extnsionst.h"
3905b261ecSmrg#include "xkb.h"
4005b261ecSmrg
4135c4bbdfSmrg        /*
4235c4bbdfSmrg         * REQUEST SWAPPING
4335c4bbdfSmrg         */
441b5d61b8Smrgstatic int _X_COLD
4505b261ecSmrgSProcXkbUseExtension(ClientPtr client)
4605b261ecSmrg{
4705b261ecSmrg    REQUEST(xkbUseExtensionReq);
4805b261ecSmrg
4935c4bbdfSmrg    swaps(&stuff->length);
5005b261ecSmrg    REQUEST_SIZE_MATCH(xkbUseExtensionReq);
5135c4bbdfSmrg    swaps(&stuff->wantedMajor);
5235c4bbdfSmrg    swaps(&stuff->wantedMinor);
5305b261ecSmrg    return ProcXkbUseExtension(client);
5405b261ecSmrg}
5505b261ecSmrg
561b5d61b8Smrgstatic int _X_COLD
5705b261ecSmrgSProcXkbSelectEvents(ClientPtr client)
5805b261ecSmrg{
5905b261ecSmrg    REQUEST(xkbSelectEventsReq);
6005b261ecSmrg
6135c4bbdfSmrg    swaps(&stuff->length);
6205b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbSelectEventsReq);
6335c4bbdfSmrg    swaps(&stuff->deviceSpec);
6435c4bbdfSmrg    swaps(&stuff->affectWhich);
6535c4bbdfSmrg    swaps(&stuff->clear);
6635c4bbdfSmrg    swaps(&stuff->selectAll);
6735c4bbdfSmrg    swaps(&stuff->affectMap);
6835c4bbdfSmrg    swaps(&stuff->map);
6935c4bbdfSmrg    if ((stuff->affectWhich & (~XkbMapNotifyMask)) != 0) {
7035c4bbdfSmrg        union {
7135c4bbdfSmrg            BOOL *b;
7235c4bbdfSmrg            CARD8 *c8;
7335c4bbdfSmrg            CARD16 *c16;
7435c4bbdfSmrg            CARD32 *c32;
7535c4bbdfSmrg        } from;
7635c4bbdfSmrg        register unsigned bit, ndx, maskLeft, dataLeft, size;
7735c4bbdfSmrg
7835c4bbdfSmrg        from.c8 = (CARD8 *) &stuff[1];
795a7dfde8Smrg        dataLeft = (client->req_len * 4) - SIZEOF(xkbSelectEventsReq);
8035c4bbdfSmrg        maskLeft = (stuff->affectWhich & (~XkbMapNotifyMask));
8135c4bbdfSmrg        for (ndx = 0, bit = 1; (maskLeft != 0); ndx++, bit <<= 1) {
8235c4bbdfSmrg            if (((bit & maskLeft) == 0) || (ndx == XkbMapNotify))
8335c4bbdfSmrg                continue;
8435c4bbdfSmrg            maskLeft &= ~bit;
8535c4bbdfSmrg            if ((stuff->selectAll & bit) || (stuff->clear & bit))
8635c4bbdfSmrg                continue;
8735c4bbdfSmrg            switch (ndx) {
8835c4bbdfSmrg            case XkbNewKeyboardNotify:
8935c4bbdfSmrg            case XkbStateNotify:
9035c4bbdfSmrg            case XkbNamesNotify:
9135c4bbdfSmrg            case XkbAccessXNotify:
9235c4bbdfSmrg            case XkbExtensionDeviceNotify:
9335c4bbdfSmrg                size = 2;
9435c4bbdfSmrg                break;
9535c4bbdfSmrg            case XkbControlsNotify:
9635c4bbdfSmrg            case XkbIndicatorStateNotify:
9735c4bbdfSmrg            case XkbIndicatorMapNotify:
9835c4bbdfSmrg                size = 4;
9935c4bbdfSmrg                break;
10035c4bbdfSmrg            case XkbBellNotify:
10135c4bbdfSmrg            case XkbActionMessage:
10235c4bbdfSmrg            case XkbCompatMapNotify:
10335c4bbdfSmrg                size = 1;
10435c4bbdfSmrg                break;
10535c4bbdfSmrg            default:
10635c4bbdfSmrg                client->errorValue = _XkbErrCode2(0x1, bit);
10735c4bbdfSmrg                return BadValue;
10835c4bbdfSmrg            }
10935c4bbdfSmrg            if (dataLeft < (size * 2))
11035c4bbdfSmrg                return BadLength;
11135c4bbdfSmrg            if (size == 2) {
11235c4bbdfSmrg                swaps(&from.c16[0]);
11335c4bbdfSmrg                swaps(&from.c16[1]);
11435c4bbdfSmrg            }
11535c4bbdfSmrg            else if (size == 4) {
11635c4bbdfSmrg                swapl(&from.c32[0]);
11735c4bbdfSmrg                swapl(&from.c32[1]);
11835c4bbdfSmrg            }
11935c4bbdfSmrg            else {
12035c4bbdfSmrg                size = 2;
12135c4bbdfSmrg            }
12235c4bbdfSmrg            from.c8 += (size * 2);
12335c4bbdfSmrg            dataLeft -= (size * 2);
12435c4bbdfSmrg        }
12535c4bbdfSmrg        if (dataLeft > 2) {
12635c4bbdfSmrg            ErrorF("[xkb] Extra data (%d bytes) after SelectEvents\n",
12735c4bbdfSmrg                   dataLeft);
12835c4bbdfSmrg            return BadLength;
12935c4bbdfSmrg        }
13005b261ecSmrg    }
13105b261ecSmrg    return ProcXkbSelectEvents(client);
13205b261ecSmrg}
13305b261ecSmrg
1341b5d61b8Smrgstatic int _X_COLD
13505b261ecSmrgSProcXkbBell(ClientPtr client)
13605b261ecSmrg{
13705b261ecSmrg    REQUEST(xkbBellReq);
13805b261ecSmrg
13935c4bbdfSmrg    swaps(&stuff->length);
14005b261ecSmrg    REQUEST_SIZE_MATCH(xkbBellReq);
14135c4bbdfSmrg    swaps(&stuff->deviceSpec);
14235c4bbdfSmrg    swaps(&stuff->bellClass);
14335c4bbdfSmrg    swaps(&stuff->bellID);
14435c4bbdfSmrg    swapl(&stuff->name);
14535c4bbdfSmrg    swapl(&stuff->window);
14635c4bbdfSmrg    swaps(&stuff->pitch);
14735c4bbdfSmrg    swaps(&stuff->duration);
14805b261ecSmrg    return ProcXkbBell(client);
14905b261ecSmrg}
15005b261ecSmrg
1511b5d61b8Smrgstatic int _X_COLD
15205b261ecSmrgSProcXkbGetState(ClientPtr client)
15305b261ecSmrg{
15405b261ecSmrg    REQUEST(xkbGetStateReq);
15505b261ecSmrg
15635c4bbdfSmrg    swaps(&stuff->length);
15705b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetStateReq);
15835c4bbdfSmrg    swaps(&stuff->deviceSpec);
15905b261ecSmrg    return ProcXkbGetState(client);
16005b261ecSmrg}
16105b261ecSmrg
1621b5d61b8Smrgstatic int _X_COLD
16305b261ecSmrgSProcXkbLatchLockState(ClientPtr client)
16405b261ecSmrg{
16505b261ecSmrg    REQUEST(xkbLatchLockStateReq);
16605b261ecSmrg
16735c4bbdfSmrg    swaps(&stuff->length);
16805b261ecSmrg    REQUEST_SIZE_MATCH(xkbLatchLockStateReq);
16935c4bbdfSmrg    swaps(&stuff->deviceSpec);
17035c4bbdfSmrg    swaps(&stuff->groupLatch);
17105b261ecSmrg    return ProcXkbLatchLockState(client);
17205b261ecSmrg}
17305b261ecSmrg
1741b5d61b8Smrgstatic int _X_COLD
17505b261ecSmrgSProcXkbGetControls(ClientPtr client)
17605b261ecSmrg{
17705b261ecSmrg    REQUEST(xkbGetControlsReq);
17805b261ecSmrg
17935c4bbdfSmrg    swaps(&stuff->length);
18005b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetControlsReq);
18135c4bbdfSmrg    swaps(&stuff->deviceSpec);
18205b261ecSmrg    return ProcXkbGetControls(client);
18305b261ecSmrg}
18405b261ecSmrg
1851b5d61b8Smrgstatic int _X_COLD
18605b261ecSmrgSProcXkbSetControls(ClientPtr client)
18705b261ecSmrg{
18805b261ecSmrg    REQUEST(xkbSetControlsReq);
18905b261ecSmrg
19035c4bbdfSmrg    swaps(&stuff->length);
19105b261ecSmrg    REQUEST_SIZE_MATCH(xkbSetControlsReq);
19235c4bbdfSmrg    swaps(&stuff->deviceSpec);
19335c4bbdfSmrg    swaps(&stuff->affectInternalVMods);
19435c4bbdfSmrg    swaps(&stuff->internalVMods);
19535c4bbdfSmrg    swaps(&stuff->affectIgnoreLockVMods);
19635c4bbdfSmrg    swaps(&stuff->ignoreLockVMods);
19735c4bbdfSmrg    swaps(&stuff->axOptions);
19835c4bbdfSmrg    swapl(&stuff->affectEnabledCtrls);
19935c4bbdfSmrg    swapl(&stuff->enabledCtrls);
20035c4bbdfSmrg    swapl(&stuff->changeCtrls);
20135c4bbdfSmrg    swaps(&stuff->repeatDelay);
20235c4bbdfSmrg    swaps(&stuff->repeatInterval);
20335c4bbdfSmrg    swaps(&stuff->slowKeysDelay);
20435c4bbdfSmrg    swaps(&stuff->debounceDelay);
20535c4bbdfSmrg    swaps(&stuff->mkDelay);
20635c4bbdfSmrg    swaps(&stuff->mkInterval);
20735c4bbdfSmrg    swaps(&stuff->mkTimeToMax);
20835c4bbdfSmrg    swaps(&stuff->mkMaxSpeed);
20935c4bbdfSmrg    swaps(&stuff->mkCurve);
21035c4bbdfSmrg    swaps(&stuff->axTimeout);
21135c4bbdfSmrg    swapl(&stuff->axtCtrlsMask);
21235c4bbdfSmrg    swapl(&stuff->axtCtrlsValues);
21335c4bbdfSmrg    swaps(&stuff->axtOptsMask);
21435c4bbdfSmrg    swaps(&stuff->axtOptsValues);
21505b261ecSmrg    return ProcXkbSetControls(client);
21605b261ecSmrg}
21705b261ecSmrg
2181b5d61b8Smrgstatic int _X_COLD
21905b261ecSmrgSProcXkbGetMap(ClientPtr client)
22005b261ecSmrg{
22105b261ecSmrg    REQUEST(xkbGetMapReq);
22205b261ecSmrg
22335c4bbdfSmrg    swaps(&stuff->length);
22405b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetMapReq);
22535c4bbdfSmrg    swaps(&stuff->deviceSpec);
22635c4bbdfSmrg    swaps(&stuff->full);
22735c4bbdfSmrg    swaps(&stuff->partial);
22835c4bbdfSmrg    swaps(&stuff->virtualMods);
22905b261ecSmrg    return ProcXkbGetMap(client);
23005b261ecSmrg}
23105b261ecSmrg
2321b5d61b8Smrgstatic int _X_COLD
23305b261ecSmrgSProcXkbSetMap(ClientPtr client)
23405b261ecSmrg{
23505b261ecSmrg    REQUEST(xkbSetMapReq);
23605b261ecSmrg
23735c4bbdfSmrg    swaps(&stuff->length);
23805b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbSetMapReq);
23935c4bbdfSmrg    swaps(&stuff->deviceSpec);
24035c4bbdfSmrg    swaps(&stuff->present);
24135c4bbdfSmrg    swaps(&stuff->flags);
24235c4bbdfSmrg    swaps(&stuff->totalSyms);
24335c4bbdfSmrg    swaps(&stuff->totalActs);
24435c4bbdfSmrg    swaps(&stuff->virtualMods);
24505b261ecSmrg    return ProcXkbSetMap(client);
24605b261ecSmrg}
24705b261ecSmrg
2481b5d61b8Smrgstatic int _X_COLD
24905b261ecSmrgSProcXkbGetCompatMap(ClientPtr client)
25005b261ecSmrg{
25105b261ecSmrg    REQUEST(xkbGetCompatMapReq);
25205b261ecSmrg
25335c4bbdfSmrg    swaps(&stuff->length);
25405b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetCompatMapReq);
25535c4bbdfSmrg    swaps(&stuff->deviceSpec);
25635c4bbdfSmrg    swaps(&stuff->firstSI);
25735c4bbdfSmrg    swaps(&stuff->nSI);
25805b261ecSmrg    return ProcXkbGetCompatMap(client);
25905b261ecSmrg}
26005b261ecSmrg
2611b5d61b8Smrgstatic int _X_COLD
26205b261ecSmrgSProcXkbSetCompatMap(ClientPtr client)
26305b261ecSmrg{
26405b261ecSmrg    REQUEST(xkbSetCompatMapReq);
26505b261ecSmrg
26635c4bbdfSmrg    swaps(&stuff->length);
26705b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbSetCompatMapReq);
26835c4bbdfSmrg    swaps(&stuff->deviceSpec);
26935c4bbdfSmrg    swaps(&stuff->firstSI);
27035c4bbdfSmrg    swaps(&stuff->nSI);
27105b261ecSmrg    return ProcXkbSetCompatMap(client);
27205b261ecSmrg}
27305b261ecSmrg
2741b5d61b8Smrgstatic int _X_COLD
27505b261ecSmrgSProcXkbGetIndicatorState(ClientPtr client)
27605b261ecSmrg{
27705b261ecSmrg    REQUEST(xkbGetIndicatorStateReq);
27805b261ecSmrg
27935c4bbdfSmrg    swaps(&stuff->length);
28005b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetIndicatorStateReq);
28135c4bbdfSmrg    swaps(&stuff->deviceSpec);
28205b261ecSmrg    return ProcXkbGetIndicatorState(client);
28305b261ecSmrg}
28405b261ecSmrg
2851b5d61b8Smrgstatic int _X_COLD
28605b261ecSmrgSProcXkbGetIndicatorMap(ClientPtr client)
28705b261ecSmrg{
28805b261ecSmrg    REQUEST(xkbGetIndicatorMapReq);
28905b261ecSmrg
29035c4bbdfSmrg    swaps(&stuff->length);
29105b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetIndicatorMapReq);
29235c4bbdfSmrg    swaps(&stuff->deviceSpec);
29335c4bbdfSmrg    swapl(&stuff->which);
29405b261ecSmrg    return ProcXkbGetIndicatorMap(client);
29505b261ecSmrg}
29605b261ecSmrg
2971b5d61b8Smrgstatic int _X_COLD
29805b261ecSmrgSProcXkbSetIndicatorMap(ClientPtr client)
29905b261ecSmrg{
30005b261ecSmrg    REQUEST(xkbSetIndicatorMapReq);
30105b261ecSmrg
30235c4bbdfSmrg    swaps(&stuff->length);
30305b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbSetIndicatorMapReq);
30435c4bbdfSmrg    swaps(&stuff->deviceSpec);
30535c4bbdfSmrg    swapl(&stuff->which);
30605b261ecSmrg    return ProcXkbSetIndicatorMap(client);
30705b261ecSmrg}
30805b261ecSmrg
3091b5d61b8Smrgstatic int _X_COLD
31005b261ecSmrgSProcXkbGetNamedIndicator(ClientPtr client)
31105b261ecSmrg{
31205b261ecSmrg    REQUEST(xkbGetNamedIndicatorReq);
31305b261ecSmrg
31435c4bbdfSmrg    swaps(&stuff->length);
31505b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetNamedIndicatorReq);
31635c4bbdfSmrg    swaps(&stuff->deviceSpec);
31735c4bbdfSmrg    swaps(&stuff->ledClass);
31835c4bbdfSmrg    swaps(&stuff->ledID);
31935c4bbdfSmrg    swapl(&stuff->indicator);
32005b261ecSmrg    return ProcXkbGetNamedIndicator(client);
32105b261ecSmrg}
32205b261ecSmrg
3231b5d61b8Smrgstatic int _X_COLD
32405b261ecSmrgSProcXkbSetNamedIndicator(ClientPtr client)
32505b261ecSmrg{
32605b261ecSmrg    REQUEST(xkbSetNamedIndicatorReq);
32705b261ecSmrg
32835c4bbdfSmrg    swaps(&stuff->length);
32905b261ecSmrg    REQUEST_SIZE_MATCH(xkbSetNamedIndicatorReq);
33035c4bbdfSmrg    swaps(&stuff->deviceSpec);
33135c4bbdfSmrg    swaps(&stuff->ledClass);
33235c4bbdfSmrg    swaps(&stuff->ledID);
33335c4bbdfSmrg    swapl(&stuff->indicator);
33435c4bbdfSmrg    swaps(&stuff->virtualMods);
33535c4bbdfSmrg    swapl(&stuff->ctrls);
33605b261ecSmrg    return ProcXkbSetNamedIndicator(client);
33705b261ecSmrg}
33805b261ecSmrg
3391b5d61b8Smrgstatic int _X_COLD
34005b261ecSmrgSProcXkbGetNames(ClientPtr client)
34105b261ecSmrg{
34205b261ecSmrg    REQUEST(xkbGetNamesReq);
34305b261ecSmrg
34435c4bbdfSmrg    swaps(&stuff->length);
34505b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetNamesReq);
34635c4bbdfSmrg    swaps(&stuff->deviceSpec);
34735c4bbdfSmrg    swapl(&stuff->which);
34805b261ecSmrg    return ProcXkbGetNames(client);
34905b261ecSmrg}
35005b261ecSmrg
3511b5d61b8Smrgstatic int _X_COLD
35205b261ecSmrgSProcXkbSetNames(ClientPtr client)
35305b261ecSmrg{
35405b261ecSmrg    REQUEST(xkbSetNamesReq);
35505b261ecSmrg
35635c4bbdfSmrg    swaps(&stuff->length);
35705b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbSetNamesReq);
35835c4bbdfSmrg    swaps(&stuff->deviceSpec);
35935c4bbdfSmrg    swaps(&stuff->virtualMods);
36035c4bbdfSmrg    swapl(&stuff->which);
36135c4bbdfSmrg    swapl(&stuff->indicators);
36235c4bbdfSmrg    swaps(&stuff->totalKTLevelNames);
36305b261ecSmrg    return ProcXkbSetNames(client);
36405b261ecSmrg}
36505b261ecSmrg
3661b5d61b8Smrgstatic int _X_COLD
36705b261ecSmrgSProcXkbGetGeometry(ClientPtr client)
36805b261ecSmrg{
36905b261ecSmrg    REQUEST(xkbGetGeometryReq);
37005b261ecSmrg
37135c4bbdfSmrg    swaps(&stuff->length);
37205b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetGeometryReq);
37335c4bbdfSmrg    swaps(&stuff->deviceSpec);
37435c4bbdfSmrg    swapl(&stuff->name);
37505b261ecSmrg    return ProcXkbGetGeometry(client);
37605b261ecSmrg}
37705b261ecSmrg
3781b5d61b8Smrgstatic int _X_COLD
37905b261ecSmrgSProcXkbSetGeometry(ClientPtr client)
38005b261ecSmrg{
38105b261ecSmrg    REQUEST(xkbSetGeometryReq);
38205b261ecSmrg
38335c4bbdfSmrg    swaps(&stuff->length);
38405b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq);
38535c4bbdfSmrg    swaps(&stuff->deviceSpec);
38635c4bbdfSmrg    swapl(&stuff->name);
38735c4bbdfSmrg    swaps(&stuff->widthMM);
38835c4bbdfSmrg    swaps(&stuff->heightMM);
38935c4bbdfSmrg    swaps(&stuff->nProperties);
39035c4bbdfSmrg    swaps(&stuff->nColors);
39135c4bbdfSmrg    swaps(&stuff->nDoodads);
39235c4bbdfSmrg    swaps(&stuff->nKeyAliases);
39305b261ecSmrg    return ProcXkbSetGeometry(client);
39405b261ecSmrg}
39505b261ecSmrg
3961b5d61b8Smrgstatic int _X_COLD
39705b261ecSmrgSProcXkbPerClientFlags(ClientPtr client)
39805b261ecSmrg{
39905b261ecSmrg    REQUEST(xkbPerClientFlagsReq);
40005b261ecSmrg
40135c4bbdfSmrg    swaps(&stuff->length);
40205b261ecSmrg    REQUEST_SIZE_MATCH(xkbPerClientFlagsReq);
40335c4bbdfSmrg    swaps(&stuff->deviceSpec);
40435c4bbdfSmrg    swapl(&stuff->change);
40535c4bbdfSmrg    swapl(&stuff->value);
40635c4bbdfSmrg    swapl(&stuff->ctrlsToChange);
40735c4bbdfSmrg    swapl(&stuff->autoCtrls);
40835c4bbdfSmrg    swapl(&stuff->autoCtrlValues);
40905b261ecSmrg    return ProcXkbPerClientFlags(client);
41005b261ecSmrg}
41105b261ecSmrg
4121b5d61b8Smrgstatic int _X_COLD
41305b261ecSmrgSProcXkbListComponents(ClientPtr client)
41405b261ecSmrg{
41505b261ecSmrg    REQUEST(xkbListComponentsReq);
41605b261ecSmrg
41735c4bbdfSmrg    swaps(&stuff->length);
41805b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbListComponentsReq);
41935c4bbdfSmrg    swaps(&stuff->deviceSpec);
42035c4bbdfSmrg    swaps(&stuff->maxNames);
42105b261ecSmrg    return ProcXkbListComponents(client);
42205b261ecSmrg}
42305b261ecSmrg
4241b5d61b8Smrgstatic int _X_COLD
42505b261ecSmrgSProcXkbGetKbdByName(ClientPtr client)
42605b261ecSmrg{
42705b261ecSmrg    REQUEST(xkbGetKbdByNameReq);
42805b261ecSmrg
42935c4bbdfSmrg    swaps(&stuff->length);
43005b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq);
43135c4bbdfSmrg    swaps(&stuff->deviceSpec);
43235c4bbdfSmrg    swaps(&stuff->want);
43335c4bbdfSmrg    swaps(&stuff->need);
43405b261ecSmrg    return ProcXkbGetKbdByName(client);
43505b261ecSmrg}
43605b261ecSmrg
4371b5d61b8Smrgstatic int _X_COLD
43805b261ecSmrgSProcXkbGetDeviceInfo(ClientPtr client)
43905b261ecSmrg{
44005b261ecSmrg    REQUEST(xkbGetDeviceInfoReq);
44105b261ecSmrg
44235c4bbdfSmrg    swaps(&stuff->length);
44305b261ecSmrg    REQUEST_SIZE_MATCH(xkbGetDeviceInfoReq);
44435c4bbdfSmrg    swaps(&stuff->deviceSpec);
44535c4bbdfSmrg    swaps(&stuff->wanted);
44635c4bbdfSmrg    swaps(&stuff->ledClass);
44735c4bbdfSmrg    swaps(&stuff->ledID);
44805b261ecSmrg    return ProcXkbGetDeviceInfo(client);
44905b261ecSmrg}
45005b261ecSmrg
4511b5d61b8Smrgstatic int _X_COLD
45205b261ecSmrgSProcXkbSetDeviceInfo(ClientPtr client)
45305b261ecSmrg{
45405b261ecSmrg    REQUEST(xkbSetDeviceInfoReq);
45505b261ecSmrg
45635c4bbdfSmrg    swaps(&stuff->length);
45705b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq);
45835c4bbdfSmrg    swaps(&stuff->deviceSpec);
45935c4bbdfSmrg    swaps(&stuff->change);
46035c4bbdfSmrg    swaps(&stuff->nDeviceLedFBs);
46105b261ecSmrg    return ProcXkbSetDeviceInfo(client);
46205b261ecSmrg}
46305b261ecSmrg
4641b5d61b8Smrgstatic int _X_COLD
46505b261ecSmrgSProcXkbSetDebuggingFlags(ClientPtr client)
46605b261ecSmrg{
46705b261ecSmrg    REQUEST(xkbSetDebuggingFlagsReq);
46805b261ecSmrg
46935c4bbdfSmrg    swaps(&stuff->length);
47005b261ecSmrg    REQUEST_AT_LEAST_SIZE(xkbSetDebuggingFlagsReq);
47135c4bbdfSmrg    swapl(&stuff->affectFlags);
47235c4bbdfSmrg    swapl(&stuff->flags);
47335c4bbdfSmrg    swapl(&stuff->affectCtrls);
47435c4bbdfSmrg    swapl(&stuff->ctrls);
47535c4bbdfSmrg    swaps(&stuff->msgLength);
47605b261ecSmrg    return ProcXkbSetDebuggingFlags(client);
47705b261ecSmrg}
47805b261ecSmrg
4791b5d61b8Smrgint _X_COLD
48035c4bbdfSmrgSProcXkbDispatch(ClientPtr client)
48105b261ecSmrg{
48205b261ecSmrg    REQUEST(xReq);
48335c4bbdfSmrg    switch (stuff->data) {
48405b261ecSmrg    case X_kbUseExtension:
48535c4bbdfSmrg        return SProcXkbUseExtension(client);
48605b261ecSmrg    case X_kbSelectEvents:
48735c4bbdfSmrg        return SProcXkbSelectEvents(client);
48805b261ecSmrg    case X_kbBell:
48935c4bbdfSmrg        return SProcXkbBell(client);
49005b261ecSmrg    case X_kbGetState:
49135c4bbdfSmrg        return SProcXkbGetState(client);
49205b261ecSmrg    case X_kbLatchLockState:
49335c4bbdfSmrg        return SProcXkbLatchLockState(client);
49405b261ecSmrg    case X_kbGetControls:
49535c4bbdfSmrg        return SProcXkbGetControls(client);
49605b261ecSmrg    case X_kbSetControls:
49735c4bbdfSmrg        return SProcXkbSetControls(client);
49805b261ecSmrg    case X_kbGetMap:
49935c4bbdfSmrg        return SProcXkbGetMap(client);
50005b261ecSmrg    case X_kbSetMap:
50135c4bbdfSmrg        return SProcXkbSetMap(client);
50205b261ecSmrg    case X_kbGetCompatMap:
50335c4bbdfSmrg        return SProcXkbGetCompatMap(client);
50405b261ecSmrg    case X_kbSetCompatMap:
50535c4bbdfSmrg        return SProcXkbSetCompatMap(client);
50605b261ecSmrg    case X_kbGetIndicatorState:
50735c4bbdfSmrg        return SProcXkbGetIndicatorState(client);
50805b261ecSmrg    case X_kbGetIndicatorMap:
50935c4bbdfSmrg        return SProcXkbGetIndicatorMap(client);
51005b261ecSmrg    case X_kbSetIndicatorMap:
51135c4bbdfSmrg        return SProcXkbSetIndicatorMap(client);
51205b261ecSmrg    case X_kbGetNamedIndicator:
51335c4bbdfSmrg        return SProcXkbGetNamedIndicator(client);
51405b261ecSmrg    case X_kbSetNamedIndicator:
51535c4bbdfSmrg        return SProcXkbSetNamedIndicator(client);
51605b261ecSmrg    case X_kbGetNames:
51735c4bbdfSmrg        return SProcXkbGetNames(client);
51805b261ecSmrg    case X_kbSetNames:
51935c4bbdfSmrg        return SProcXkbSetNames(client);
52005b261ecSmrg    case X_kbGetGeometry:
52135c4bbdfSmrg        return SProcXkbGetGeometry(client);
52205b261ecSmrg    case X_kbSetGeometry:
52335c4bbdfSmrg        return SProcXkbSetGeometry(client);
52405b261ecSmrg    case X_kbPerClientFlags:
52535c4bbdfSmrg        return SProcXkbPerClientFlags(client);
52605b261ecSmrg    case X_kbListComponents:
52735c4bbdfSmrg        return SProcXkbListComponents(client);
52805b261ecSmrg    case X_kbGetKbdByName:
52935c4bbdfSmrg        return SProcXkbGetKbdByName(client);
53005b261ecSmrg    case X_kbGetDeviceInfo:
53135c4bbdfSmrg        return SProcXkbGetDeviceInfo(client);
53205b261ecSmrg    case X_kbSetDeviceInfo:
53335c4bbdfSmrg        return SProcXkbSetDeviceInfo(client);
53405b261ecSmrg    case X_kbSetDebuggingFlags:
53535c4bbdfSmrg        return SProcXkbSetDebuggingFlags(client);
53605b261ecSmrg    default:
53735c4bbdfSmrg        return BadRequest;
53805b261ecSmrg    }
53905b261ecSmrg}
540