swapreq.c revision 706f2543
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
318706f2543Smrg    /* Swap event */
319706f2543Smrg    proc = EventSwapVector[stuff->event.u.u.type & 0177];
320706f2543Smrg    if (!proc ||  proc == NotImplemented)    /* no swapping proc; invalid event type? */
321706f2543Smrg       return BadValue;
322706f2543Smrg    (*proc)(&stuff->event, &eventT);
323706f2543Smrg    stuff->event = eventT;
324706f2543Smrg
325706f2543Smrg    return((* ProcVector[X_SendEvent])(client));
326706f2543Smrg}
327706f2543Smrg
328706f2543Smrgint
329706f2543SmrgSProcGrabPointer(ClientPtr client)
330706f2543Smrg{
331706f2543Smrg    char n;
332706f2543Smrg    REQUEST(xGrabPointerReq);
333706f2543Smrg    swaps(&stuff->length, n);
334706f2543Smrg    REQUEST_SIZE_MATCH(xGrabPointerReq);
335706f2543Smrg    swapl(&stuff->grabWindow, n);
336706f2543Smrg    swaps(&stuff->eventMask, n);
337706f2543Smrg    swapl(&stuff->confineTo, n);
338706f2543Smrg    swapl(&stuff->cursor, n);
339706f2543Smrg    swapl(&stuff->time, n);
340706f2543Smrg    return((* ProcVector[X_GrabPointer])(client));
341706f2543Smrg}
342706f2543Smrg
343706f2543Smrgint
344706f2543SmrgSProcGrabButton(ClientPtr client)
345706f2543Smrg{
346706f2543Smrg    char n;
347706f2543Smrg    REQUEST(xGrabButtonReq);
348706f2543Smrg    swaps(&stuff->length, n);
349706f2543Smrg    REQUEST_SIZE_MATCH(xGrabButtonReq);
350706f2543Smrg    swapl(&stuff->grabWindow, n);
351706f2543Smrg    swaps(&stuff->eventMask, n);
352706f2543Smrg    swapl(&stuff->confineTo, n);
353706f2543Smrg    swapl(&stuff->cursor, n);
354706f2543Smrg    swaps(&stuff->modifiers, n);
355706f2543Smrg    return((* ProcVector[X_GrabButton])(client));
356706f2543Smrg}
357706f2543Smrg
358706f2543Smrgint
359706f2543SmrgSProcUngrabButton(ClientPtr client)
360706f2543Smrg{
361706f2543Smrg    char n;
362706f2543Smrg    REQUEST(xUngrabButtonReq);
363706f2543Smrg    swaps(&stuff->length, n);
364706f2543Smrg    REQUEST_SIZE_MATCH(xUngrabButtonReq);
365706f2543Smrg    swapl(&stuff->grabWindow, n);
366706f2543Smrg    swaps(&stuff->modifiers, n);
367706f2543Smrg    return((* ProcVector[X_UngrabButton])(client));
368706f2543Smrg}
369706f2543Smrg
370706f2543Smrgint
371706f2543SmrgSProcChangeActivePointerGrab(ClientPtr client)
372706f2543Smrg{
373706f2543Smrg    char n;
374706f2543Smrg    REQUEST(xChangeActivePointerGrabReq);
375706f2543Smrg    swaps(&stuff->length, n);
376706f2543Smrg    REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
377706f2543Smrg    swapl(&stuff->cursor, n);
378706f2543Smrg    swapl(&stuff->time, n);
379706f2543Smrg    swaps(&stuff->eventMask, n);
380706f2543Smrg    return((* ProcVector[X_ChangeActivePointerGrab])(client));
381706f2543Smrg}
382706f2543Smrg
383706f2543Smrgint
384706f2543SmrgSProcGrabKeyboard(ClientPtr client)
385706f2543Smrg{
386706f2543Smrg    char n;
387706f2543Smrg    REQUEST(xGrabKeyboardReq);
388706f2543Smrg    swaps(&stuff->length, n);
389706f2543Smrg    REQUEST_SIZE_MATCH(xGrabKeyboardReq);
390706f2543Smrg    swapl(&stuff->grabWindow, n);
391706f2543Smrg    swapl(&stuff->time, n);
392706f2543Smrg    return((* ProcVector[X_GrabKeyboard])(client));
393706f2543Smrg}
394706f2543Smrg
395706f2543Smrgint
396706f2543SmrgSProcGrabKey(ClientPtr client)
397706f2543Smrg{
398706f2543Smrg    char n;
399706f2543Smrg    REQUEST(xGrabKeyReq);
400706f2543Smrg    swaps(&stuff->length, n);
401706f2543Smrg    REQUEST_SIZE_MATCH(xGrabKeyReq);
402706f2543Smrg    swapl(&stuff->grabWindow, n);
403706f2543Smrg    swaps(&stuff->modifiers, n);
404706f2543Smrg    return((* ProcVector[X_GrabKey])(client));
405706f2543Smrg}
406706f2543Smrg
407706f2543Smrgint
408706f2543SmrgSProcUngrabKey(ClientPtr client)
409706f2543Smrg{
410706f2543Smrg    char n;
411706f2543Smrg    REQUEST(xUngrabKeyReq);
412706f2543Smrg    swaps(&stuff->length, n);
413706f2543Smrg    REQUEST_SIZE_MATCH(xUngrabKeyReq);
414706f2543Smrg    swapl(&stuff->grabWindow, n);
415706f2543Smrg    swaps(&stuff->modifiers, n);
416706f2543Smrg    return((* ProcVector[X_UngrabKey])(client));
417706f2543Smrg}
418706f2543Smrg
419706f2543Smrgint
420706f2543SmrgSProcGetMotionEvents(ClientPtr client)
421706f2543Smrg{
422706f2543Smrg    char n;
423706f2543Smrg    REQUEST(xGetMotionEventsReq);
424706f2543Smrg    swaps(&stuff->length, n);
425706f2543Smrg    REQUEST_SIZE_MATCH(xGetMotionEventsReq);
426706f2543Smrg    swapl(&stuff->window, n);
427706f2543Smrg    swapl(&stuff->start, n);
428706f2543Smrg    swapl(&stuff->stop, n);
429706f2543Smrg    return((* ProcVector[X_GetMotionEvents])(client));
430706f2543Smrg}
431706f2543Smrg
432706f2543Smrgint
433706f2543SmrgSProcTranslateCoords(ClientPtr client)
434706f2543Smrg{
435706f2543Smrg    char n;
436706f2543Smrg    REQUEST(xTranslateCoordsReq);
437706f2543Smrg    swaps(&stuff->length, n);
438706f2543Smrg    REQUEST_SIZE_MATCH(xTranslateCoordsReq);
439706f2543Smrg    swapl(&stuff->srcWid, n);
440706f2543Smrg    swapl(&stuff->dstWid, n);
441706f2543Smrg    swaps(&stuff->srcX, n);
442706f2543Smrg    swaps(&stuff->srcY, n);
443706f2543Smrg    return((* ProcVector[X_TranslateCoords])(client));
444706f2543Smrg}
445706f2543Smrg
446706f2543Smrgint
447706f2543SmrgSProcWarpPointer(ClientPtr client)
448706f2543Smrg{
449706f2543Smrg    char n;
450706f2543Smrg    REQUEST(xWarpPointerReq);
451706f2543Smrg    swaps(&stuff->length, n);
452706f2543Smrg    REQUEST_SIZE_MATCH(xWarpPointerReq);
453706f2543Smrg    swapl(&stuff->srcWid, n);
454706f2543Smrg    swapl(&stuff->dstWid, n);
455706f2543Smrg    swaps(&stuff->srcX, n);
456706f2543Smrg    swaps(&stuff->srcY, n);
457706f2543Smrg    swaps(&stuff->srcWidth, n);
458706f2543Smrg    swaps(&stuff->srcHeight, n);
459706f2543Smrg    swaps(&stuff->dstX, n);
460706f2543Smrg    swaps(&stuff->dstY, n);
461706f2543Smrg    return((* ProcVector[X_WarpPointer])(client));
462706f2543Smrg}
463706f2543Smrg
464706f2543Smrgint
465706f2543SmrgSProcSetInputFocus(ClientPtr client)
466706f2543Smrg{
467706f2543Smrg    char n;
468706f2543Smrg    REQUEST(xSetInputFocusReq);
469706f2543Smrg    swaps(&stuff->length, n);
470706f2543Smrg    REQUEST_SIZE_MATCH(xSetInputFocusReq);
471706f2543Smrg    swapl(&stuff->focus, n);
472706f2543Smrg    swapl(&stuff->time, n);
473706f2543Smrg    return((* ProcVector[X_SetInputFocus])(client));
474706f2543Smrg}
475706f2543Smrg
476706f2543Smrgint
477706f2543SmrgSProcOpenFont(ClientPtr client)
478706f2543Smrg{
479706f2543Smrg    char n;
480706f2543Smrg    REQUEST(xOpenFontReq);
481706f2543Smrg    swaps(&stuff->length, n);
482706f2543Smrg    REQUEST_AT_LEAST_SIZE(xOpenFontReq);
483706f2543Smrg    swapl(&stuff->fid, n);
484706f2543Smrg    swaps(&stuff->nbytes, n);
485706f2543Smrg    return((* ProcVector[X_OpenFont])(client));
486706f2543Smrg}
487706f2543Smrg
488706f2543Smrgint
489706f2543SmrgSProcListFonts(ClientPtr client)
490706f2543Smrg{
491706f2543Smrg    char n;
492706f2543Smrg    REQUEST(xListFontsReq);
493706f2543Smrg    swaps(&stuff->length, n);
494706f2543Smrg    REQUEST_AT_LEAST_SIZE(xListFontsReq);
495706f2543Smrg    swaps(&stuff->maxNames, n);
496706f2543Smrg    swaps(&stuff->nbytes, n);
497706f2543Smrg    return((* ProcVector[X_ListFonts])(client));
498706f2543Smrg}
499706f2543Smrg
500706f2543Smrgint
501706f2543SmrgSProcListFontsWithInfo(ClientPtr client)
502706f2543Smrg{
503706f2543Smrg    char n;
504706f2543Smrg    REQUEST(xListFontsWithInfoReq);
505706f2543Smrg    swaps(&stuff->length, n);
506706f2543Smrg    REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq);
507706f2543Smrg    swaps(&stuff->maxNames, n);
508706f2543Smrg    swaps(&stuff->nbytes, n);
509706f2543Smrg    return((* ProcVector[X_ListFontsWithInfo])(client));
510706f2543Smrg}
511706f2543Smrg
512706f2543Smrgint
513706f2543SmrgSProcSetFontPath(ClientPtr client)
514706f2543Smrg{
515706f2543Smrg    char n;
516706f2543Smrg    REQUEST(xSetFontPathReq);
517706f2543Smrg    swaps(&stuff->length, n);
518706f2543Smrg    REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
519706f2543Smrg    swaps(&stuff->nFonts, n);
520706f2543Smrg    return((* ProcVector[X_SetFontPath])(client));
521706f2543Smrg}
522706f2543Smrg
523706f2543Smrgint
524706f2543SmrgSProcCreatePixmap(ClientPtr client)
525706f2543Smrg{
526706f2543Smrg    char n;
527706f2543Smrg    REQUEST(xCreatePixmapReq);
528706f2543Smrg
529706f2543Smrg    swaps(&stuff->length, n);
530706f2543Smrg    REQUEST_SIZE_MATCH(xCreatePixmapReq);
531706f2543Smrg    swapl(&stuff->pid, n);
532706f2543Smrg    swapl(&stuff->drawable, n);
533706f2543Smrg    swaps(&stuff->width, n);
534706f2543Smrg    swaps(&stuff->height, n);
535706f2543Smrg    return((* ProcVector[X_CreatePixmap])(client));
536706f2543Smrg}
537706f2543Smrg
538706f2543Smrgint
539706f2543SmrgSProcCreateGC(ClientPtr client)
540706f2543Smrg{
541706f2543Smrg    char n;
542706f2543Smrg    REQUEST(xCreateGCReq);
543706f2543Smrg    swaps(&stuff->length, n);
544706f2543Smrg    REQUEST_AT_LEAST_SIZE(xCreateGCReq);
545706f2543Smrg    swapl(&stuff->gc, n);
546706f2543Smrg    swapl(&stuff->drawable, n);
547706f2543Smrg    swapl(&stuff->mask, n);
548706f2543Smrg    SwapRestL(stuff);
549706f2543Smrg    return((* ProcVector[X_CreateGC])(client));
550706f2543Smrg}
551706f2543Smrg
552706f2543Smrgint
553706f2543SmrgSProcChangeGC(ClientPtr client)
554706f2543Smrg{
555706f2543Smrg    char n;
556706f2543Smrg    REQUEST(xChangeGCReq);
557706f2543Smrg    swaps(&stuff->length, n);
558706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeGCReq);
559706f2543Smrg    swapl(&stuff->gc, n);
560706f2543Smrg    swapl(&stuff->mask, n);
561706f2543Smrg    SwapRestL(stuff);
562706f2543Smrg    return((* ProcVector[X_ChangeGC])(client));
563706f2543Smrg}
564706f2543Smrg
565706f2543Smrgint
566706f2543SmrgSProcCopyGC(ClientPtr client)
567706f2543Smrg{
568706f2543Smrg    char n;
569706f2543Smrg    REQUEST(xCopyGCReq);
570706f2543Smrg    swaps(&stuff->length, n);
571706f2543Smrg    REQUEST_SIZE_MATCH(xCopyGCReq);
572706f2543Smrg    swapl(&stuff->srcGC, n);
573706f2543Smrg    swapl(&stuff->dstGC, n);
574706f2543Smrg    swapl(&stuff->mask, n);
575706f2543Smrg    return((* ProcVector[X_CopyGC])(client));
576706f2543Smrg}
577706f2543Smrg
578706f2543Smrgint
579706f2543SmrgSProcSetDashes(ClientPtr client)
580706f2543Smrg{
581706f2543Smrg    char n;
582706f2543Smrg    REQUEST(xSetDashesReq);
583706f2543Smrg    swaps(&stuff->length, n);
584706f2543Smrg    REQUEST_AT_LEAST_SIZE(xSetDashesReq);
585706f2543Smrg    swapl(&stuff->gc, n);
586706f2543Smrg    swaps(&stuff->dashOffset, n);
587706f2543Smrg    swaps(&stuff->nDashes, n);
588706f2543Smrg    return((* ProcVector[X_SetDashes])(client));
589706f2543Smrg
590706f2543Smrg}
591706f2543Smrg
592706f2543Smrgint
593706f2543SmrgSProcSetClipRectangles(ClientPtr client)
594706f2543Smrg{
595706f2543Smrg    char n;
596706f2543Smrg    REQUEST(xSetClipRectanglesReq);
597706f2543Smrg    swaps(&stuff->length, n);
598706f2543Smrg    REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
599706f2543Smrg    swapl(&stuff->gc, n);
600706f2543Smrg    swaps(&stuff->xOrigin, n);
601706f2543Smrg    swaps(&stuff->yOrigin, n);
602706f2543Smrg    SwapRestS(stuff);
603706f2543Smrg    return((* ProcVector[X_SetClipRectangles])(client));
604706f2543Smrg}
605706f2543Smrg
606706f2543Smrgint
607706f2543SmrgSProcClearToBackground(ClientPtr client)
608706f2543Smrg{
609706f2543Smrg    char n;
610706f2543Smrg    REQUEST(xClearAreaReq);
611706f2543Smrg    swaps(&stuff->length, n);
612706f2543Smrg    REQUEST_SIZE_MATCH(xClearAreaReq);
613706f2543Smrg    swapl(&stuff->window, n);
614706f2543Smrg    swaps(&stuff->x, n);
615706f2543Smrg    swaps(&stuff->y, n);
616706f2543Smrg    swaps(&stuff->width, n);
617706f2543Smrg    swaps(&stuff->height, n);
618706f2543Smrg    return((* ProcVector[X_ClearArea])(client));
619706f2543Smrg}
620706f2543Smrg
621706f2543Smrgint
622706f2543SmrgSProcCopyArea(ClientPtr client)
623706f2543Smrg{
624706f2543Smrg    char n;
625706f2543Smrg    REQUEST(xCopyAreaReq);
626706f2543Smrg    swaps(&stuff->length, n);
627706f2543Smrg    REQUEST_SIZE_MATCH(xCopyAreaReq);
628706f2543Smrg    swapl(&stuff->srcDrawable, n);
629706f2543Smrg    swapl(&stuff->dstDrawable, n);
630706f2543Smrg    swapl(&stuff->gc, n);
631706f2543Smrg    swaps(&stuff->srcX, n);
632706f2543Smrg    swaps(&stuff->srcY, n);
633706f2543Smrg    swaps(&stuff->dstX, n);
634706f2543Smrg    swaps(&stuff->dstY, n);
635706f2543Smrg    swaps(&stuff->width, n);
636706f2543Smrg    swaps(&stuff->height, n);
637706f2543Smrg    return((* ProcVector[X_CopyArea])(client));
638706f2543Smrg}
639706f2543Smrg
640706f2543Smrgint
641706f2543SmrgSProcCopyPlane(ClientPtr client)
642706f2543Smrg{
643706f2543Smrg    char n;
644706f2543Smrg    REQUEST(xCopyPlaneReq);
645706f2543Smrg    swaps(&stuff->length, n);
646706f2543Smrg    REQUEST_SIZE_MATCH(xCopyPlaneReq);
647706f2543Smrg    swapl(&stuff->srcDrawable, n);
648706f2543Smrg    swapl(&stuff->dstDrawable, n);
649706f2543Smrg    swapl(&stuff->gc, n);
650706f2543Smrg    swaps(&stuff->srcX, n);
651706f2543Smrg    swaps(&stuff->srcY, n);
652706f2543Smrg    swaps(&stuff->dstX, n);
653706f2543Smrg    swaps(&stuff->dstY, n);
654706f2543Smrg    swaps(&stuff->width, n);
655706f2543Smrg    swaps(&stuff->height, n);
656706f2543Smrg    swapl(&stuff->bitPlane, n);
657706f2543Smrg    return((* ProcVector[X_CopyPlane])(client));
658706f2543Smrg}
659706f2543Smrg
660706f2543Smrg/* The following routine is used for all Poly drawing requests
661706f2543Smrg   (except FillPoly, which uses a different request format) */
662706f2543Smrgint
663706f2543SmrgSProcPoly(ClientPtr client)
664706f2543Smrg{
665706f2543Smrg    char n;
666706f2543Smrg
667706f2543Smrg    REQUEST(xPolyPointReq);
668706f2543Smrg    swaps(&stuff->length, n);
669706f2543Smrg    REQUEST_AT_LEAST_SIZE(xPolyPointReq);
670706f2543Smrg    swapl(&stuff->drawable, n);
671706f2543Smrg    swapl(&stuff->gc, n);
672706f2543Smrg    SwapRestS(stuff);
673706f2543Smrg    return((* ProcVector[stuff->reqType])(client));
674706f2543Smrg}
675706f2543Smrg
676706f2543Smrg/* cannot use SProcPoly for this one, because xFillPolyReq
677706f2543Smrg   is longer than xPolyPointReq, and we don't want to swap
678706f2543Smrg   the difference as shorts! */
679706f2543Smrgint
680706f2543SmrgSProcFillPoly(ClientPtr client)
681706f2543Smrg{
682706f2543Smrg    char n;
683706f2543Smrg
684706f2543Smrg    REQUEST(xFillPolyReq);
685706f2543Smrg    swaps(&stuff->length, n);
686706f2543Smrg    REQUEST_AT_LEAST_SIZE(xFillPolyReq);
687706f2543Smrg    swapl(&stuff->drawable, n);
688706f2543Smrg    swapl(&stuff->gc, n);
689706f2543Smrg    SwapRestS(stuff);
690706f2543Smrg    return((* ProcVector[X_FillPoly])(client));
691706f2543Smrg}
692706f2543Smrg
693706f2543Smrgint
694706f2543SmrgSProcPutImage(ClientPtr client)
695706f2543Smrg{
696706f2543Smrg    char n;
697706f2543Smrg    REQUEST(xPutImageReq);
698706f2543Smrg    swaps(&stuff->length, n);
699706f2543Smrg    REQUEST_AT_LEAST_SIZE(xPutImageReq);
700706f2543Smrg    swapl(&stuff->drawable, n);
701706f2543Smrg    swapl(&stuff->gc, n);
702706f2543Smrg    swaps(&stuff->width, n);
703706f2543Smrg    swaps(&stuff->height, n);
704706f2543Smrg    swaps(&stuff->dstX, n);
705706f2543Smrg    swaps(&stuff->dstY, n);
706706f2543Smrg    /* Image should already be swapped */
707706f2543Smrg    return((* ProcVector[X_PutImage])(client));
708706f2543Smrg
709706f2543Smrg}
710706f2543Smrg
711706f2543Smrgint
712706f2543SmrgSProcGetImage(ClientPtr client)
713706f2543Smrg{
714706f2543Smrg    char n;
715706f2543Smrg    REQUEST(xGetImageReq);
716706f2543Smrg    swaps(&stuff->length, n);
717706f2543Smrg    REQUEST_SIZE_MATCH(xGetImageReq);
718706f2543Smrg    swapl(&stuff->drawable, n);
719706f2543Smrg    swaps(&stuff->x, n);
720706f2543Smrg    swaps(&stuff->y, n);
721706f2543Smrg    swaps(&stuff->width, n);
722706f2543Smrg    swaps(&stuff->height, n);
723706f2543Smrg    swapl(&stuff->planeMask, n);
724706f2543Smrg    return((* ProcVector[X_GetImage])(client));
725706f2543Smrg}
726706f2543Smrg
727706f2543Smrg/* ProcPolyText used for both PolyText8 and PolyText16 */
728706f2543Smrg
729706f2543Smrgint
730706f2543SmrgSProcPolyText(ClientPtr client)
731706f2543Smrg{
732706f2543Smrg    char n;
733706f2543Smrg    REQUEST(xPolyTextReq);
734706f2543Smrg    swaps(&stuff->length, n);
735706f2543Smrg    REQUEST_AT_LEAST_SIZE(xPolyTextReq);
736706f2543Smrg    swapl(&stuff->drawable, n);
737706f2543Smrg    swapl(&stuff->gc, n);
738706f2543Smrg    swaps(&stuff->x, n);
739706f2543Smrg    swaps(&stuff->y, n);
740706f2543Smrg    return((* ProcVector[stuff->reqType])(client));
741706f2543Smrg}
742706f2543Smrg
743706f2543Smrg/* ProcImageText used for both ImageText8 and ImageText16 */
744706f2543Smrg
745706f2543Smrgint
746706f2543SmrgSProcImageText(ClientPtr client)
747706f2543Smrg{
748706f2543Smrg    char n;
749706f2543Smrg    REQUEST(xImageTextReq);
750706f2543Smrg    swaps(&stuff->length, n);
751706f2543Smrg    REQUEST_AT_LEAST_SIZE(xImageTextReq);
752706f2543Smrg    swapl(&stuff->drawable, n);
753706f2543Smrg    swapl(&stuff->gc, n);
754706f2543Smrg    swaps(&stuff->x, n);
755706f2543Smrg    swaps(&stuff->y, n);
756706f2543Smrg    return((* ProcVector[stuff->reqType])(client));
757706f2543Smrg}
758706f2543Smrg
759706f2543Smrgint
760706f2543SmrgSProcCreateColormap(ClientPtr client)
761706f2543Smrg{
762706f2543Smrg    char n;
763706f2543Smrg    REQUEST(xCreateColormapReq);
764706f2543Smrg    swaps(&stuff->length, n);
765706f2543Smrg    REQUEST_SIZE_MATCH(xCreateColormapReq);
766706f2543Smrg    swapl(&stuff->mid, n);
767706f2543Smrg    swapl(&stuff->window, n);
768706f2543Smrg    swapl(&stuff->visual, n);
769706f2543Smrg    return((* ProcVector[X_CreateColormap])(client));
770706f2543Smrg}
771706f2543Smrg
772706f2543Smrg
773706f2543Smrgint
774706f2543SmrgSProcCopyColormapAndFree(ClientPtr client)
775706f2543Smrg{
776706f2543Smrg    char n;
777706f2543Smrg    REQUEST(xCopyColormapAndFreeReq);
778706f2543Smrg    swaps(&stuff->length, n);
779706f2543Smrg    REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
780706f2543Smrg    swapl(&stuff->mid, n);
781706f2543Smrg    swapl(&stuff->srcCmap, n);
782706f2543Smrg    return((* ProcVector[X_CopyColormapAndFree])(client));
783706f2543Smrg
784706f2543Smrg}
785706f2543Smrg
786706f2543Smrgint
787706f2543SmrgSProcAllocColor(ClientPtr client)
788706f2543Smrg{
789706f2543Smrg    char n;
790706f2543Smrg    REQUEST(xAllocColorReq);
791706f2543Smrg    swaps(&stuff->length, n);
792706f2543Smrg    REQUEST_SIZE_MATCH(xAllocColorReq);
793706f2543Smrg    swapl(&stuff->cmap, n);
794706f2543Smrg    swaps(&stuff->red, n);
795706f2543Smrg    swaps(&stuff->green, n);
796706f2543Smrg    swaps(&stuff->blue, n);
797706f2543Smrg    return((* ProcVector[X_AllocColor])(client));
798706f2543Smrg}
799706f2543Smrg
800706f2543Smrgint
801706f2543SmrgSProcAllocNamedColor(ClientPtr client)
802706f2543Smrg{
803706f2543Smrg    char n;
804706f2543Smrg
805706f2543Smrg    REQUEST(xAllocNamedColorReq);
806706f2543Smrg    swaps(&stuff->length, n);
807706f2543Smrg    REQUEST_AT_LEAST_SIZE(xAllocNamedColorReq);
808706f2543Smrg    swapl(&stuff->cmap, n);
809706f2543Smrg    swaps(&stuff->nbytes, n);
810706f2543Smrg    return((* ProcVector[X_AllocNamedColor])(client));
811706f2543Smrg}
812706f2543Smrg
813706f2543Smrgint
814706f2543SmrgSProcAllocColorCells(ClientPtr client)
815706f2543Smrg{
816706f2543Smrg    char n;
817706f2543Smrg    REQUEST(xAllocColorCellsReq);
818706f2543Smrg    swaps(&stuff->length, n);
819706f2543Smrg    REQUEST_SIZE_MATCH(xAllocColorCellsReq);
820706f2543Smrg    swapl(&stuff->cmap, n);
821706f2543Smrg    swaps(&stuff->colors, n);
822706f2543Smrg    swaps(&stuff->planes, n);
823706f2543Smrg    return((* ProcVector[X_AllocColorCells])(client));
824706f2543Smrg}
825706f2543Smrg
826706f2543Smrgint
827706f2543SmrgSProcAllocColorPlanes(ClientPtr client)
828706f2543Smrg{
829706f2543Smrg    char n;
830706f2543Smrg    REQUEST(xAllocColorPlanesReq);
831706f2543Smrg    swaps(&stuff->length, n);
832706f2543Smrg    REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
833706f2543Smrg    swapl(&stuff->cmap, n);
834706f2543Smrg    swaps(&stuff->colors, n);
835706f2543Smrg    swaps(&stuff->red, n);
836706f2543Smrg    swaps(&stuff->green, n);
837706f2543Smrg    swaps(&stuff->blue, n);
838706f2543Smrg    return((* ProcVector[X_AllocColorPlanes])(client));
839706f2543Smrg}
840706f2543Smrg
841706f2543Smrgint
842706f2543SmrgSProcFreeColors(ClientPtr client)
843706f2543Smrg{
844706f2543Smrg    char n;
845706f2543Smrg    REQUEST(xFreeColorsReq);
846706f2543Smrg    swaps(&stuff->length, n);
847706f2543Smrg    REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
848706f2543Smrg    swapl(&stuff->cmap, n);
849706f2543Smrg    swapl(&stuff->planeMask, n);
850706f2543Smrg    SwapRestL(stuff);
851706f2543Smrg    return((* ProcVector[X_FreeColors])(client));
852706f2543Smrg
853706f2543Smrg}
854706f2543Smrg
855706f2543Smrgvoid
856706f2543SmrgSwapColorItem(xColorItem *pItem)
857706f2543Smrg{
858706f2543Smrg    char n;
859706f2543Smrg
860706f2543Smrg    swapl(&pItem->pixel, n);
861706f2543Smrg    swaps(&pItem->red, n);
862706f2543Smrg    swaps(&pItem->green, n);
863706f2543Smrg    swaps(&pItem->blue, n);
864706f2543Smrg}
865706f2543Smrg
866706f2543Smrgint
867706f2543SmrgSProcStoreColors(ClientPtr client)
868706f2543Smrg{
869706f2543Smrg    char n;
870706f2543Smrg    long count;
871706f2543Smrg    xColorItem 	*pItem;
872706f2543Smrg
873706f2543Smrg    REQUEST(xStoreColorsReq);
874706f2543Smrg    swaps(&stuff->length, n);
875706f2543Smrg    REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
876706f2543Smrg    swapl(&stuff->cmap, n);
877706f2543Smrg    pItem = (xColorItem *) &stuff[1];
878706f2543Smrg    for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
879706f2543Smrg	SwapColorItem(pItem++);
880706f2543Smrg    return((* ProcVector[X_StoreColors])(client));
881706f2543Smrg}
882706f2543Smrg
883706f2543Smrgint
884706f2543SmrgSProcStoreNamedColor (ClientPtr client)
885706f2543Smrg{
886706f2543Smrg    char n;
887706f2543Smrg    REQUEST(xStoreNamedColorReq);
888706f2543Smrg    swaps(&stuff->length, n);
889706f2543Smrg    REQUEST_AT_LEAST_SIZE(xStoreNamedColorReq);
890706f2543Smrg    swapl(&stuff->cmap, n);
891706f2543Smrg    swapl(&stuff->pixel, n);
892706f2543Smrg    swaps(&stuff->nbytes, n);
893706f2543Smrg    return((* ProcVector[X_StoreNamedColor])(client));
894706f2543Smrg}
895706f2543Smrg
896706f2543Smrgint
897706f2543SmrgSProcQueryColors (ClientPtr client)
898706f2543Smrg{
899706f2543Smrg    char n;
900706f2543Smrg    REQUEST(xQueryColorsReq);
901706f2543Smrg    swaps(&stuff->length, n);
902706f2543Smrg    REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
903706f2543Smrg    swapl(&stuff->cmap, n);
904706f2543Smrg    SwapRestL(stuff);
905706f2543Smrg    return((* ProcVector[X_QueryColors])(client));
906706f2543Smrg}
907706f2543Smrg
908706f2543Smrgint
909706f2543SmrgSProcLookupColor (ClientPtr client)
910706f2543Smrg{
911706f2543Smrg    char n;
912706f2543Smrg    REQUEST(xLookupColorReq);
913706f2543Smrg    swaps(&stuff->length, n);
914706f2543Smrg    REQUEST_AT_LEAST_SIZE(xLookupColorReq);
915706f2543Smrg    swapl(&stuff->cmap, n);
916706f2543Smrg    swaps(&stuff->nbytes, n);
917706f2543Smrg    return((* ProcVector[X_LookupColor])(client));
918706f2543Smrg}
919706f2543Smrg
920706f2543Smrgint
921706f2543SmrgSProcCreateCursor (ClientPtr client)
922706f2543Smrg{
923706f2543Smrg    char n;
924706f2543Smrg    REQUEST(xCreateCursorReq);
925706f2543Smrg    swaps(&stuff->length, n);
926706f2543Smrg    REQUEST_SIZE_MATCH(xCreateCursorReq);
927706f2543Smrg    swapl(&stuff->cid, n);
928706f2543Smrg    swapl(&stuff->source, n);
929706f2543Smrg    swapl(&stuff->mask, n);
930706f2543Smrg    swaps(&stuff->foreRed, n);
931706f2543Smrg    swaps(&stuff->foreGreen, n);
932706f2543Smrg    swaps(&stuff->foreBlue, n);
933706f2543Smrg    swaps(&stuff->backRed, n);
934706f2543Smrg    swaps(&stuff->backGreen, n);
935706f2543Smrg    swaps(&stuff->backBlue, n);
936706f2543Smrg    swaps(&stuff->x, n);
937706f2543Smrg    swaps(&stuff->y, n);
938706f2543Smrg    return((* ProcVector[X_CreateCursor])(client));
939706f2543Smrg}
940706f2543Smrg
941706f2543Smrgint
942706f2543SmrgSProcCreateGlyphCursor (ClientPtr client)
943706f2543Smrg{
944706f2543Smrg    char n;
945706f2543Smrg    REQUEST(xCreateGlyphCursorReq);
946706f2543Smrg    swaps(&stuff->length, n);
947706f2543Smrg    REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
948706f2543Smrg    swapl(&stuff->cid, n);
949706f2543Smrg    swapl(&stuff->source, n);
950706f2543Smrg    swapl(&stuff->mask, n);
951706f2543Smrg    swaps(&stuff->sourceChar, n);
952706f2543Smrg    swaps(&stuff->maskChar, n);
953706f2543Smrg    swaps(&stuff->foreRed, n);
954706f2543Smrg    swaps(&stuff->foreGreen, n);
955706f2543Smrg    swaps(&stuff->foreBlue, n);
956706f2543Smrg    swaps(&stuff->backRed, n);
957706f2543Smrg    swaps(&stuff->backGreen, n);
958706f2543Smrg    swaps(&stuff->backBlue, n);
959706f2543Smrg    return((* ProcVector[X_CreateGlyphCursor])(client));
960706f2543Smrg}
961706f2543Smrg
962706f2543Smrg
963706f2543Smrgint
964706f2543SmrgSProcRecolorCursor (ClientPtr client)
965706f2543Smrg{
966706f2543Smrg    char n;
967706f2543Smrg    REQUEST(xRecolorCursorReq);
968706f2543Smrg    swaps(&stuff->length, n);
969706f2543Smrg    REQUEST_SIZE_MATCH(xRecolorCursorReq);
970706f2543Smrg    swapl(&stuff->cursor, n);
971706f2543Smrg    swaps(&stuff->foreRed, n);
972706f2543Smrg    swaps(&stuff->foreGreen, n);
973706f2543Smrg    swaps(&stuff->foreBlue, n);
974706f2543Smrg    swaps(&stuff->backRed, n);
975706f2543Smrg    swaps(&stuff->backGreen, n);
976706f2543Smrg    swaps(&stuff->backBlue, n);
977706f2543Smrg    return((* ProcVector[X_RecolorCursor])(client));
978706f2543Smrg}
979706f2543Smrg
980706f2543Smrgint
981706f2543SmrgSProcQueryBestSize (ClientPtr client)
982706f2543Smrg{
983706f2543Smrg    char n;
984706f2543Smrg    REQUEST(xQueryBestSizeReq);
985706f2543Smrg    swaps(&stuff->length, n);
986706f2543Smrg    REQUEST_SIZE_MATCH(xQueryBestSizeReq);
987706f2543Smrg    swapl(&stuff->drawable, n);
988706f2543Smrg    swaps(&stuff->width, n);
989706f2543Smrg    swaps(&stuff->height, n);
990706f2543Smrg    return((* ProcVector[X_QueryBestSize])(client));
991706f2543Smrg
992706f2543Smrg}
993706f2543Smrg
994706f2543Smrgint
995706f2543SmrgSProcQueryExtension (ClientPtr client)
996706f2543Smrg{
997706f2543Smrg    char n;
998706f2543Smrg    REQUEST(xQueryExtensionReq);
999706f2543Smrg    swaps(&stuff->length, n);
1000706f2543Smrg    REQUEST_AT_LEAST_SIZE(xQueryExtensionReq);
1001706f2543Smrg    swaps(&stuff->nbytes, n);
1002706f2543Smrg    return((* ProcVector[X_QueryExtension])(client));
1003706f2543Smrg}
1004706f2543Smrg
1005706f2543Smrgint
1006706f2543SmrgSProcChangeKeyboardMapping (ClientPtr client)
1007706f2543Smrg{
1008706f2543Smrg    char n;
1009706f2543Smrg    REQUEST(xChangeKeyboardMappingReq);
1010706f2543Smrg    swaps(&stuff->length, n);
1011706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
1012706f2543Smrg    SwapRestL(stuff);
1013706f2543Smrg    return((* ProcVector[X_ChangeKeyboardMapping])(client));
1014706f2543Smrg}
1015706f2543Smrg
1016706f2543Smrg
1017706f2543Smrgint
1018706f2543SmrgSProcChangeKeyboardControl (ClientPtr client)
1019706f2543Smrg{
1020706f2543Smrg    char n;
1021706f2543Smrg    REQUEST(xChangeKeyboardControlReq);
1022706f2543Smrg    swaps(&stuff->length, n);
1023706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
1024706f2543Smrg    swapl(&stuff->mask, n);
1025706f2543Smrg    SwapRestL(stuff);
1026706f2543Smrg    return((* ProcVector[X_ChangeKeyboardControl])(client));
1027706f2543Smrg}
1028706f2543Smrg
1029706f2543Smrgint
1030706f2543SmrgSProcChangePointerControl (ClientPtr client)
1031706f2543Smrg{
1032706f2543Smrg    char n;
1033706f2543Smrg    REQUEST(xChangePointerControlReq);
1034706f2543Smrg    swaps(&stuff->length, n);
1035706f2543Smrg    REQUEST_SIZE_MATCH(xChangePointerControlReq);
1036706f2543Smrg    swaps(&stuff->accelNum, n);
1037706f2543Smrg    swaps(&stuff->accelDenum, n);
1038706f2543Smrg    swaps(&stuff->threshold, n);
1039706f2543Smrg    return((* ProcVector[X_ChangePointerControl])(client));
1040706f2543Smrg}
1041706f2543Smrg
1042706f2543Smrg
1043706f2543Smrgint
1044706f2543SmrgSProcSetScreenSaver (ClientPtr client)
1045706f2543Smrg{
1046706f2543Smrg    char n;
1047706f2543Smrg    REQUEST(xSetScreenSaverReq);
1048706f2543Smrg    swaps(&stuff->length, n);
1049706f2543Smrg    REQUEST_SIZE_MATCH(xSetScreenSaverReq);
1050706f2543Smrg    swaps(&stuff->timeout, n);
1051706f2543Smrg    swaps(&stuff->interval, n);
1052706f2543Smrg    return((* ProcVector[X_SetScreenSaver])(client));
1053706f2543Smrg}
1054706f2543Smrg
1055706f2543Smrgint
1056706f2543SmrgSProcChangeHosts (ClientPtr client)
1057706f2543Smrg{
1058706f2543Smrg    char n;
1059706f2543Smrg
1060706f2543Smrg    REQUEST(xChangeHostsReq);
1061706f2543Smrg    swaps(&stuff->length, n);
1062706f2543Smrg    REQUEST_AT_LEAST_SIZE(xChangeHostsReq);
1063706f2543Smrg    swaps(&stuff->hostLength, n);
1064706f2543Smrg    return((* ProcVector[X_ChangeHosts])(client));
1065706f2543Smrg
1066706f2543Smrg}
1067706f2543Smrg
1068706f2543Smrgint SProcRotateProperties (ClientPtr client)
1069706f2543Smrg{
1070706f2543Smrg    char n;
1071706f2543Smrg    REQUEST(xRotatePropertiesReq);
1072706f2543Smrg    swaps(&stuff->length, n);
1073706f2543Smrg    REQUEST_AT_LEAST_SIZE(xRotatePropertiesReq);
1074706f2543Smrg    swapl(&stuff->window, n);
1075706f2543Smrg    swaps(&stuff->nAtoms, n);
1076706f2543Smrg    swaps(&stuff->nPositions, n);
1077706f2543Smrg    SwapRestL(stuff);
1078706f2543Smrg    return ((* ProcVector[X_RotateProperties])(client));
1079706f2543Smrg}
1080706f2543Smrg
1081706f2543Smrgint
1082706f2543SmrgSProcNoOperation(ClientPtr client)
1083706f2543Smrg{
1084706f2543Smrg    char n;
1085706f2543Smrg    REQUEST(xReq);
1086706f2543Smrg    swaps(&stuff->length, n);
1087706f2543Smrg    return ((* ProcVector[X_NoOperation])(client));
1088706f2543Smrg}
1089706f2543Smrg
1090706f2543Smrgvoid
1091706f2543SmrgSwapConnClientPrefix(xConnClientPrefix *pCCP)
1092706f2543Smrg{
1093706f2543Smrg    char n;
1094706f2543Smrg
1095706f2543Smrg    swaps(&pCCP->majorVersion, n);
1096706f2543Smrg    swaps(&pCCP->minorVersion, n);
1097706f2543Smrg    swaps(&pCCP->nbytesAuthProto, n);
1098706f2543Smrg    swaps(&pCCP->nbytesAuthString, n);
1099706f2543Smrg}
1100