135c4bbdfSmrg/*
235c4bbdfSmrg * Minimal implementation of PanoramiX/Xinerama
335c4bbdfSmrg *
435c4bbdfSmrg * This is used in rootless mode where the underlying window server
535c4bbdfSmrg * already provides an abstracted view of multiple screens as one
635c4bbdfSmrg * large screen area.
735c4bbdfSmrg *
835c4bbdfSmrg * This code is largely based on panoramiX.c, which contains the
935c4bbdfSmrg * following copyright notice:
1035c4bbdfSmrg */
1135c4bbdfSmrg/*****************************************************************
1235c4bbdfSmrg   Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
1335c4bbdfSmrg   Permission is hereby granted, free of charge, to any person obtaining a copy
1435c4bbdfSmrg   of this software and associated documentation files (the "Software"), to deal
1535c4bbdfSmrg   in the Software without restriction, including without limitation the rights
1635c4bbdfSmrg   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1735c4bbdfSmrg   copies of the Software.
1835c4bbdfSmrg
1935c4bbdfSmrg   The above copyright notice and this permission notice shall be included in
2035c4bbdfSmrg   all copies or substantial portions of the Software.
2135c4bbdfSmrg
2235c4bbdfSmrg   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2335c4bbdfSmrg   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2435c4bbdfSmrg   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2535c4bbdfSmrg   DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
2635c4bbdfSmrg   BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
2735c4bbdfSmrg   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
2835c4bbdfSmrg   IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2935c4bbdfSmrg
3035c4bbdfSmrg   Except as contained in this notice, the name of Digital Equipment Corporation
3135c4bbdfSmrg   shall not be used in advertising or otherwise to promote the sale, use or other
3235c4bbdfSmrg   dealings in this Software without prior written authorization from Digital
3335c4bbdfSmrg   Equipment Corporation.
3435c4bbdfSmrg ******************************************************************/
3535c4bbdfSmrg
3635c4bbdfSmrg#ifdef HAVE_DIX_CONFIG_H
3735c4bbdfSmrg#include <dix-config.h>
3835c4bbdfSmrg#endif
3935c4bbdfSmrg
4035c4bbdfSmrg#include "pseudoramiX.h"
4135c4bbdfSmrg#include "extnsionst.h"
4235c4bbdfSmrg#include "nonsdk_extinit.h"
4335c4bbdfSmrg#include "dixstruct.h"
4435c4bbdfSmrg#include "window.h"
4535c4bbdfSmrg#include <X11/extensions/panoramiXproto.h>
4635c4bbdfSmrg#include "globals.h"
4735c4bbdfSmrg
4835c4bbdfSmrg#define TRACE PseudoramiXTrace("TRACE " __FILE__ ":%s",__FUNCTION__)
4935c4bbdfSmrg#define DEBUG_LOG PseudoramiXDebug
5035c4bbdfSmrg
5135c4bbdfSmrgBool noPseudoramiXExtension = FALSE;
5235c4bbdfSmrgextern Bool noRRXineramaExtension;
5335c4bbdfSmrg
5435c4bbdfSmrgextern int
5535c4bbdfSmrgProcPanoramiXQueryVersion(ClientPtr client);
5635c4bbdfSmrg
5735c4bbdfSmrgstatic void
5835c4bbdfSmrgPseudoramiXResetProc(ExtensionEntry *extEntry);
5935c4bbdfSmrg
6035c4bbdfSmrgstatic int
6135c4bbdfSmrgProcPseudoramiXQueryVersion(ClientPtr client);
6235c4bbdfSmrgstatic int
6335c4bbdfSmrgProcPseudoramiXGetState(ClientPtr client);
6435c4bbdfSmrgstatic int
6535c4bbdfSmrgProcPseudoramiXGetScreenCount(ClientPtr client);
6635c4bbdfSmrgstatic int
6735c4bbdfSmrgProcPseudoramiXGetScreenSize(ClientPtr client);
6835c4bbdfSmrgstatic int
6935c4bbdfSmrgProcPseudoramiXIsActive(ClientPtr client);
7035c4bbdfSmrgstatic int
7135c4bbdfSmrgProcPseudoramiXQueryScreens(ClientPtr client);
7235c4bbdfSmrgstatic int
7335c4bbdfSmrgProcPseudoramiXDispatch(ClientPtr client);
7435c4bbdfSmrg
7535c4bbdfSmrgstatic int
7635c4bbdfSmrgSProcPseudoramiXQueryVersion(ClientPtr client);
7735c4bbdfSmrgstatic int
7835c4bbdfSmrgSProcPseudoramiXGetState(ClientPtr client);
7935c4bbdfSmrgstatic int
8035c4bbdfSmrgSProcPseudoramiXGetScreenCount(ClientPtr client);
8135c4bbdfSmrgstatic int
8235c4bbdfSmrgSProcPseudoramiXGetScreenSize(ClientPtr client);
8335c4bbdfSmrgstatic int
8435c4bbdfSmrgSProcPseudoramiXIsActive(ClientPtr client);
8535c4bbdfSmrgstatic int
8635c4bbdfSmrgSProcPseudoramiXQueryScreens(ClientPtr client);
8735c4bbdfSmrgstatic int
8835c4bbdfSmrgSProcPseudoramiXDispatch(ClientPtr client);
8935c4bbdfSmrg
9035c4bbdfSmrgtypedef struct {
9135c4bbdfSmrg    int x;
9235c4bbdfSmrg    int y;
9335c4bbdfSmrg    int w;
9435c4bbdfSmrg    int h;
9535c4bbdfSmrg} PseudoramiXScreenRec;
9635c4bbdfSmrg
9735c4bbdfSmrgstatic PseudoramiXScreenRec *pseudoramiXScreens = NULL;
9835c4bbdfSmrgstatic int pseudoramiXScreensAllocated = 0;
9935c4bbdfSmrgstatic int pseudoramiXNumScreens = 0;
10035c4bbdfSmrgstatic unsigned long pseudoramiXGeneration = 0;
10135c4bbdfSmrg
10235c4bbdfSmrgstatic void
10335c4bbdfSmrgPseudoramiXTrace(const char *format, ...)
10435c4bbdfSmrg    _X_ATTRIBUTE_PRINTF(1, 2);
10535c4bbdfSmrg
10635c4bbdfSmrgstatic void
10735c4bbdfSmrgPseudoramiXTrace(const char *format, ...)
10835c4bbdfSmrg{
10935c4bbdfSmrg    va_list ap;
11035c4bbdfSmrg
11135c4bbdfSmrg    va_start(ap, format);
11235c4bbdfSmrg    LogVMessageVerb(X_NONE, 10, format, ap);
11335c4bbdfSmrg    va_end(ap);
11435c4bbdfSmrg}
11535c4bbdfSmrg
11635c4bbdfSmrgstatic void
11735c4bbdfSmrgPseudoramiXDebug(const char *format, ...)
11835c4bbdfSmrg    _X_ATTRIBUTE_PRINTF(1, 2);
11935c4bbdfSmrg
12035c4bbdfSmrgstatic void
12135c4bbdfSmrgPseudoramiXDebug(const char *format, ...)
12235c4bbdfSmrg{
12335c4bbdfSmrg    va_list ap;
12435c4bbdfSmrg
12535c4bbdfSmrg    va_start(ap, format);
12635c4bbdfSmrg    LogVMessageVerb(X_NONE, 3, format, ap);
12735c4bbdfSmrg    va_end(ap);
12835c4bbdfSmrg}
12935c4bbdfSmrg
13035c4bbdfSmrg// Add a PseudoramiX screen.
13135c4bbdfSmrg// The rest of the X server will know nothing about this screen.
13235c4bbdfSmrg// Can be called before or after extension init.
13335c4bbdfSmrg// Screens must be re-added once per generation.
13435c4bbdfSmrgvoid
13535c4bbdfSmrgPseudoramiXAddScreen(int x, int y, int w, int h)
13635c4bbdfSmrg{
13735c4bbdfSmrg    PseudoramiXScreenRec *s;
13835c4bbdfSmrg
13935c4bbdfSmrg    if (noPseudoramiXExtension) return;
14035c4bbdfSmrg
14135c4bbdfSmrg    if (pseudoramiXNumScreens == pseudoramiXScreensAllocated) {
14235c4bbdfSmrg        pseudoramiXScreensAllocated += pseudoramiXScreensAllocated + 1;
14335c4bbdfSmrg        pseudoramiXScreens = reallocarray(pseudoramiXScreens,
14435c4bbdfSmrg                                          pseudoramiXScreensAllocated,
14535c4bbdfSmrg                                          sizeof(PseudoramiXScreenRec));
14635c4bbdfSmrg    }
14735c4bbdfSmrg
14835c4bbdfSmrg    DEBUG_LOG("x: %d, y: %d, w: %d, h: %d\n", x, y, w, h);
14935c4bbdfSmrg
15035c4bbdfSmrg    s = &pseudoramiXScreens[pseudoramiXNumScreens++];
15135c4bbdfSmrg    s->x = x;
15235c4bbdfSmrg    s->y = y;
15335c4bbdfSmrg    s->w = w;
15435c4bbdfSmrg    s->h = h;
15535c4bbdfSmrg}
15635c4bbdfSmrg
15735c4bbdfSmrg// Initialize PseudoramiX.
15835c4bbdfSmrg// Copied from PanoramiXExtensionInit
15935c4bbdfSmrgvoid
16035c4bbdfSmrgPseudoramiXExtensionInit(void)
16135c4bbdfSmrg{
16235c4bbdfSmrg    Bool success = FALSE;
16335c4bbdfSmrg    ExtensionEntry      *extEntry;
16435c4bbdfSmrg
16535c4bbdfSmrg    if (noPseudoramiXExtension) return;
16635c4bbdfSmrg
16735c4bbdfSmrg    TRACE;
16835c4bbdfSmrg
16935c4bbdfSmrg    /* Even with only one screen we need to enable PseudoramiX to allow
17035c4bbdfSmrg       dynamic screen configuration changes. */
17135c4bbdfSmrg#if 0
17235c4bbdfSmrg    if (pseudoramiXNumScreens == 1) {
17335c4bbdfSmrg        // Only one screen - disable Xinerama extension.
17435c4bbdfSmrg        noPseudoramiXExtension = TRUE;
17535c4bbdfSmrg        return;
17635c4bbdfSmrg    }
17735c4bbdfSmrg#endif
17835c4bbdfSmrg
17935c4bbdfSmrg    if (pseudoramiXGeneration != serverGeneration) {
18035c4bbdfSmrg        extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
18135c4bbdfSmrg                                ProcPseudoramiXDispatch,
18235c4bbdfSmrg                                SProcPseudoramiXDispatch,
18335c4bbdfSmrg                                PseudoramiXResetProc,
18435c4bbdfSmrg                                StandardMinorOpcode);
18535c4bbdfSmrg        if (!extEntry) {
18635c4bbdfSmrg            ErrorF("PseudoramiXExtensionInit(): AddExtension failed\n");
18735c4bbdfSmrg        }
18835c4bbdfSmrg        else {
18935c4bbdfSmrg            pseudoramiXGeneration = serverGeneration;
19035c4bbdfSmrg            success = TRUE;
19135c4bbdfSmrg        }
19235c4bbdfSmrg    }
19335c4bbdfSmrg
19435c4bbdfSmrg    /* Do not allow RRXinerama to initialize if we did */
19535c4bbdfSmrg    noRRXineramaExtension = success;
19635c4bbdfSmrg
19735c4bbdfSmrg    if (!success) {
19835c4bbdfSmrg        ErrorF("%s Extension (PseudoramiX) failed to initialize\n",
19935c4bbdfSmrg               PANORAMIX_PROTOCOL_NAME);
20035c4bbdfSmrg        return;
20135c4bbdfSmrg    }
20235c4bbdfSmrg}
20335c4bbdfSmrg
20435c4bbdfSmrgvoid
20535c4bbdfSmrgPseudoramiXResetScreens(void)
20635c4bbdfSmrg{
20735c4bbdfSmrg    TRACE;
20835c4bbdfSmrg
20935c4bbdfSmrg    pseudoramiXNumScreens = 0;
21035c4bbdfSmrg}
21135c4bbdfSmrg
21235c4bbdfSmrgstatic void
21335c4bbdfSmrgPseudoramiXResetProc(ExtensionEntry *extEntry)
21435c4bbdfSmrg{
21535c4bbdfSmrg    TRACE;
21635c4bbdfSmrg
21735c4bbdfSmrg    PseudoramiXResetScreens();
21835c4bbdfSmrg}
21935c4bbdfSmrg
22035c4bbdfSmrg// was PanoramiX
22135c4bbdfSmrgstatic int
22235c4bbdfSmrgProcPseudoramiXQueryVersion(ClientPtr client)
22335c4bbdfSmrg{
22435c4bbdfSmrg    TRACE;
22535c4bbdfSmrg
22635c4bbdfSmrg    return ProcPanoramiXQueryVersion(client);
22735c4bbdfSmrg}
22835c4bbdfSmrg
22935c4bbdfSmrg// was PanoramiX
23035c4bbdfSmrgstatic int
23135c4bbdfSmrgProcPseudoramiXGetState(ClientPtr client)
23235c4bbdfSmrg{
23335c4bbdfSmrg    REQUEST(xPanoramiXGetStateReq);
23435c4bbdfSmrg    WindowPtr pWin;
23535c4bbdfSmrg    xPanoramiXGetStateReply rep;
23635c4bbdfSmrg    register int rc;
23735c4bbdfSmrg
23835c4bbdfSmrg    TRACE;
23935c4bbdfSmrg
24035c4bbdfSmrg    REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
24135c4bbdfSmrg    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
24235c4bbdfSmrg    if (rc != Success)
24335c4bbdfSmrg        return rc;
24435c4bbdfSmrg
24535c4bbdfSmrg    rep.type = X_Reply;
24635c4bbdfSmrg    rep.length = 0;
24735c4bbdfSmrg    rep.sequenceNumber = client->sequence;
24835c4bbdfSmrg    rep.state = !noPseudoramiXExtension;
24935c4bbdfSmrg    rep.window = stuff->window;
25035c4bbdfSmrg    if (client->swapped) {
25135c4bbdfSmrg        swaps(&rep.sequenceNumber);
25235c4bbdfSmrg        swapl(&rep.length);
25335c4bbdfSmrg        swapl(&rep.window);
25435c4bbdfSmrg    }
25535c4bbdfSmrg    WriteToClient(client, sizeof(xPanoramiXGetStateReply),&rep);
25635c4bbdfSmrg    return Success;
25735c4bbdfSmrg}
25835c4bbdfSmrg
25935c4bbdfSmrg// was PanoramiX
26035c4bbdfSmrgstatic int
26135c4bbdfSmrgProcPseudoramiXGetScreenCount(ClientPtr client)
26235c4bbdfSmrg{
26335c4bbdfSmrg    REQUEST(xPanoramiXGetScreenCountReq);
26435c4bbdfSmrg    WindowPtr pWin;
26535c4bbdfSmrg    xPanoramiXGetScreenCountReply rep;
26635c4bbdfSmrg    register int rc;
26735c4bbdfSmrg
26835c4bbdfSmrg    TRACE;
26935c4bbdfSmrg
27035c4bbdfSmrg    REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
27135c4bbdfSmrg    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
27235c4bbdfSmrg    if (rc != Success)
27335c4bbdfSmrg        return rc;
27435c4bbdfSmrg
27535c4bbdfSmrg    rep.type = X_Reply;
27635c4bbdfSmrg    rep.length = 0;
27735c4bbdfSmrg    rep.sequenceNumber = client->sequence;
27835c4bbdfSmrg    rep.ScreenCount = pseudoramiXNumScreens;
27935c4bbdfSmrg    rep.window = stuff->window;
28035c4bbdfSmrg    if (client->swapped) {
28135c4bbdfSmrg        swaps(&rep.sequenceNumber);
28235c4bbdfSmrg        swapl(&rep.length);
28335c4bbdfSmrg        swapl(&rep.window);
28435c4bbdfSmrg    }
28535c4bbdfSmrg    WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply),&rep);
28635c4bbdfSmrg    return Success;
28735c4bbdfSmrg}
28835c4bbdfSmrg
28935c4bbdfSmrg// was PanoramiX
29035c4bbdfSmrgstatic int
29135c4bbdfSmrgProcPseudoramiXGetScreenSize(ClientPtr client)
29235c4bbdfSmrg{
29335c4bbdfSmrg    REQUEST(xPanoramiXGetScreenSizeReq);
29435c4bbdfSmrg    WindowPtr pWin;
29535c4bbdfSmrg    xPanoramiXGetScreenSizeReply rep;
29635c4bbdfSmrg    register int rc;
29735c4bbdfSmrg
29835c4bbdfSmrg    TRACE;
29935c4bbdfSmrg
3006e78d31fSmrg    REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
3016e78d31fSmrg
30235c4bbdfSmrg    if (stuff->screen >= pseudoramiXNumScreens)
30335c4bbdfSmrg      return BadMatch;
30435c4bbdfSmrg
30535c4bbdfSmrg    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
30635c4bbdfSmrg    if (rc != Success)
30735c4bbdfSmrg        return rc;
30835c4bbdfSmrg
30935c4bbdfSmrg    rep.type = X_Reply;
31035c4bbdfSmrg    rep.length = 0;
31135c4bbdfSmrg    rep.sequenceNumber = client->sequence;
31235c4bbdfSmrg    /* screen dimensions */
31335c4bbdfSmrg    rep.width = pseudoramiXScreens[stuff->screen].w;
31435c4bbdfSmrg    // was screenInfo.screens[stuff->screen]->width;
31535c4bbdfSmrg    rep.height = pseudoramiXScreens[stuff->screen].h;
31635c4bbdfSmrg    // was screenInfo.screens[stuff->screen]->height;
31735c4bbdfSmrg    rep.window = stuff->window;
31835c4bbdfSmrg    rep.screen = stuff->screen;
31935c4bbdfSmrg    if (client->swapped) {
32035c4bbdfSmrg        swaps(&rep.sequenceNumber);
32135c4bbdfSmrg        swapl(&rep.length);
32235c4bbdfSmrg        swapl(&rep.width);
32335c4bbdfSmrg        swapl(&rep.height);
32435c4bbdfSmrg        swapl(&rep.window);
32535c4bbdfSmrg        swapl(&rep.screen);
32635c4bbdfSmrg    }
32735c4bbdfSmrg    WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply),&rep);
32835c4bbdfSmrg    return Success;
32935c4bbdfSmrg}
33035c4bbdfSmrg
33135c4bbdfSmrg// was Xinerama
33235c4bbdfSmrgstatic int
33335c4bbdfSmrgProcPseudoramiXIsActive(ClientPtr client)
33435c4bbdfSmrg{
33535c4bbdfSmrg    /* REQUEST(xXineramaIsActiveReq); */
33635c4bbdfSmrg    xXineramaIsActiveReply rep;
33735c4bbdfSmrg
33835c4bbdfSmrg    TRACE;
33935c4bbdfSmrg
34035c4bbdfSmrg    REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
34135c4bbdfSmrg
34235c4bbdfSmrg    rep.type = X_Reply;
34335c4bbdfSmrg    rep.length = 0;
34435c4bbdfSmrg    rep.sequenceNumber = client->sequence;
34535c4bbdfSmrg    rep.state = !noPseudoramiXExtension;
34635c4bbdfSmrg    if (client->swapped) {
34735c4bbdfSmrg        swaps(&rep.sequenceNumber);
34835c4bbdfSmrg        swapl(&rep.length);
34935c4bbdfSmrg        swapl(&rep.state);
35035c4bbdfSmrg    }
35135c4bbdfSmrg    WriteToClient(client, sizeof(xXineramaIsActiveReply),&rep);
35235c4bbdfSmrg    return Success;
35335c4bbdfSmrg}
35435c4bbdfSmrg
35535c4bbdfSmrg// was Xinerama
35635c4bbdfSmrgstatic int
35735c4bbdfSmrgProcPseudoramiXQueryScreens(ClientPtr client)
35835c4bbdfSmrg{
35935c4bbdfSmrg    /* REQUEST(xXineramaQueryScreensReq); */
36035c4bbdfSmrg    xXineramaQueryScreensReply rep;
36135c4bbdfSmrg
36235c4bbdfSmrg    DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n",
36335c4bbdfSmrg              noPseudoramiXExtension,
36435c4bbdfSmrg              pseudoramiXNumScreens);
36535c4bbdfSmrg
36635c4bbdfSmrg    REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
36735c4bbdfSmrg
36835c4bbdfSmrg    rep.type = X_Reply;
36935c4bbdfSmrg    rep.sequenceNumber = client->sequence;
37035c4bbdfSmrg    rep.number = noPseudoramiXExtension ? 0 : pseudoramiXNumScreens;
37135c4bbdfSmrg    rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
37235c4bbdfSmrg    if (client->swapped) {
37335c4bbdfSmrg        swaps(&rep.sequenceNumber);
37435c4bbdfSmrg        swapl(&rep.length);
37535c4bbdfSmrg        swapl(&rep.number);
37635c4bbdfSmrg    }
37735c4bbdfSmrg    WriteToClient(client, sizeof(xXineramaQueryScreensReply),&rep);
37835c4bbdfSmrg
37935c4bbdfSmrg    if (!noPseudoramiXExtension) {
38035c4bbdfSmrg        xXineramaScreenInfo scratch;
38135c4bbdfSmrg        int i;
38235c4bbdfSmrg
38335c4bbdfSmrg        for (i = 0; i < pseudoramiXNumScreens; i++) {
38435c4bbdfSmrg            scratch.x_org = pseudoramiXScreens[i].x;
38535c4bbdfSmrg            scratch.y_org = pseudoramiXScreens[i].y;
38635c4bbdfSmrg            scratch.width = pseudoramiXScreens[i].w;
38735c4bbdfSmrg            scratch.height = pseudoramiXScreens[i].h;
38835c4bbdfSmrg
38935c4bbdfSmrg            if (client->swapped) {
39035c4bbdfSmrg                swaps(&scratch.x_org);
39135c4bbdfSmrg                swaps(&scratch.y_org);
39235c4bbdfSmrg                swaps(&scratch.width);
39335c4bbdfSmrg                swaps(&scratch.height);
39435c4bbdfSmrg            }
39535c4bbdfSmrg            WriteToClient(client, sz_XineramaScreenInfo,&scratch);
39635c4bbdfSmrg        }
39735c4bbdfSmrg    }
39835c4bbdfSmrg
39935c4bbdfSmrg    return Success;
40035c4bbdfSmrg}
40135c4bbdfSmrg
40235c4bbdfSmrg// was PanoramiX
40335c4bbdfSmrgstatic int
40435c4bbdfSmrgProcPseudoramiXDispatch(ClientPtr client)
40535c4bbdfSmrg{
40635c4bbdfSmrg    REQUEST(xReq);
40735c4bbdfSmrg    TRACE;
40835c4bbdfSmrg    switch (stuff->data) {
40935c4bbdfSmrg    case X_PanoramiXQueryVersion:
41035c4bbdfSmrg        return ProcPseudoramiXQueryVersion(client);
41135c4bbdfSmrg
41235c4bbdfSmrg    case X_PanoramiXGetState:
41335c4bbdfSmrg        return ProcPseudoramiXGetState(client);
41435c4bbdfSmrg
41535c4bbdfSmrg    case X_PanoramiXGetScreenCount:
41635c4bbdfSmrg        return ProcPseudoramiXGetScreenCount(client);
41735c4bbdfSmrg
41835c4bbdfSmrg    case X_PanoramiXGetScreenSize:
41935c4bbdfSmrg        return ProcPseudoramiXGetScreenSize(client);
42035c4bbdfSmrg
42135c4bbdfSmrg    case X_XineramaIsActive:
42235c4bbdfSmrg        return ProcPseudoramiXIsActive(client);
42335c4bbdfSmrg
42435c4bbdfSmrg    case X_XineramaQueryScreens:
42535c4bbdfSmrg        return ProcPseudoramiXQueryScreens(client);
42635c4bbdfSmrg    }
42735c4bbdfSmrg    return BadRequest;
42835c4bbdfSmrg}
42935c4bbdfSmrg
43035c4bbdfSmrgstatic int
43135c4bbdfSmrgSProcPseudoramiXQueryVersion(ClientPtr client)
43235c4bbdfSmrg{
43335c4bbdfSmrg    REQUEST(xPanoramiXQueryVersionReq);
43435c4bbdfSmrg
43535c4bbdfSmrg    TRACE;
43635c4bbdfSmrg
43735c4bbdfSmrg    swaps(&stuff->length);
43835c4bbdfSmrg    REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
43935c4bbdfSmrg    return ProcPseudoramiXQueryVersion(client);
44035c4bbdfSmrg}
44135c4bbdfSmrg
44235c4bbdfSmrgstatic int
44335c4bbdfSmrgSProcPseudoramiXGetState(ClientPtr client)
44435c4bbdfSmrg{
44535c4bbdfSmrg    REQUEST(xPanoramiXGetStateReq);
44635c4bbdfSmrg
44735c4bbdfSmrg    TRACE;
44835c4bbdfSmrg
44935c4bbdfSmrg    swaps(&stuff->length);
45035c4bbdfSmrg    REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
45135c4bbdfSmrg    return ProcPseudoramiXGetState(client);
45235c4bbdfSmrg}
45335c4bbdfSmrg
45435c4bbdfSmrgstatic int
45535c4bbdfSmrgSProcPseudoramiXGetScreenCount(ClientPtr client)
45635c4bbdfSmrg{
45735c4bbdfSmrg    REQUEST(xPanoramiXGetScreenCountReq);
45835c4bbdfSmrg
45935c4bbdfSmrg    TRACE;
46035c4bbdfSmrg
46135c4bbdfSmrg    swaps(&stuff->length);
46235c4bbdfSmrg    REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
46335c4bbdfSmrg    return ProcPseudoramiXGetScreenCount(client);
46435c4bbdfSmrg}
46535c4bbdfSmrg
46635c4bbdfSmrgstatic int
46735c4bbdfSmrgSProcPseudoramiXGetScreenSize(ClientPtr client)
46835c4bbdfSmrg{
46935c4bbdfSmrg    REQUEST(xPanoramiXGetScreenSizeReq);
47035c4bbdfSmrg
47135c4bbdfSmrg    TRACE;
47235c4bbdfSmrg
47335c4bbdfSmrg    swaps(&stuff->length);
47435c4bbdfSmrg    REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
47535c4bbdfSmrg    return ProcPseudoramiXGetScreenSize(client);
47635c4bbdfSmrg}
47735c4bbdfSmrg
47835c4bbdfSmrgstatic int
47935c4bbdfSmrgSProcPseudoramiXIsActive(ClientPtr client)
48035c4bbdfSmrg{
48135c4bbdfSmrg    REQUEST(xXineramaIsActiveReq);
48235c4bbdfSmrg
48335c4bbdfSmrg    TRACE;
48435c4bbdfSmrg
48535c4bbdfSmrg    swaps(&stuff->length);
48635c4bbdfSmrg    REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
48735c4bbdfSmrg    return ProcPseudoramiXIsActive(client);
48835c4bbdfSmrg}
48935c4bbdfSmrg
49035c4bbdfSmrgstatic int
49135c4bbdfSmrgSProcPseudoramiXQueryScreens(ClientPtr client)
49235c4bbdfSmrg{
49335c4bbdfSmrg    REQUEST(xXineramaQueryScreensReq);
49435c4bbdfSmrg
49535c4bbdfSmrg    TRACE;
49635c4bbdfSmrg
49735c4bbdfSmrg    swaps(&stuff->length);
49835c4bbdfSmrg    REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
49935c4bbdfSmrg    return ProcPseudoramiXQueryScreens(client);
50035c4bbdfSmrg}
50135c4bbdfSmrg
50235c4bbdfSmrgstatic int
50335c4bbdfSmrgSProcPseudoramiXDispatch(ClientPtr client)
50435c4bbdfSmrg{
50535c4bbdfSmrg    REQUEST(xReq);
50635c4bbdfSmrg
50735c4bbdfSmrg    TRACE;
50835c4bbdfSmrg
50935c4bbdfSmrg    switch (stuff->data) {
51035c4bbdfSmrg    case X_PanoramiXQueryVersion:
51135c4bbdfSmrg        return SProcPseudoramiXQueryVersion(client);
51235c4bbdfSmrg
51335c4bbdfSmrg    case X_PanoramiXGetState:
51435c4bbdfSmrg        return SProcPseudoramiXGetState(client);
51535c4bbdfSmrg
51635c4bbdfSmrg    case X_PanoramiXGetScreenCount:
51735c4bbdfSmrg        return SProcPseudoramiXGetScreenCount(client);
51835c4bbdfSmrg
51935c4bbdfSmrg    case X_PanoramiXGetScreenSize:
52035c4bbdfSmrg        return SProcPseudoramiXGetScreenSize(client);
52135c4bbdfSmrg
52235c4bbdfSmrg    case X_XineramaIsActive:
52335c4bbdfSmrg        return SProcPseudoramiXIsActive(client);
52435c4bbdfSmrg
52535c4bbdfSmrg    case X_XineramaQueryScreens:
52635c4bbdfSmrg        return SProcPseudoramiXQueryScreens(client);
52735c4bbdfSmrg    }
52835c4bbdfSmrg    return BadRequest;
52935c4bbdfSmrg}
530