rrsdispatch.c revision 05b261ec
105b261ecSmrg/*
205b261ecSmrg * Copyright © 2006 Keith Packard
305b261ecSmrg *
405b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
505b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
605b261ecSmrg * the above copyright notice appear in all copies and that both that copyright
705b261ecSmrg * notice and this permission notice appear in supporting documentation, and
805b261ecSmrg * that the name of the copyright holders not be used in advertising or
905b261ecSmrg * publicity pertaining to distribution of the software without specific,
1005b261ecSmrg * written prior permission.  The copyright holders make no representations
1105b261ecSmrg * about the suitability of this software for any purpose.  It is provided "as
1205b261ecSmrg * is" without express or implied warranty.
1305b261ecSmrg *
1405b261ecSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1505b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1605b261ecSmrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1705b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1805b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1905b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
2005b261ecSmrg * OF THIS SOFTWARE.
2105b261ecSmrg */
2205b261ecSmrg
2305b261ecSmrg#include "randrstr.h"
2405b261ecSmrg
2505b261ecSmrgstatic int
2605b261ecSmrgSProcRRQueryVersion (ClientPtr client)
2705b261ecSmrg{
2805b261ecSmrg    register int n;
2905b261ecSmrg    REQUEST(xRRQueryVersionReq);
3005b261ecSmrg
3105b261ecSmrg    swaps(&stuff->length, n);
3205b261ecSmrg    swapl(&stuff->majorVersion, n);
3305b261ecSmrg    swapl(&stuff->minorVersion, n);
3405b261ecSmrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
3505b261ecSmrg}
3605b261ecSmrg
3705b261ecSmrgstatic int
3805b261ecSmrgSProcRRGetScreenInfo (ClientPtr client)
3905b261ecSmrg{
4005b261ecSmrg    register int n;
4105b261ecSmrg    REQUEST(xRRGetScreenInfoReq);
4205b261ecSmrg
4305b261ecSmrg    swaps(&stuff->length, n);
4405b261ecSmrg    swapl(&stuff->window, n);
4505b261ecSmrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
4605b261ecSmrg}
4705b261ecSmrg
4805b261ecSmrgstatic int
4905b261ecSmrgSProcRRSetScreenConfig (ClientPtr client)
5005b261ecSmrg{
5105b261ecSmrg    register int n;
5205b261ecSmrg    REQUEST(xRRSetScreenConfigReq);
5305b261ecSmrg
5405b261ecSmrg    if (RRClientKnowsRates (client))
5505b261ecSmrg    {
5605b261ecSmrg	REQUEST_SIZE_MATCH (xRRSetScreenConfigReq);
5705b261ecSmrg	swaps (&stuff->rate, n);
5805b261ecSmrg    }
5905b261ecSmrg    else
6005b261ecSmrg    {
6105b261ecSmrg	REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq);
6205b261ecSmrg    }
6305b261ecSmrg
6405b261ecSmrg    swaps(&stuff->length, n);
6505b261ecSmrg    swapl(&stuff->drawable, n);
6605b261ecSmrg    swapl(&stuff->timestamp, n);
6705b261ecSmrg    swaps(&stuff->sizeID, n);
6805b261ecSmrg    swaps(&stuff->rotation, n);
6905b261ecSmrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
7005b261ecSmrg}
7105b261ecSmrg
7205b261ecSmrgstatic int
7305b261ecSmrgSProcRRSelectInput (ClientPtr client)
7405b261ecSmrg{
7505b261ecSmrg    register int n;
7605b261ecSmrg    REQUEST(xRRSelectInputReq);
7705b261ecSmrg
7805b261ecSmrg    swaps(&stuff->length, n);
7905b261ecSmrg    swapl(&stuff->window, n);
8005b261ecSmrg    swaps(&stuff->enable, n);
8105b261ecSmrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
8205b261ecSmrg}
8305b261ecSmrg
8405b261ecSmrgstatic int
8505b261ecSmrgSProcRRGetScreenSizeRange (ClientPtr client)
8605b261ecSmrg{
8705b261ecSmrg    REQUEST(xRRGetScreenSizeRangeReq);
8805b261ecSmrg
8905b261ecSmrg    REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
9005b261ecSmrg    (void) stuff;
9105b261ecSmrg    return BadImplementation;
9205b261ecSmrg}
9305b261ecSmrg
9405b261ecSmrgstatic int
9505b261ecSmrgSProcRRSetScreenSize (ClientPtr client)
9605b261ecSmrg{
9705b261ecSmrg    REQUEST(xRRSetScreenSizeReq);
9805b261ecSmrg
9905b261ecSmrg    REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
10005b261ecSmrg    (void) stuff;
10105b261ecSmrg    return BadImplementation;
10205b261ecSmrg}
10305b261ecSmrg
10405b261ecSmrgstatic int
10505b261ecSmrgSProcRRGetScreenResources (ClientPtr client)
10605b261ecSmrg{
10705b261ecSmrg    REQUEST(xRRGetScreenResourcesReq);
10805b261ecSmrg
10905b261ecSmrg    REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
11005b261ecSmrg    (void) stuff;
11105b261ecSmrg    return BadImplementation;
11205b261ecSmrg}
11305b261ecSmrg
11405b261ecSmrgstatic int
11505b261ecSmrgSProcRRGetOutputInfo (ClientPtr client)
11605b261ecSmrg{
11705b261ecSmrg    REQUEST(xRRGetOutputInfoReq);;
11805b261ecSmrg
11905b261ecSmrg    REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
12005b261ecSmrg    (void) stuff;
12105b261ecSmrg    return BadImplementation;
12205b261ecSmrg}
12305b261ecSmrg
12405b261ecSmrgstatic int
12505b261ecSmrgSProcRRListOutputProperties (ClientPtr client)
12605b261ecSmrg{
12705b261ecSmrg    REQUEST(xRRListOutputPropertiesReq);
12805b261ecSmrg
12905b261ecSmrg    REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
13005b261ecSmrg    (void) stuff;
13105b261ecSmrg    return BadImplementation;
13205b261ecSmrg}
13305b261ecSmrg
13405b261ecSmrgstatic int
13505b261ecSmrgSProcRRQueryOutputProperty (ClientPtr client)
13605b261ecSmrg{
13705b261ecSmrg    REQUEST(xRRQueryOutputPropertyReq);
13805b261ecSmrg
13905b261ecSmrg    REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
14005b261ecSmrg    (void) stuff;
14105b261ecSmrg    return BadImplementation;
14205b261ecSmrg}
14305b261ecSmrg
14405b261ecSmrgstatic int
14505b261ecSmrgSProcRRConfigureOutputProperty (ClientPtr client)
14605b261ecSmrg{
14705b261ecSmrg    REQUEST(xRRConfigureOutputPropertyReq);
14805b261ecSmrg
14905b261ecSmrg    REQUEST_SIZE_MATCH(xRRConfigureOutputPropertyReq);
15005b261ecSmrg    (void) stuff;
15105b261ecSmrg    return BadImplementation;
15205b261ecSmrg}
15305b261ecSmrg
15405b261ecSmrgstatic int
15505b261ecSmrgSProcRRChangeOutputProperty (ClientPtr client)
15605b261ecSmrg{
15705b261ecSmrg    REQUEST(xRRChangeOutputPropertyReq);
15805b261ecSmrg
15905b261ecSmrg    REQUEST_SIZE_MATCH(xRRChangeOutputPropertyReq);
16005b261ecSmrg    (void) stuff;
16105b261ecSmrg    return BadImplementation;
16205b261ecSmrg}
16305b261ecSmrg
16405b261ecSmrgstatic int
16505b261ecSmrgSProcRRDeleteOutputProperty (ClientPtr client)
16605b261ecSmrg{
16705b261ecSmrg    REQUEST(xRRDeleteOutputPropertyReq);
16805b261ecSmrg
16905b261ecSmrg    REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
17005b261ecSmrg    (void) stuff;
17105b261ecSmrg    return BadImplementation;
17205b261ecSmrg}
17305b261ecSmrg
17405b261ecSmrgstatic int
17505b261ecSmrgSProcRRGetOutputProperty (ClientPtr client)
17605b261ecSmrg{
17705b261ecSmrg    REQUEST(xRRGetOutputPropertyReq);
17805b261ecSmrg
17905b261ecSmrg    REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
18005b261ecSmrg    (void) stuff;
18105b261ecSmrg    return BadImplementation;
18205b261ecSmrg}
18305b261ecSmrg
18405b261ecSmrgstatic int
18505b261ecSmrgSProcRRCreateMode (ClientPtr client)
18605b261ecSmrg{
18705b261ecSmrg    REQUEST(xRRCreateModeReq);
18805b261ecSmrg
18905b261ecSmrg    REQUEST_SIZE_MATCH(xRRCreateModeReq);
19005b261ecSmrg    (void) stuff;
19105b261ecSmrg    return BadImplementation;
19205b261ecSmrg}
19305b261ecSmrg
19405b261ecSmrgstatic int
19505b261ecSmrgSProcRRDestroyMode (ClientPtr client)
19605b261ecSmrg{
19705b261ecSmrg    REQUEST(xRRDestroyModeReq);
19805b261ecSmrg
19905b261ecSmrg    REQUEST_SIZE_MATCH(xRRDestroyModeReq);
20005b261ecSmrg    (void) stuff;
20105b261ecSmrg    return BadImplementation;
20205b261ecSmrg}
20305b261ecSmrg
20405b261ecSmrgstatic int
20505b261ecSmrgSProcRRAddOutputMode (ClientPtr client)
20605b261ecSmrg{
20705b261ecSmrg    REQUEST(xRRAddOutputModeReq);
20805b261ecSmrg
20905b261ecSmrg    REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
21005b261ecSmrg    (void) stuff;
21105b261ecSmrg    return BadImplementation;
21205b261ecSmrg}
21305b261ecSmrg
21405b261ecSmrgstatic int
21505b261ecSmrgSProcRRDeleteOutputMode (ClientPtr client)
21605b261ecSmrg{
21705b261ecSmrg    REQUEST(xRRDeleteOutputModeReq);
21805b261ecSmrg
21905b261ecSmrg    REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
22005b261ecSmrg    (void) stuff;
22105b261ecSmrg    return BadImplementation;
22205b261ecSmrg}
22305b261ecSmrg
22405b261ecSmrgstatic int
22505b261ecSmrgSProcRRGetCrtcInfo (ClientPtr client)
22605b261ecSmrg{
22705b261ecSmrg    REQUEST(xRRGetCrtcInfoReq);
22805b261ecSmrg
22905b261ecSmrg    REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
23005b261ecSmrg    (void) stuff;
23105b261ecSmrg    return BadImplementation;
23205b261ecSmrg}
23305b261ecSmrg
23405b261ecSmrgstatic int
23505b261ecSmrgSProcRRSetCrtcConfig (ClientPtr client)
23605b261ecSmrg{
23705b261ecSmrg    REQUEST(xRRSetCrtcConfigReq);
23805b261ecSmrg
23905b261ecSmrg    REQUEST_SIZE_MATCH(xRRSetCrtcConfigReq);
24005b261ecSmrg    (void) stuff;
24105b261ecSmrg    return BadImplementation;
24205b261ecSmrg}
24305b261ecSmrg
24405b261ecSmrgstatic int
24505b261ecSmrgSProcRRGetCrtcGammaSize (ClientPtr client)
24605b261ecSmrg{
24705b261ecSmrg    REQUEST(xRRGetCrtcGammaSizeReq);
24805b261ecSmrg
24905b261ecSmrg    REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
25005b261ecSmrg    (void) stuff;
25105b261ecSmrg    return BadImplementation;
25205b261ecSmrg}
25305b261ecSmrg
25405b261ecSmrgstatic int
25505b261ecSmrgSProcRRGetCrtcGamma (ClientPtr client)
25605b261ecSmrg{
25705b261ecSmrg    REQUEST(xRRGetCrtcGammaReq);
25805b261ecSmrg
25905b261ecSmrg    REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
26005b261ecSmrg    (void) stuff;
26105b261ecSmrg    return BadImplementation;
26205b261ecSmrg}
26305b261ecSmrg
26405b261ecSmrgstatic int
26505b261ecSmrgSProcRRSetCrtcGamma (ClientPtr client)
26605b261ecSmrg{
26705b261ecSmrg    REQUEST(xRRSetCrtcGammaReq);
26805b261ecSmrg
26905b261ecSmrg    REQUEST_SIZE_MATCH(xRRSetCrtcGammaReq);
27005b261ecSmrg    (void) stuff;
27105b261ecSmrg    return BadImplementation;
27205b261ecSmrg}
27305b261ecSmrg
27405b261ecSmrgint (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
27505b261ecSmrg    SProcRRQueryVersion,	/* 0 */
27605b261ecSmrg/* we skip 1 to make old clients fail pretty immediately */
27705b261ecSmrg    NULL,			/* 1 SProcRandrOldGetScreenInfo */
27805b261ecSmrg/* V1.0 apps share the same set screen config request id */
27905b261ecSmrg    SProcRRSetScreenConfig,	/* 2 */
28005b261ecSmrg    NULL,			/* 3 SProcRandrOldScreenChangeSelectInput */
28105b261ecSmrg/* 3 used to be ScreenChangeSelectInput; deprecated */
28205b261ecSmrg    SProcRRSelectInput,		/* 4 */
28305b261ecSmrg    SProcRRGetScreenInfo,    	/* 5 */
28405b261ecSmrg/* V1.2 additions */
28505b261ecSmrg    SProcRRGetScreenSizeRange,	/* 6 */
28605b261ecSmrg    SProcRRSetScreenSize,	/* 7 */
28705b261ecSmrg    SProcRRGetScreenResources,	/* 8 */
28805b261ecSmrg    SProcRRGetOutputInfo,	/* 9 */
28905b261ecSmrg    SProcRRListOutputProperties,/* 10 */
29005b261ecSmrg    SProcRRQueryOutputProperty,	/* 11 */
29105b261ecSmrg    SProcRRConfigureOutputProperty,  /* 12 */
29205b261ecSmrg    SProcRRChangeOutputProperty,/* 13 */
29305b261ecSmrg    SProcRRDeleteOutputProperty,/* 14 */
29405b261ecSmrg    SProcRRGetOutputProperty,	/* 15 */
29505b261ecSmrg    SProcRRCreateMode,		/* 16 */
29605b261ecSmrg    SProcRRDestroyMode,		/* 17 */
29705b261ecSmrg    SProcRRAddOutputMode,	/* 18 */
29805b261ecSmrg    SProcRRDeleteOutputMode,	/* 19 */
29905b261ecSmrg    SProcRRGetCrtcInfo,		/* 20 */
30005b261ecSmrg    SProcRRSetCrtcConfig,	/* 21 */
30105b261ecSmrg    SProcRRGetCrtcGammaSize,	/* 22 */
30205b261ecSmrg    SProcRRGetCrtcGamma,	/* 23 */
30305b261ecSmrg    SProcRRSetCrtcGamma,	/* 24 */
30405b261ecSmrg};
30505b261ecSmrg
306