1/*****************************************************************
2Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
3Permission is hereby granted, free of charge, to any person obtaining a copy
4of this software and associated documentation files (the "Software"), to deal
5in the Software without restriction, including without limitation the rights
6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7copies of the Software.
8
9The above copyright notice and this permission notice shall be included in
10all copies or substantial portions of the Software.
11
12THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
15DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
16BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
18IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20Except as contained in this notice, the name of Digital Equipment Corporation
21shall not be used in advertising or otherwise to promote the sale, use or other
22dealings in this Software without prior written authorization from Digital
23Equipment Corporation.
24******************************************************************/
25
26#ifdef HAVE_DIX_CONFIG_H
27#include <dix-config.h>
28#endif
29
30#include <stdio.h>
31#include <X11/X.h>
32#include <X11/Xproto.h>
33#include "misc.h"
34#include "cursor.h"
35#include "cursorstr.h"
36#include "extnsionst.h"
37#include "dixstruct.h"
38#include "gc.h"
39#include "gcstruct.h"
40#include "scrnintstr.h"
41#include "window.h"
42#include "windowstr.h"
43#include "pixmapstr.h"
44#include "panoramiX.h"
45#include <X11/extensions/panoramiXproto.h>
46#include "panoramiXsrv.h"
47#include "globals.h"
48#include "panoramiXh.h"
49
50static int _X_COLD
51SProcPanoramiXQueryVersion(ClientPtr client)
52{
53    REQUEST(xPanoramiXQueryVersionReq);
54
55    swaps(&stuff->length);
56    REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
57    return ProcPanoramiXQueryVersion(client);
58}
59
60static int _X_COLD
61SProcPanoramiXGetState(ClientPtr client)
62{
63    REQUEST(xPanoramiXGetStateReq);
64
65    swaps(&stuff->length);
66    REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
67    swapl(&stuff->window);
68    return ProcPanoramiXGetState(client);
69}
70
71static int _X_COLD
72SProcPanoramiXGetScreenCount(ClientPtr client)
73{
74    REQUEST(xPanoramiXGetScreenCountReq);
75
76    swaps(&stuff->length);
77    REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
78    swapl(&stuff->window);
79    return ProcPanoramiXGetScreenCount(client);
80}
81
82static int _X_COLD
83SProcPanoramiXGetScreenSize(ClientPtr client)
84{
85    REQUEST(xPanoramiXGetScreenSizeReq);
86
87    swaps(&stuff->length);
88    REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
89    swapl(&stuff->window);
90    swapl(&stuff->screen);
91    return ProcPanoramiXGetScreenSize(client);
92}
93
94static int _X_COLD
95SProcXineramaIsActive(ClientPtr client)
96{
97    REQUEST(xXineramaIsActiveReq);
98
99    swaps(&stuff->length);
100    REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
101    return ProcXineramaIsActive(client);
102}
103
104static int _X_COLD
105SProcXineramaQueryScreens(ClientPtr client)
106{
107    REQUEST(xXineramaQueryScreensReq);
108
109    swaps(&stuff->length);
110    REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
111    return ProcXineramaQueryScreens(client);
112}
113
114int _X_COLD
115SProcPanoramiXDispatch(ClientPtr client)
116{
117    REQUEST(xReq);
118    switch (stuff->data) {
119    case X_PanoramiXQueryVersion:
120        return SProcPanoramiXQueryVersion(client);
121    case X_PanoramiXGetState:
122        return SProcPanoramiXGetState(client);
123    case X_PanoramiXGetScreenCount:
124        return SProcPanoramiXGetScreenCount(client);
125    case X_PanoramiXGetScreenSize:
126        return SProcPanoramiXGetScreenSize(client);
127    case X_XineramaIsActive:
128        return SProcXineramaIsActive(client);
129    case X_XineramaQueryScreens:
130        return SProcXineramaQueryScreens(client);
131    }
132    return BadRequest;
133}
134