1706f2543Smrg/************************************************************
2706f2543Smrg
3706f2543SmrgCopyright 1987, 1998  The Open Group
4706f2543Smrg
5706f2543SmrgPermission to use, copy, modify, distribute, and sell this software and its
6706f2543Smrgdocumentation for any purpose is hereby granted without fee, provided that
7706f2543Smrgthe above copyright notice appear in all copies and that both that
8706f2543Smrgcopyright notice and this permission notice appear in supporting
9706f2543Smrgdocumentation.
10706f2543Smrg
11706f2543SmrgThe above copyright notice and this permission notice shall be included in
12706f2543Smrgall copies or substantial portions of the Software.
13706f2543Smrg
14706f2543SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15706f2543SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16706f2543SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17706f2543SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18706f2543SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19706f2543SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20706f2543Smrg
21706f2543SmrgExcept as contained in this notice, the name of The Open Group shall not be
22706f2543Smrgused in advertising or otherwise to promote the sale, use or other dealings
23706f2543Smrgin this Software without prior written authorization from The Open Group.
24706f2543Smrg
25706f2543Smrg
26706f2543SmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27706f2543Smrg
28706f2543Smrg                        All Rights Reserved
29706f2543Smrg
30706f2543SmrgPermission to use, copy, modify, and distribute this software and its
31706f2543Smrgdocumentation for any purpose and without fee is hereby granted,
32706f2543Smrgprovided that the above copyright notice appear in all copies and that
33706f2543Smrgboth that copyright notice and this permission notice appear in
34706f2543Smrgsupporting documentation, and that the name of Digital not be
35706f2543Smrgused in advertising or publicity pertaining to distribution of the
36706f2543Smrgsoftware without specific, written prior permission.
37706f2543Smrg
38706f2543SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39706f2543SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40706f2543SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41706f2543SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42706f2543SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43706f2543SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44706f2543SmrgSOFTWARE.
45706f2543Smrg
46706f2543Smrg********************************************************/
47706f2543Smrg
48706f2543Smrg
49706f2543Smrg#ifdef HAVE_DIX_CONFIG_H
50706f2543Smrg#include <dix-config.h>
51706f2543Smrg#endif
52706f2543Smrg
53706f2543Smrg#include <X11/X.h>
54706f2543Smrg#include <X11/Xproto.h>
55706f2543Smrg#include <X11/Xprotostr.h>
56706f2543Smrg#include "misc.h"
57706f2543Smrg#include "dixstruct.h"
58706f2543Smrg#include "extnsionst.h"	/* for SendEvent */
59706f2543Smrg#include "swapreq.h"
60706f2543Smrg
61706f2543Smrg/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
62706f2543Smrg
63706f2543Smrg/* Byte swap a list of longs */
64706f2543Smrgvoid
65706f2543SmrgSwapLongs (CARD32 *list, unsigned long count)
66706f2543Smrg{
67706f2543Smrg	char n;
68706f2543Smrg
69706f2543Smrg	while (count >= 8) {
70706f2543Smrg	    swapl(list+0, n);
71706f2543Smrg	    swapl(list+1, n);
72706f2543Smrg	    swapl(list+2, n);
73706f2543Smrg	    swapl(list+3, n);
74706f2543Smrg	    swapl(list+4, n);
75706f2543Smrg	    swapl(list+5, n);
76706f2543Smrg	    swapl(list+6, n);
77706f2543Smrg	    swapl(list+7, n);
78706f2543Smrg	    list += 8;
79706f2543Smrg	    count -= 8;
80706f2543Smrg	}
81706f2543Smrg	if (count != 0) {
82706f2543Smrg	    do {
83706f2543Smrg		swapl(list, n);
84706f2543Smrg		list++;
85706f2543Smrg	    } while (--count != 0);
86706f2543Smrg	}
87706f2543Smrg}
88706f2543Smrg
89706f2543Smrg/* Byte swap a list of shorts */
90706f2543Smrgvoid
91706f2543SmrgSwapShorts (short *list, unsigned long count)
92706f2543Smrg{
93706f2543Smrg	char n;
94706f2543Smrg
95706f2543Smrg	while (count >= 16) {
96706f2543Smrg	    swaps(list+0, n);
97706f2543Smrg	    swaps(list+1, n);
98706f2543Smrg	    swaps(list+2, n);
99706f2543Smrg	    swaps(list+3, n);
100706f2543Smrg	    swaps(list+4, n);
101706f2543Smrg	    swaps(list+5, n);
102706f2543Smrg	    swaps(list+6, n);
103706f2543Smrg	    swaps(list+7, n);
104706f2543Smrg	    swaps(list+8, n);
105706f2543Smrg	    swaps(list+9, n);
106706f2543Smrg	    swaps(list+10, n);
107706f2543Smrg	    swaps(list+11, n);
108706f2543Smrg	    swaps(list+12, n);
109706f2543Smrg	    swaps(list+13, n);
110706f2543Smrg	    swaps(list+14, n);
111706f2543Smrg	    swaps(list+15, n);
112706f2543Smrg	    list += 16;
113706f2543Smrg	    count -= 16;
114706f2543Smrg	}
115706f2543Smrg	if (count != 0) {
116706f2543Smrg	    do {
117706f2543Smrg		swaps(list, n);
118706f2543Smrg		list++;
119706f2543Smrg	    } while (--count != 0);
120706f2543Smrg	}
121706f2543Smrg}
122706f2543Smrg
123706f2543Smrg/* The following is used for all requests that have
124706f2543Smrg   no fields to be swapped (except "length") */
125706f2543Smrgint
126706f2543SmrgSProcSimpleReq(ClientPtr client)
127706f2543Smrg{
128706f2543Smrg    char n;
129706f2543Smrg
130706f2543Smrg    REQUEST(xReq);
131706f2543Smrg    swaps(&stuff->length, n);
132706f2543Smrg    return(*ProcVector[stuff->reqType])(client);
133706f2543Smrg}
134706f2543Smrg
135706f2543Smrg/* The following is used for all requests that have
136706f2543Smrg   only a single 32-bit field to be swapped, coming
137706f2543Smrg   right after the "length" field */
138706f2543Smrgint
139706f2543SmrgSProcResourceReq(ClientPtr client)
140706f2543Smrg{
141706f2543Smrg    char n;
142706f2543Smrg
143706f2543Smrg    REQUEST(xResourceReq);
144706f2543Smrg    swaps(&stuff->length, n);
145706f2543Smrg    REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */
146706f2543Smrg    swapl(&stuff->id, n);
147706f2543Smrg    return(*ProcVector[stuff->reqType])(client);
148706f2543Smrg}
149706f2543Smrg
150706f2543Smrgint
151706f2543SmrgSProcCreateWindow(ClientPtr client)
152706f2543Smrg{
153706f2543Smrg    char n;
154706f2543Smrg
155706f2543Smrg    REQUEST(xCreateWindowReq);
156706f2543Smrg    swaps(&stuff->length, n);
157706f2543Smrg    REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
158706f2543Smrg    swapl(&stuff->wid, n);
159706f2543Smrg    swapl(&stuff->parent, n);
160706f2543Smrg    swaps(&stuff->x, n);
161706f2543Smrg    swaps(&stuff->y, n);
162706f2543Smrg    swaps(&stuff->width, n);
163706f2543Smrg    swaps(&stuff->height, n);
164706f2543Smrg    swaps(&stuff->borderWidth, n);
165706f2543Smrg    swaps(&stuff->class, n);
166706f2543Smrg    swapl(&stuff->visual, n);
167706f2543Smrg    swapl(&stuff->mask, n);
168706f2543Smrg    SwapRestL(stuff);
169706f2543Smrg    return((* ProcVector[X_CreateWindow])(client));
170706f2543Smrg}
171706f2543Smrg
172706f2543Smrgint
173706f2543SmrgSProcChangeWindowAttributes(ClientPtr client)
174706f2543Smrg{
175706f2543Smrg    char n;
176706f2543Smrg
177706f2543Smrg    REQUEST(xChangeWindowAttributesReq);
178706f2543Smrg    swaps(&stuff->length, n);
179706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
180706f2543Smrg    swapl(&stuff->window, n);
181706f2543Smrg    swapl(&stuff->valueMask, n);
182706f2543Smrg    SwapRestL(stuff);
183706f2543Smrg    return((* ProcVector[X_ChangeWindowAttributes])(client));
184706f2543Smrg}
185706f2543Smrg
186706f2543Smrgint
187706f2543SmrgSProcReparentWindow(ClientPtr client)
188706f2543Smrg{
189706f2543Smrg    char n;
190706f2543Smrg    REQUEST(xReparentWindowReq);
191706f2543Smrg    swaps(&stuff->length, n);
192706f2543Smrg    REQUEST_SIZE_MATCH(xReparentWindowReq);
193706f2543Smrg    swapl(&stuff->window, n);
194706f2543Smrg    swapl(&stuff->parent, n);
195706f2543Smrg    swaps(&stuff->x, n);
196706f2543Smrg    swaps(&stuff->y, n);
197706f2543Smrg    return((* ProcVector[X_ReparentWindow])(client));
198706f2543Smrg}
199706f2543Smrg
200706f2543Smrgint
201706f2543SmrgSProcConfigureWindow(ClientPtr client)
202706f2543Smrg{
203706f2543Smrg    char n;
204706f2543Smrg    REQUEST(xConfigureWindowReq);
205706f2543Smrg    swaps(&stuff->length, n);
206706f2543Smrg    REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
207706f2543Smrg    swapl(&stuff->window, n);
208706f2543Smrg    swaps(&stuff->mask, n);
209706f2543Smrg    SwapRestL(stuff);
210706f2543Smrg    return((* ProcVector[X_ConfigureWindow])(client));
211706f2543Smrg
212706f2543Smrg}
213706f2543Smrg
214706f2543Smrg
215706f2543Smrgint
216706f2543SmrgSProcInternAtom(ClientPtr client)
217706f2543Smrg{
218706f2543Smrg    char n;
219706f2543Smrg    REQUEST(xInternAtomReq);
220706f2543Smrg    swaps(&stuff->length, n);
221706f2543Smrg    REQUEST_AT_LEAST_SIZE(xInternAtomReq);
222706f2543Smrg    swaps(&stuff->nbytes, n);
223706f2543Smrg    return((* ProcVector[X_InternAtom])(client));
224706f2543Smrg}
225706f2543Smrg
226706f2543Smrgint
227706f2543SmrgSProcChangeProperty(ClientPtr client)
228706f2543Smrg{
229706f2543Smrg    char n;
230706f2543Smrg    REQUEST(xChangePropertyReq);
231706f2543Smrg    swaps(&stuff->length, n);
232706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
233706f2543Smrg    swapl(&stuff->window, n);
234706f2543Smrg    swapl(&stuff->property, n);
235706f2543Smrg    swapl(&stuff->type, n);
236706f2543Smrg    swapl(&stuff->nUnits, n);
237706f2543Smrg    switch ( stuff->format ) {
238706f2543Smrg        case 8 :
239706f2543Smrg	    break;
240706f2543Smrg        case 16:
241706f2543Smrg	    SwapRestS(stuff);
242706f2543Smrg	    break;
243706f2543Smrg	case 32:
244706f2543Smrg	    SwapRestL(stuff);
245706f2543Smrg	    break;
246706f2543Smrg	}
247706f2543Smrg    return((* ProcVector[X_ChangeProperty])(client));
248706f2543Smrg}
249706f2543Smrg
250706f2543Smrgint
251706f2543SmrgSProcDeleteProperty(ClientPtr client)
252706f2543Smrg{
253706f2543Smrg    char n;
254706f2543Smrg    REQUEST(xDeletePropertyReq);
255706f2543Smrg    swaps(&stuff->length, n);
256706f2543Smrg    REQUEST_SIZE_MATCH(xDeletePropertyReq);
257706f2543Smrg    swapl(&stuff->window, n);
258706f2543Smrg    swapl(&stuff->property, n);
259706f2543Smrg    return((* ProcVector[X_DeleteProperty])(client));
260706f2543Smrg
261706f2543Smrg}
262706f2543Smrg
263706f2543Smrgint
264706f2543SmrgSProcGetProperty(ClientPtr client)
265706f2543Smrg{
266706f2543Smrg    char n;
267706f2543Smrg    REQUEST(xGetPropertyReq);
268706f2543Smrg    swaps(&stuff->length, n);
269706f2543Smrg    REQUEST_SIZE_MATCH(xGetPropertyReq);
270706f2543Smrg    swapl(&stuff->window, n);
271706f2543Smrg    swapl(&stuff->property, n);
272706f2543Smrg    swapl(&stuff->type, n);
273706f2543Smrg    swapl(&stuff->longOffset, n);
274706f2543Smrg    swapl(&stuff->longLength, n);
275706f2543Smrg    return((* ProcVector[X_GetProperty])(client));
276706f2543Smrg}
277706f2543Smrg
278706f2543Smrgint
279706f2543SmrgSProcSetSelectionOwner(ClientPtr client)
280706f2543Smrg{
281706f2543Smrg    char n;
282706f2543Smrg    REQUEST(xSetSelectionOwnerReq);
283706f2543Smrg    swaps(&stuff->length, n);
284706f2543Smrg    REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
285706f2543Smrg    swapl(&stuff->window, n);
286706f2543Smrg    swapl(&stuff->selection, n);
287706f2543Smrg    swapl(&stuff->time, n);
288706f2543Smrg    return((* ProcVector[X_SetSelectionOwner])(client));
289706f2543Smrg}
290706f2543Smrg
291706f2543Smrgint
292706f2543SmrgSProcConvertSelection(ClientPtr client)
293706f2543Smrg{
294706f2543Smrg    char n;
295706f2543Smrg    REQUEST(xConvertSelectionReq);
296706f2543Smrg    swaps(&stuff->length, n);
297706f2543Smrg    REQUEST_SIZE_MATCH(xConvertSelectionReq);
298706f2543Smrg    swapl(&stuff->requestor, n);
299706f2543Smrg    swapl(&stuff->selection, n);
300706f2543Smrg    swapl(&stuff->target, n);
301706f2543Smrg    swapl(&stuff->property, n);
302706f2543Smrg    swapl(&stuff->time, n);
303706f2543Smrg    return((* ProcVector[X_ConvertSelection])(client));
304706f2543Smrg}
305706f2543Smrg
306706f2543Smrgint
307706f2543SmrgSProcSendEvent(ClientPtr client)
308706f2543Smrg{
309706f2543Smrg    char n;
310706f2543Smrg    xEvent eventT;
311706f2543Smrg    EventSwapPtr proc;
312706f2543Smrg    REQUEST(xSendEventReq);
313706f2543Smrg    swaps(&stuff->length, n);
314706f2543Smrg    REQUEST_SIZE_MATCH(xSendEventReq);
315706f2543Smrg    swapl(&stuff->destination, n);
316706f2543Smrg    swapl(&stuff->eventMask, n);
317706f2543Smrg
3181cc18b8aSmrg    /* Generic events can have variable size, but SendEvent request holds
3191cc18b8aSmrg       exactly 32B of event data. */
3201cc18b8aSmrg    if (stuff->event.u.u.type == GenericEvent) {
3211cc18b8aSmrg        client->errorValue = stuff->event.u.u.type;
3221cc18b8aSmrg        return BadValue;
3231cc18b8aSmrg    }
3241cc18b8aSmrg
325706f2543Smrg    /* Swap event */
326706f2543Smrg    proc = EventSwapVector[stuff->event.u.u.type & 0177];
327706f2543Smrg    if (!proc ||  proc == NotImplemented)    /* no swapping proc; invalid event type? */
328706f2543Smrg       return BadValue;
329706f2543Smrg    (*proc)(&stuff->event, &eventT);
330706f2543Smrg    stuff->event = eventT;
331706f2543Smrg
332706f2543Smrg    return((* ProcVector[X_SendEvent])(client));
333706f2543Smrg}
334706f2543Smrg
335706f2543Smrgint
336706f2543SmrgSProcGrabPointer(ClientPtr client)
337706f2543Smrg{
338706f2543Smrg    char n;
339706f2543Smrg    REQUEST(xGrabPointerReq);
340706f2543Smrg    swaps(&stuff->length, n);
341706f2543Smrg    REQUEST_SIZE_MATCH(xGrabPointerReq);
342706f2543Smrg    swapl(&stuff->grabWindow, n);
343706f2543Smrg    swaps(&stuff->eventMask, n);
344706f2543Smrg    swapl(&stuff->confineTo, n);
345706f2543Smrg    swapl(&stuff->cursor, n);
346706f2543Smrg    swapl(&stuff->time, n);
347706f2543Smrg    return((* ProcVector[X_GrabPointer])(client));
348706f2543Smrg}
349706f2543Smrg
350706f2543Smrgint
351706f2543SmrgSProcGrabButton(ClientPtr client)
352706f2543Smrg{
353706f2543Smrg    char n;
354706f2543Smrg    REQUEST(xGrabButtonReq);
355706f2543Smrg    swaps(&stuff->length, n);
356706f2543Smrg    REQUEST_SIZE_MATCH(xGrabButtonReq);
357706f2543Smrg    swapl(&stuff->grabWindow, n);
358706f2543Smrg    swaps(&stuff->eventMask, n);
359706f2543Smrg    swapl(&stuff->confineTo, n);
360706f2543Smrg    swapl(&stuff->cursor, n);
361706f2543Smrg    swaps(&stuff->modifiers, n);
362706f2543Smrg    return((* ProcVector[X_GrabButton])(client));
363706f2543Smrg}
364706f2543Smrg
365706f2543Smrgint
366706f2543SmrgSProcUngrabButton(ClientPtr client)
367706f2543Smrg{
368706f2543Smrg    char n;
369706f2543Smrg    REQUEST(xUngrabButtonReq);
370706f2543Smrg    swaps(&stuff->length, n);
371706f2543Smrg    REQUEST_SIZE_MATCH(xUngrabButtonReq);
372706f2543Smrg    swapl(&stuff->grabWindow, n);
373706f2543Smrg    swaps(&stuff->modifiers, n);
374706f2543Smrg    return((* ProcVector[X_UngrabButton])(client));
375706f2543Smrg}
376706f2543Smrg
377706f2543Smrgint
378706f2543SmrgSProcChangeActivePointerGrab(ClientPtr client)
379706f2543Smrg{
380706f2543Smrg    char n;
381706f2543Smrg    REQUEST(xChangeActivePointerGrabReq);
382706f2543Smrg    swaps(&stuff->length, n);
383706f2543Smrg    REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
384706f2543Smrg    swapl(&stuff->cursor, n);
385706f2543Smrg    swapl(&stuff->time, n);
386706f2543Smrg    swaps(&stuff->eventMask, n);
387706f2543Smrg    return((* ProcVector[X_ChangeActivePointerGrab])(client));
388706f2543Smrg}
389706f2543Smrg
390706f2543Smrgint
391706f2543SmrgSProcGrabKeyboard(ClientPtr client)
392706f2543Smrg{
393706f2543Smrg    char n;
394706f2543Smrg    REQUEST(xGrabKeyboardReq);
395706f2543Smrg    swaps(&stuff->length, n);
396706f2543Smrg    REQUEST_SIZE_MATCH(xGrabKeyboardReq);
397706f2543Smrg    swapl(&stuff->grabWindow, n);
398706f2543Smrg    swapl(&stuff->time, n);
399706f2543Smrg    return((* ProcVector[X_GrabKeyboard])(client));
400706f2543Smrg}
401706f2543Smrg
402706f2543Smrgint
403706f2543SmrgSProcGrabKey(ClientPtr client)
404706f2543Smrg{
405706f2543Smrg    char n;
406706f2543Smrg    REQUEST(xGrabKeyReq);
407706f2543Smrg    swaps(&stuff->length, n);
408706f2543Smrg    REQUEST_SIZE_MATCH(xGrabKeyReq);
409706f2543Smrg    swapl(&stuff->grabWindow, n);
410706f2543Smrg    swaps(&stuff->modifiers, n);
411706f2543Smrg    return((* ProcVector[X_GrabKey])(client));
412706f2543Smrg}
413706f2543Smrg
414706f2543Smrgint
415706f2543SmrgSProcUngrabKey(ClientPtr client)
416706f2543Smrg{
417706f2543Smrg    char n;
418706f2543Smrg    REQUEST(xUngrabKeyReq);
419706f2543Smrg    swaps(&stuff->length, n);
420706f2543Smrg    REQUEST_SIZE_MATCH(xUngrabKeyReq);
421706f2543Smrg    swapl(&stuff->grabWindow, n);
422706f2543Smrg    swaps(&stuff->modifiers, n);
423706f2543Smrg    return((* ProcVector[X_UngrabKey])(client));
424706f2543Smrg}
425706f2543Smrg
426706f2543Smrgint
427706f2543SmrgSProcGetMotionEvents(ClientPtr client)
428706f2543Smrg{
429706f2543Smrg    char n;
430706f2543Smrg    REQUEST(xGetMotionEventsReq);
431706f2543Smrg    swaps(&stuff->length, n);
432706f2543Smrg    REQUEST_SIZE_MATCH(xGetMotionEventsReq);
433706f2543Smrg    swapl(&stuff->window, n);
434706f2543Smrg    swapl(&stuff->start, n);
435706f2543Smrg    swapl(&stuff->stop, n);
436706f2543Smrg    return((* ProcVector[X_GetMotionEvents])(client));
437706f2543Smrg}
438706f2543Smrg
439706f2543Smrgint
440706f2543SmrgSProcTranslateCoords(ClientPtr client)
441706f2543Smrg{
442706f2543Smrg    char n;
443706f2543Smrg    REQUEST(xTranslateCoordsReq);
444706f2543Smrg    swaps(&stuff->length, n);
445706f2543Smrg    REQUEST_SIZE_MATCH(xTranslateCoordsReq);
446706f2543Smrg    swapl(&stuff->srcWid, n);
447706f2543Smrg    swapl(&stuff->dstWid, n);
448706f2543Smrg    swaps(&stuff->srcX, n);
449706f2543Smrg    swaps(&stuff->srcY, n);
450706f2543Smrg    return((* ProcVector[X_TranslateCoords])(client));
451706f2543Smrg}
452706f2543Smrg
453706f2543Smrgint
454706f2543SmrgSProcWarpPointer(ClientPtr client)
455706f2543Smrg{
456706f2543Smrg    char n;
457706f2543Smrg    REQUEST(xWarpPointerReq);
458706f2543Smrg    swaps(&stuff->length, n);
459706f2543Smrg    REQUEST_SIZE_MATCH(xWarpPointerReq);
460706f2543Smrg    swapl(&stuff->srcWid, n);
461706f2543Smrg    swapl(&stuff->dstWid, n);
462706f2543Smrg    swaps(&stuff->srcX, n);
463706f2543Smrg    swaps(&stuff->srcY, n);
464706f2543Smrg    swaps(&stuff->srcWidth, n);
465706f2543Smrg    swaps(&stuff->srcHeight, n);
466706f2543Smrg    swaps(&stuff->dstX, n);
467706f2543Smrg    swaps(&stuff->dstY, n);
468706f2543Smrg    return((* ProcVector[X_WarpPointer])(client));
469706f2543Smrg}
470706f2543Smrg
471706f2543Smrgint
472706f2543SmrgSProcSetInputFocus(ClientPtr client)
473706f2543Smrg{
474706f2543Smrg    char n;
475706f2543Smrg    REQUEST(xSetInputFocusReq);
476706f2543Smrg    swaps(&stuff->length, n);
477706f2543Smrg    REQUEST_SIZE_MATCH(xSetInputFocusReq);
478706f2543Smrg    swapl(&stuff->focus, n);
479706f2543Smrg    swapl(&stuff->time, n);
480706f2543Smrg    return((* ProcVector[X_SetInputFocus])(client));
481706f2543Smrg}
482706f2543Smrg
483706f2543Smrgint
484706f2543SmrgSProcOpenFont(ClientPtr client)
485706f2543Smrg{
486706f2543Smrg    char n;
487706f2543Smrg    REQUEST(xOpenFontReq);
488706f2543Smrg    swaps(&stuff->length, n);
489706f2543Smrg    REQUEST_AT_LEAST_SIZE(xOpenFontReq);
490706f2543Smrg    swapl(&stuff->fid, n);
491706f2543Smrg    swaps(&stuff->nbytes, n);
492706f2543Smrg    return((* ProcVector[X_OpenFont])(client));
493706f2543Smrg}
494706f2543Smrg
495706f2543Smrgint
496706f2543SmrgSProcListFonts(ClientPtr client)
497706f2543Smrg{
498706f2543Smrg    char n;
499706f2543Smrg    REQUEST(xListFontsReq);
500706f2543Smrg    swaps(&stuff->length, n);
501706f2543Smrg    REQUEST_AT_LEAST_SIZE(xListFontsReq);
502706f2543Smrg    swaps(&stuff->maxNames, n);
503706f2543Smrg    swaps(&stuff->nbytes, n);
504706f2543Smrg    return((* ProcVector[X_ListFonts])(client));
505706f2543Smrg}
506706f2543Smrg
507706f2543Smrgint
508706f2543SmrgSProcListFontsWithInfo(ClientPtr client)
509706f2543Smrg{
510706f2543Smrg    char n;
511706f2543Smrg    REQUEST(xListFontsWithInfoReq);
512706f2543Smrg    swaps(&stuff->length, n);
513706f2543Smrg    REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq);
514706f2543Smrg    swaps(&stuff->maxNames, n);
515706f2543Smrg    swaps(&stuff->nbytes, n);
516706f2543Smrg    return((* ProcVector[X_ListFontsWithInfo])(client));
517706f2543Smrg}
518706f2543Smrg
519706f2543Smrgint
520706f2543SmrgSProcSetFontPath(ClientPtr client)
521706f2543Smrg{
522706f2543Smrg    char n;
523706f2543Smrg    REQUEST(xSetFontPathReq);
524706f2543Smrg    swaps(&stuff->length, n);
525706f2543Smrg    REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
526706f2543Smrg    swaps(&stuff->nFonts, n);
527706f2543Smrg    return((* ProcVector[X_SetFontPath])(client));
528706f2543Smrg}
529706f2543Smrg
530706f2543Smrgint
531706f2543SmrgSProcCreatePixmap(ClientPtr client)
532706f2543Smrg{
533706f2543Smrg    char n;
534706f2543Smrg    REQUEST(xCreatePixmapReq);
535706f2543Smrg
536706f2543Smrg    swaps(&stuff->length, n);
537706f2543Smrg    REQUEST_SIZE_MATCH(xCreatePixmapReq);
538706f2543Smrg    swapl(&stuff->pid, n);
539706f2543Smrg    swapl(&stuff->drawable, n);
540706f2543Smrg    swaps(&stuff->width, n);
541706f2543Smrg    swaps(&stuff->height, n);
542706f2543Smrg    return((* ProcVector[X_CreatePixmap])(client));
543706f2543Smrg}
544706f2543Smrg
545706f2543Smrgint
546706f2543SmrgSProcCreateGC(ClientPtr client)
547706f2543Smrg{
548706f2543Smrg    char n;
549706f2543Smrg    REQUEST(xCreateGCReq);
550706f2543Smrg    swaps(&stuff->length, n);
551706f2543Smrg    REQUEST_AT_LEAST_SIZE(xCreateGCReq);
552706f2543Smrg    swapl(&stuff->gc, n);
553706f2543Smrg    swapl(&stuff->drawable, n);
554706f2543Smrg    swapl(&stuff->mask, n);
555706f2543Smrg    SwapRestL(stuff);
556706f2543Smrg    return((* ProcVector[X_CreateGC])(client));
557706f2543Smrg}
558706f2543Smrg
559706f2543Smrgint
560706f2543SmrgSProcChangeGC(ClientPtr client)
561706f2543Smrg{
562706f2543Smrg    char n;
563706f2543Smrg    REQUEST(xChangeGCReq);
564706f2543Smrg    swaps(&stuff->length, n);
565706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeGCReq);
566706f2543Smrg    swapl(&stuff->gc, n);
567706f2543Smrg    swapl(&stuff->mask, n);
568706f2543Smrg    SwapRestL(stuff);
569706f2543Smrg    return((* ProcVector[X_ChangeGC])(client));
570706f2543Smrg}
571706f2543Smrg
572706f2543Smrgint
573706f2543SmrgSProcCopyGC(ClientPtr client)
574706f2543Smrg{
575706f2543Smrg    char n;
576706f2543Smrg    REQUEST(xCopyGCReq);
577706f2543Smrg    swaps(&stuff->length, n);
578706f2543Smrg    REQUEST_SIZE_MATCH(xCopyGCReq);
579706f2543Smrg    swapl(&stuff->srcGC, n);
580706f2543Smrg    swapl(&stuff->dstGC, n);
581706f2543Smrg    swapl(&stuff->mask, n);
582706f2543Smrg    return((* ProcVector[X_CopyGC])(client));
583706f2543Smrg}
584706f2543Smrg
585706f2543Smrgint
586706f2543SmrgSProcSetDashes(ClientPtr client)
587706f2543Smrg{
588706f2543Smrg    char n;
589706f2543Smrg    REQUEST(xSetDashesReq);
590706f2543Smrg    swaps(&stuff->length, n);
591706f2543Smrg    REQUEST_AT_LEAST_SIZE(xSetDashesReq);
592706f2543Smrg    swapl(&stuff->gc, n);
593706f2543Smrg    swaps(&stuff->dashOffset, n);
594706f2543Smrg    swaps(&stuff->nDashes, n);
595706f2543Smrg    return((* ProcVector[X_SetDashes])(client));
596706f2543Smrg
597706f2543Smrg}
598706f2543Smrg
599706f2543Smrgint
600706f2543SmrgSProcSetClipRectangles(ClientPtr client)
601706f2543Smrg{
602706f2543Smrg    char n;
603706f2543Smrg    REQUEST(xSetClipRectanglesReq);
604706f2543Smrg    swaps(&stuff->length, n);
605706f2543Smrg    REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
606706f2543Smrg    swapl(&stuff->gc, n);
607706f2543Smrg    swaps(&stuff->xOrigin, n);
608706f2543Smrg    swaps(&stuff->yOrigin, n);
609706f2543Smrg    SwapRestS(stuff);
610706f2543Smrg    return((* ProcVector[X_SetClipRectangles])(client));
611706f2543Smrg}
612706f2543Smrg
613706f2543Smrgint
614706f2543SmrgSProcClearToBackground(ClientPtr client)
615706f2543Smrg{
616706f2543Smrg    char n;
617706f2543Smrg    REQUEST(xClearAreaReq);
618706f2543Smrg    swaps(&stuff->length, n);
619706f2543Smrg    REQUEST_SIZE_MATCH(xClearAreaReq);
620706f2543Smrg    swapl(&stuff->window, n);
621706f2543Smrg    swaps(&stuff->x, n);
622706f2543Smrg    swaps(&stuff->y, n);
623706f2543Smrg    swaps(&stuff->width, n);
624706f2543Smrg    swaps(&stuff->height, n);
625706f2543Smrg    return((* ProcVector[X_ClearArea])(client));
626706f2543Smrg}
627706f2543Smrg
628706f2543Smrgint
629706f2543SmrgSProcCopyArea(ClientPtr client)
630706f2543Smrg{
631706f2543Smrg    char n;
632706f2543Smrg    REQUEST(xCopyAreaReq);
633706f2543Smrg    swaps(&stuff->length, n);
634706f2543Smrg    REQUEST_SIZE_MATCH(xCopyAreaReq);
635706f2543Smrg    swapl(&stuff->srcDrawable, n);
636706f2543Smrg    swapl(&stuff->dstDrawable, n);
637706f2543Smrg    swapl(&stuff->gc, n);
638706f2543Smrg    swaps(&stuff->srcX, n);
639706f2543Smrg    swaps(&stuff->srcY, n);
640706f2543Smrg    swaps(&stuff->dstX, n);
641706f2543Smrg    swaps(&stuff->dstY, n);
642706f2543Smrg    swaps(&stuff->width, n);
643706f2543Smrg    swaps(&stuff->height, n);
644706f2543Smrg    return((* ProcVector[X_CopyArea])(client));
645706f2543Smrg}
646706f2543Smrg
647706f2543Smrgint
648706f2543SmrgSProcCopyPlane(ClientPtr client)
649706f2543Smrg{
650706f2543Smrg    char n;
651706f2543Smrg    REQUEST(xCopyPlaneReq);
652706f2543Smrg    swaps(&stuff->length, n);
653706f2543Smrg    REQUEST_SIZE_MATCH(xCopyPlaneReq);
654706f2543Smrg    swapl(&stuff->srcDrawable, n);
655706f2543Smrg    swapl(&stuff->dstDrawable, n);
656706f2543Smrg    swapl(&stuff->gc, n);
657706f2543Smrg    swaps(&stuff->srcX, n);
658706f2543Smrg    swaps(&stuff->srcY, n);
659706f2543Smrg    swaps(&stuff->dstX, n);
660706f2543Smrg    swaps(&stuff->dstY, n);
661706f2543Smrg    swaps(&stuff->width, n);
662706f2543Smrg    swaps(&stuff->height, n);
663706f2543Smrg    swapl(&stuff->bitPlane, n);
664706f2543Smrg    return((* ProcVector[X_CopyPlane])(client));
665706f2543Smrg}
666706f2543Smrg
667706f2543Smrg/* The following routine is used for all Poly drawing requests
668706f2543Smrg   (except FillPoly, which uses a different request format) */
669706f2543Smrgint
670706f2543SmrgSProcPoly(ClientPtr client)
671706f2543Smrg{
672706f2543Smrg    char n;
673706f2543Smrg
674706f2543Smrg    REQUEST(xPolyPointReq);
675706f2543Smrg    swaps(&stuff->length, n);
676706f2543Smrg    REQUEST_AT_LEAST_SIZE(xPolyPointReq);
677706f2543Smrg    swapl(&stuff->drawable, n);
678706f2543Smrg    swapl(&stuff->gc, n);
679706f2543Smrg    SwapRestS(stuff);
680706f2543Smrg    return((* ProcVector[stuff->reqType])(client));
681706f2543Smrg}
682706f2543Smrg
683706f2543Smrg/* cannot use SProcPoly for this one, because xFillPolyReq
684706f2543Smrg   is longer than xPolyPointReq, and we don't want to swap
685706f2543Smrg   the difference as shorts! */
686706f2543Smrgint
687706f2543SmrgSProcFillPoly(ClientPtr client)
688706f2543Smrg{
689706f2543Smrg    char n;
690706f2543Smrg
691706f2543Smrg    REQUEST(xFillPolyReq);
692706f2543Smrg    swaps(&stuff->length, n);
693706f2543Smrg    REQUEST_AT_LEAST_SIZE(xFillPolyReq);
694706f2543Smrg    swapl(&stuff->drawable, n);
695706f2543Smrg    swapl(&stuff->gc, n);
696706f2543Smrg    SwapRestS(stuff);
697706f2543Smrg    return((* ProcVector[X_FillPoly])(client));
698706f2543Smrg}
699706f2543Smrg
700706f2543Smrgint
701706f2543SmrgSProcPutImage(ClientPtr client)
702706f2543Smrg{
703706f2543Smrg    char n;
704706f2543Smrg    REQUEST(xPutImageReq);
705706f2543Smrg    swaps(&stuff->length, n);
706706f2543Smrg    REQUEST_AT_LEAST_SIZE(xPutImageReq);
707706f2543Smrg    swapl(&stuff->drawable, n);
708706f2543Smrg    swapl(&stuff->gc, n);
709706f2543Smrg    swaps(&stuff->width, n);
710706f2543Smrg    swaps(&stuff->height, n);
711706f2543Smrg    swaps(&stuff->dstX, n);
712706f2543Smrg    swaps(&stuff->dstY, n);
713706f2543Smrg    /* Image should already be swapped */
714706f2543Smrg    return((* ProcVector[X_PutImage])(client));
715706f2543Smrg
716706f2543Smrg}
717706f2543Smrg
718706f2543Smrgint
719706f2543SmrgSProcGetImage(ClientPtr client)
720706f2543Smrg{
721706f2543Smrg    char n;
722706f2543Smrg    REQUEST(xGetImageReq);
723706f2543Smrg    swaps(&stuff->length, n);
724706f2543Smrg    REQUEST_SIZE_MATCH(xGetImageReq);
725706f2543Smrg    swapl(&stuff->drawable, n);
726706f2543Smrg    swaps(&stuff->x, n);
727706f2543Smrg    swaps(&stuff->y, n);
728706f2543Smrg    swaps(&stuff->width, n);
729706f2543Smrg    swaps(&stuff->height, n);
730706f2543Smrg    swapl(&stuff->planeMask, n);
731706f2543Smrg    return((* ProcVector[X_GetImage])(client));
732706f2543Smrg}
733706f2543Smrg
734706f2543Smrg/* ProcPolyText used for both PolyText8 and PolyText16 */
735706f2543Smrg
736706f2543Smrgint
737706f2543SmrgSProcPolyText(ClientPtr client)
738706f2543Smrg{
739706f2543Smrg    char n;
740706f2543Smrg    REQUEST(xPolyTextReq);
741706f2543Smrg    swaps(&stuff->length, n);
742706f2543Smrg    REQUEST_AT_LEAST_SIZE(xPolyTextReq);
743706f2543Smrg    swapl(&stuff->drawable, n);
744706f2543Smrg    swapl(&stuff->gc, n);
745706f2543Smrg    swaps(&stuff->x, n);
746706f2543Smrg    swaps(&stuff->y, n);
747706f2543Smrg    return((* ProcVector[stuff->reqType])(client));
748706f2543Smrg}
749706f2543Smrg
750706f2543Smrg/* ProcImageText used for both ImageText8 and ImageText16 */
751706f2543Smrg
752706f2543Smrgint
753706f2543SmrgSProcImageText(ClientPtr client)
754706f2543Smrg{
755706f2543Smrg    char n;
756706f2543Smrg    REQUEST(xImageTextReq);
757706f2543Smrg    swaps(&stuff->length, n);
758706f2543Smrg    REQUEST_AT_LEAST_SIZE(xImageTextReq);
759706f2543Smrg    swapl(&stuff->drawable, n);
760706f2543Smrg    swapl(&stuff->gc, n);
761706f2543Smrg    swaps(&stuff->x, n);
762706f2543Smrg    swaps(&stuff->y, n);
763706f2543Smrg    return((* ProcVector[stuff->reqType])(client));
764706f2543Smrg}
765706f2543Smrg
766706f2543Smrgint
767706f2543SmrgSProcCreateColormap(ClientPtr client)
768706f2543Smrg{
769706f2543Smrg    char n;
770706f2543Smrg    REQUEST(xCreateColormapReq);
771706f2543Smrg    swaps(&stuff->length, n);
772706f2543Smrg    REQUEST_SIZE_MATCH(xCreateColormapReq);
773706f2543Smrg    swapl(&stuff->mid, n);
774706f2543Smrg    swapl(&stuff->window, n);
775706f2543Smrg    swapl(&stuff->visual, n);
776706f2543Smrg    return((* ProcVector[X_CreateColormap])(client));
777706f2543Smrg}
778706f2543Smrg
779706f2543Smrg
780706f2543Smrgint
781706f2543SmrgSProcCopyColormapAndFree(ClientPtr client)
782706f2543Smrg{
783706f2543Smrg    char n;
784706f2543Smrg    REQUEST(xCopyColormapAndFreeReq);
785706f2543Smrg    swaps(&stuff->length, n);
786706f2543Smrg    REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
787706f2543Smrg    swapl(&stuff->mid, n);
788706f2543Smrg    swapl(&stuff->srcCmap, n);
789706f2543Smrg    return((* ProcVector[X_CopyColormapAndFree])(client));
790706f2543Smrg
791706f2543Smrg}
792706f2543Smrg
793706f2543Smrgint
794706f2543SmrgSProcAllocColor(ClientPtr client)
795706f2543Smrg{
796706f2543Smrg    char n;
797706f2543Smrg    REQUEST(xAllocColorReq);
798706f2543Smrg    swaps(&stuff->length, n);
799706f2543Smrg    REQUEST_SIZE_MATCH(xAllocColorReq);
800706f2543Smrg    swapl(&stuff->cmap, n);
801706f2543Smrg    swaps(&stuff->red, n);
802706f2543Smrg    swaps(&stuff->green, n);
803706f2543Smrg    swaps(&stuff->blue, n);
804706f2543Smrg    return((* ProcVector[X_AllocColor])(client));
805706f2543Smrg}
806706f2543Smrg
807706f2543Smrgint
808706f2543SmrgSProcAllocNamedColor(ClientPtr client)
809706f2543Smrg{
810706f2543Smrg    char n;
811706f2543Smrg
812706f2543Smrg    REQUEST(xAllocNamedColorReq);
813706f2543Smrg    swaps(&stuff->length, n);
814706f2543Smrg    REQUEST_AT_LEAST_SIZE(xAllocNamedColorReq);
815706f2543Smrg    swapl(&stuff->cmap, n);
816706f2543Smrg    swaps(&stuff->nbytes, n);
817706f2543Smrg    return((* ProcVector[X_AllocNamedColor])(client));
818706f2543Smrg}
819706f2543Smrg
820706f2543Smrgint
821706f2543SmrgSProcAllocColorCells(ClientPtr client)
822706f2543Smrg{
823706f2543Smrg    char n;
824706f2543Smrg    REQUEST(xAllocColorCellsReq);
825706f2543Smrg    swaps(&stuff->length, n);
826706f2543Smrg    REQUEST_SIZE_MATCH(xAllocColorCellsReq);
827706f2543Smrg    swapl(&stuff->cmap, n);
828706f2543Smrg    swaps(&stuff->colors, n);
829706f2543Smrg    swaps(&stuff->planes, n);
830706f2543Smrg    return((* ProcVector[X_AllocColorCells])(client));
831706f2543Smrg}
832706f2543Smrg
833706f2543Smrgint
834706f2543SmrgSProcAllocColorPlanes(ClientPtr client)
835706f2543Smrg{
836706f2543Smrg    char n;
837706f2543Smrg    REQUEST(xAllocColorPlanesReq);
838706f2543Smrg    swaps(&stuff->length, n);
839706f2543Smrg    REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
840706f2543Smrg    swapl(&stuff->cmap, n);
841706f2543Smrg    swaps(&stuff->colors, n);
842706f2543Smrg    swaps(&stuff->red, n);
843706f2543Smrg    swaps(&stuff->green, n);
844706f2543Smrg    swaps(&stuff->blue, n);
845706f2543Smrg    return((* ProcVector[X_AllocColorPlanes])(client));
846706f2543Smrg}
847706f2543Smrg
848706f2543Smrgint
849706f2543SmrgSProcFreeColors(ClientPtr client)
850706f2543Smrg{
851706f2543Smrg    char n;
852706f2543Smrg    REQUEST(xFreeColorsReq);
853706f2543Smrg    swaps(&stuff->length, n);
854706f2543Smrg    REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
855706f2543Smrg    swapl(&stuff->cmap, n);
856706f2543Smrg    swapl(&stuff->planeMask, n);
857706f2543Smrg    SwapRestL(stuff);
858706f2543Smrg    return((* ProcVector[X_FreeColors])(client));
859706f2543Smrg
860706f2543Smrg}
861706f2543Smrg
862706f2543Smrgvoid
863706f2543SmrgSwapColorItem(xColorItem *pItem)
864706f2543Smrg{
865706f2543Smrg    char n;
866706f2543Smrg
867706f2543Smrg    swapl(&pItem->pixel, n);
868706f2543Smrg    swaps(&pItem->red, n);
869706f2543Smrg    swaps(&pItem->green, n);
870706f2543Smrg    swaps(&pItem->blue, n);
871706f2543Smrg}
872706f2543Smrg
873706f2543Smrgint
874706f2543SmrgSProcStoreColors(ClientPtr client)
875706f2543Smrg{
876706f2543Smrg    char n;
877706f2543Smrg    long count;
878706f2543Smrg    xColorItem 	*pItem;
879706f2543Smrg
880706f2543Smrg    REQUEST(xStoreColorsReq);
881706f2543Smrg    swaps(&stuff->length, n);
882706f2543Smrg    REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
883706f2543Smrg    swapl(&stuff->cmap, n);
884706f2543Smrg    pItem = (xColorItem *) &stuff[1];
885706f2543Smrg    for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
886706f2543Smrg	SwapColorItem(pItem++);
887706f2543Smrg    return((* ProcVector[X_StoreColors])(client));
888706f2543Smrg}
889706f2543Smrg
890706f2543Smrgint
891706f2543SmrgSProcStoreNamedColor (ClientPtr client)
892706f2543Smrg{
893706f2543Smrg    char n;
894706f2543Smrg    REQUEST(xStoreNamedColorReq);
895706f2543Smrg    swaps(&stuff->length, n);
896706f2543Smrg    REQUEST_AT_LEAST_SIZE(xStoreNamedColorReq);
897706f2543Smrg    swapl(&stuff->cmap, n);
898706f2543Smrg    swapl(&stuff->pixel, n);
899706f2543Smrg    swaps(&stuff->nbytes, n);
900706f2543Smrg    return((* ProcVector[X_StoreNamedColor])(client));
901706f2543Smrg}
902706f2543Smrg
903706f2543Smrgint
904706f2543SmrgSProcQueryColors (ClientPtr client)
905706f2543Smrg{
906706f2543Smrg    char n;
907706f2543Smrg    REQUEST(xQueryColorsReq);
908706f2543Smrg    swaps(&stuff->length, n);
909706f2543Smrg    REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
910706f2543Smrg    swapl(&stuff->cmap, n);
911706f2543Smrg    SwapRestL(stuff);
912706f2543Smrg    return((* ProcVector[X_QueryColors])(client));
913706f2543Smrg}
914706f2543Smrg
915706f2543Smrgint
916706f2543SmrgSProcLookupColor (ClientPtr client)
917706f2543Smrg{
918706f2543Smrg    char n;
919706f2543Smrg    REQUEST(xLookupColorReq);
920706f2543Smrg    swaps(&stuff->length, n);
921706f2543Smrg    REQUEST_AT_LEAST_SIZE(xLookupColorReq);
922706f2543Smrg    swapl(&stuff->cmap, n);
923706f2543Smrg    swaps(&stuff->nbytes, n);
924706f2543Smrg    return((* ProcVector[X_LookupColor])(client));
925706f2543Smrg}
926706f2543Smrg
927706f2543Smrgint
928706f2543SmrgSProcCreateCursor (ClientPtr client)
929706f2543Smrg{
930706f2543Smrg    char n;
931706f2543Smrg    REQUEST(xCreateCursorReq);
932706f2543Smrg    swaps(&stuff->length, n);
933706f2543Smrg    REQUEST_SIZE_MATCH(xCreateCursorReq);
934706f2543Smrg    swapl(&stuff->cid, n);
935706f2543Smrg    swapl(&stuff->source, n);
936706f2543Smrg    swapl(&stuff->mask, n);
937706f2543Smrg    swaps(&stuff->foreRed, n);
938706f2543Smrg    swaps(&stuff->foreGreen, n);
939706f2543Smrg    swaps(&stuff->foreBlue, n);
940706f2543Smrg    swaps(&stuff->backRed, n);
941706f2543Smrg    swaps(&stuff->backGreen, n);
942706f2543Smrg    swaps(&stuff->backBlue, n);
943706f2543Smrg    swaps(&stuff->x, n);
944706f2543Smrg    swaps(&stuff->y, n);
945706f2543Smrg    return((* ProcVector[X_CreateCursor])(client));
946706f2543Smrg}
947706f2543Smrg
948706f2543Smrgint
949706f2543SmrgSProcCreateGlyphCursor (ClientPtr client)
950706f2543Smrg{
951706f2543Smrg    char n;
952706f2543Smrg    REQUEST(xCreateGlyphCursorReq);
953706f2543Smrg    swaps(&stuff->length, n);
954706f2543Smrg    REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
955706f2543Smrg    swapl(&stuff->cid, n);
956706f2543Smrg    swapl(&stuff->source, n);
957706f2543Smrg    swapl(&stuff->mask, n);
958706f2543Smrg    swaps(&stuff->sourceChar, n);
959706f2543Smrg    swaps(&stuff->maskChar, n);
960706f2543Smrg    swaps(&stuff->foreRed, n);
961706f2543Smrg    swaps(&stuff->foreGreen, n);
962706f2543Smrg    swaps(&stuff->foreBlue, n);
963706f2543Smrg    swaps(&stuff->backRed, n);
964706f2543Smrg    swaps(&stuff->backGreen, n);
965706f2543Smrg    swaps(&stuff->backBlue, n);
966706f2543Smrg    return((* ProcVector[X_CreateGlyphCursor])(client));
967706f2543Smrg}
968706f2543Smrg
969706f2543Smrg
970706f2543Smrgint
971706f2543SmrgSProcRecolorCursor (ClientPtr client)
972706f2543Smrg{
973706f2543Smrg    char n;
974706f2543Smrg    REQUEST(xRecolorCursorReq);
975706f2543Smrg    swaps(&stuff->length, n);
976706f2543Smrg    REQUEST_SIZE_MATCH(xRecolorCursorReq);
977706f2543Smrg    swapl(&stuff->cursor, n);
978706f2543Smrg    swaps(&stuff->foreRed, n);
979706f2543Smrg    swaps(&stuff->foreGreen, n);
980706f2543Smrg    swaps(&stuff->foreBlue, n);
981706f2543Smrg    swaps(&stuff->backRed, n);
982706f2543Smrg    swaps(&stuff->backGreen, n);
983706f2543Smrg    swaps(&stuff->backBlue, n);
984706f2543Smrg    return((* ProcVector[X_RecolorCursor])(client));
985706f2543Smrg}
986706f2543Smrg
987706f2543Smrgint
988706f2543SmrgSProcQueryBestSize (ClientPtr client)
989706f2543Smrg{
990706f2543Smrg    char n;
991706f2543Smrg    REQUEST(xQueryBestSizeReq);
992706f2543Smrg    swaps(&stuff->length, n);
993706f2543Smrg    REQUEST_SIZE_MATCH(xQueryBestSizeReq);
994706f2543Smrg    swapl(&stuff->drawable, n);
995706f2543Smrg    swaps(&stuff->width, n);
996706f2543Smrg    swaps(&stuff->height, n);
997706f2543Smrg    return((* ProcVector[X_QueryBestSize])(client));
998706f2543Smrg
999706f2543Smrg}
1000706f2543Smrg
1001706f2543Smrgint
1002706f2543SmrgSProcQueryExtension (ClientPtr client)
1003706f2543Smrg{
1004706f2543Smrg    char n;
1005706f2543Smrg    REQUEST(xQueryExtensionReq);
1006706f2543Smrg    swaps(&stuff->length, n);
1007706f2543Smrg    REQUEST_AT_LEAST_SIZE(xQueryExtensionReq);
1008706f2543Smrg    swaps(&stuff->nbytes, n);
1009706f2543Smrg    return((* ProcVector[X_QueryExtension])(client));
1010706f2543Smrg}
1011706f2543Smrg
1012706f2543Smrgint
1013706f2543SmrgSProcChangeKeyboardMapping (ClientPtr client)
1014706f2543Smrg{
1015706f2543Smrg    char n;
1016706f2543Smrg    REQUEST(xChangeKeyboardMappingReq);
1017706f2543Smrg    swaps(&stuff->length, n);
1018706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
1019706f2543Smrg    SwapRestL(stuff);
1020706f2543Smrg    return((* ProcVector[X_ChangeKeyboardMapping])(client));
1021706f2543Smrg}
1022706f2543Smrg
1023706f2543Smrg
1024706f2543Smrgint
1025706f2543SmrgSProcChangeKeyboardControl (ClientPtr client)
1026706f2543Smrg{
1027706f2543Smrg    char n;
1028706f2543Smrg    REQUEST(xChangeKeyboardControlReq);
1029706f2543Smrg    swaps(&stuff->length, n);
1030706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
1031706f2543Smrg    swapl(&stuff->mask, n);
1032706f2543Smrg    SwapRestL(stuff);
1033706f2543Smrg    return((* ProcVector[X_ChangeKeyboardControl])(client));
1034706f2543Smrg}
1035706f2543Smrg
1036706f2543Smrgint
1037706f2543SmrgSProcChangePointerControl (ClientPtr client)
1038706f2543Smrg{
1039706f2543Smrg    char n;
1040706f2543Smrg    REQUEST(xChangePointerControlReq);
1041706f2543Smrg    swaps(&stuff->length, n);
1042706f2543Smrg    REQUEST_SIZE_MATCH(xChangePointerControlReq);
1043706f2543Smrg    swaps(&stuff->accelNum, n);
1044706f2543Smrg    swaps(&stuff->accelDenum, n);
1045706f2543Smrg    swaps(&stuff->threshold, n);
1046706f2543Smrg    return((* ProcVector[X_ChangePointerControl])(client));
1047706f2543Smrg}
1048706f2543Smrg
1049706f2543Smrg
1050706f2543Smrgint
1051706f2543SmrgSProcSetScreenSaver (ClientPtr client)
1052706f2543Smrg{
1053706f2543Smrg    char n;
1054706f2543Smrg    REQUEST(xSetScreenSaverReq);
1055706f2543Smrg    swaps(&stuff->length, n);
1056706f2543Smrg    REQUEST_SIZE_MATCH(xSetScreenSaverReq);
1057706f2543Smrg    swaps(&stuff->timeout, n);
1058706f2543Smrg    swaps(&stuff->interval, n);
1059706f2543Smrg    return((* ProcVector[X_SetScreenSaver])(client));
1060706f2543Smrg}
1061706f2543Smrg
1062706f2543Smrgint
1063706f2543SmrgSProcChangeHosts (ClientPtr client)
1064706f2543Smrg{
1065706f2543Smrg    char n;
1066706f2543Smrg
1067706f2543Smrg    REQUEST(xChangeHostsReq);
1068706f2543Smrg    swaps(&stuff->length, n);
1069706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeHostsReq);
1070706f2543Smrg    swaps(&stuff->hostLength, n);
1071706f2543Smrg    return((* ProcVector[X_ChangeHosts])(client));
1072706f2543Smrg
1073706f2543Smrg}
1074706f2543Smrg
1075706f2543Smrgint SProcRotateProperties (ClientPtr client)
1076706f2543Smrg{
1077706f2543Smrg    char n;
1078706f2543Smrg    REQUEST(xRotatePropertiesReq);
1079706f2543Smrg    swaps(&stuff->length, n);
1080706f2543Smrg    REQUEST_AT_LEAST_SIZE(xRotatePropertiesReq);
1081706f2543Smrg    swapl(&stuff->window, n);
1082706f2543Smrg    swaps(&stuff->nAtoms, n);
1083706f2543Smrg    swaps(&stuff->nPositions, n);
1084706f2543Smrg    SwapRestL(stuff);
1085706f2543Smrg    return ((* ProcVector[X_RotateProperties])(client));
1086706f2543Smrg}
1087706f2543Smrg
1088706f2543Smrgint
1089706f2543SmrgSProcNoOperation(ClientPtr client)
1090706f2543Smrg{
1091706f2543Smrg    char n;
1092706f2543Smrg    REQUEST(xReq);
1093706f2543Smrg    swaps(&stuff->length, n);
1094706f2543Smrg    return ((* ProcVector[X_NoOperation])(client));
1095706f2543Smrg}
1096706f2543Smrg
1097706f2543Smrgvoid
1098706f2543SmrgSwapConnClientPrefix(xConnClientPrefix *pCCP)
1099706f2543Smrg{
1100706f2543Smrg    char n;
1101706f2543Smrg
1102706f2543Smrg    swaps(&pCCP->majorVersion, n);
1103706f2543Smrg    swaps(&pCCP->minorVersion, n);
1104706f2543Smrg    swaps(&pCCP->nbytesAuthProto, n);
1105706f2543Smrg    swaps(&pCCP->nbytesAuthString, n);
1106706f2543Smrg}
1107