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
51SProcPanoramiXQueryVersion (ClientPtr client)
52{
53	REQUEST(xPanoramiXQueryVersionReq);
54	int n;
55
56	swaps(&stuff->length,n);
57	REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
58	return ProcPanoramiXQueryVersion(client);
59}
60
61static int
62SProcPanoramiXGetState(ClientPtr client)
63{
64	REQUEST(xPanoramiXGetStateReq);
65	int n;
66
67 	swaps (&stuff->length, n);
68	REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
69	swapl (&stuff->window, n);
70	return ProcPanoramiXGetState(client);
71}
72
73static int
74SProcPanoramiXGetScreenCount(ClientPtr client)
75{
76	REQUEST(xPanoramiXGetScreenCountReq);
77	int n;
78
79	swaps (&stuff->length, n);
80	REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
81	swapl (&stuff->window, n);
82	return ProcPanoramiXGetScreenCount(client);
83}
84
85static int
86SProcPanoramiXGetScreenSize(ClientPtr client)
87{
88	REQUEST(xPanoramiXGetScreenSizeReq);
89	int n;
90
91	swaps (&stuff->length, n);
92	REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
93	swapl (&stuff->window, n);
94	swapl (&stuff->screen, n);
95	return ProcPanoramiXGetScreenSize(client);
96}
97
98
99static int
100SProcXineramaIsActive(ClientPtr client)
101{
102	REQUEST(xXineramaIsActiveReq);
103	int n;
104
105	swaps (&stuff->length, n);
106	REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
107	return ProcXineramaIsActive(client);
108}
109
110
111static int
112SProcXineramaQueryScreens(ClientPtr client)
113{
114	REQUEST(xXineramaQueryScreensReq);
115	int n;
116
117	swaps (&stuff->length, n);
118	REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
119	return ProcXineramaQueryScreens(client);
120}
121
122
123int
124SProcPanoramiXDispatch (ClientPtr client)
125{   REQUEST(xReq);
126    switch (stuff->data)
127    {
128	case X_PanoramiXQueryVersion:
129	     return SProcPanoramiXQueryVersion(client);
130	case X_PanoramiXGetState:
131	     return SProcPanoramiXGetState(client);
132	case X_PanoramiXGetScreenCount:
133	     return SProcPanoramiXGetScreenCount(client);
134	case X_PanoramiXGetScreenSize:
135	     return SProcPanoramiXGetScreenSize(client);
136	case X_XineramaIsActive:
137	     return SProcXineramaIsActive(client);
138	case X_XineramaQueryScreens:
139	     return SProcXineramaQueryScreens(client);
140    }
141    return BadRequest;
142}
143