1 /************************************************************
3 Copyright 1987, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
26 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
30 Permission to use, copy, modify, and distribute this software and its
31 documentation for any purpose and without fee is hereby granted,
32 provided that the above copyright notice appear in all copies and that
33 both that copyright notice and this permission notice appear in
34 supporting documentation, and that the name of Digital not be
35 used in advertising or publicity pertaining to distribution of the
36 software without specific, written prior permission.
38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 ********************************************************/
49 #ifdef HAVE_DIX_CONFIG_H
50 #include <dix-config.h>
56 #include <X11/Xproto.h>
58 #include "dixstruct.h"
59 #include <X11/fonts/fontstruct.h>
60 #include "scrnintstr.h"
64 static void SwapFontInfo(xQueryFontReply
*pr
);
66 static void SwapCharInfo(xCharInfo
*pInfo
);
68 static void SwapFont(xQueryFontReply
*pr
, Bool hasGlyphs
);
71 * Thanks to Jack Palevich for testing and subsequently rewriting all this
73 * \param size size in bytes
76 Swap32Write(ClientPtr pClient
, int size
, CARD32
*pbuf
)
82 for(i
= 0; i
< size
; i
++)
83 /* brackets are mandatory here, because "swapl" macro expands
84 to several statements */
88 (void)WriteToClient(pClient
, size
<< 2, (char *) pbuf
);
93 * \param size size in bytes
96 CopySwap32Write(ClientPtr pClient
, int size
, CARD32
*pbuf
)
100 CARD32
*from
, *to
, *fromLast
, *toLast
;
103 /* Allocate as big a buffer as we can... */
104 while (!(pbufT
= (CARD32
*) ALLOCATE_LOCAL(bufsize
)))
114 /* convert lengths from # of bytes to # of longs */
119 fromLast
= from
+ size
;
120 while (from
< fromLast
) {
123 toLast
= to
+ min (bufsize
, fromLast
- from
);
124 nbytes
= (toLast
- to
) << 2;
125 while (to
< toLast
) {
126 /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro
127 that evaulates its args more than once */
132 (void)WriteToClient (pClient
, nbytes
, (char *) pbufT
);
136 DEALLOCATE_LOCAL ((char *) pbufT
);
141 * \param size size in bytes
144 CopySwap16Write(ClientPtr pClient
, int size
, short *pbuf
)
148 short *from
, *to
, *fromLast
, *toLast
;
151 /* Allocate as big a buffer as we can... */
152 while (!(pbufT
= (short *) ALLOCATE_LOCAL(bufsize
)))
162 /* convert lengths from # of bytes to # of shorts */
167 fromLast
= from
+ size
;
168 while (from
< fromLast
) {
171 toLast
= to
+ min (bufsize
, fromLast
- from
);
172 nbytes
= (toLast
- to
) << 1;
173 while (to
< toLast
) {
174 /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro
175 that evaulates its args more than once */
180 (void)WriteToClient (pClient
, nbytes
, (char *) pbufT
);
184 DEALLOCATE_LOCAL ((char *) pbufT
);
188 /* Extra-small reply */
190 SGenericReply(ClientPtr pClient
, int size
, xGenericReply
*pRep
)
194 swaps(&pRep
->sequenceNumber
, n
);
195 (void)WriteToClient(pClient
, size
, (char *) pRep
);
198 /* Extra-large reply */
200 SGetWindowAttributesReply(ClientPtr pClient
, int size
,
201 xGetWindowAttributesReply
*pRep
)
205 swaps(&pRep
->sequenceNumber
, n
);
206 swapl(&pRep
->length
, n
);
207 swapl(&pRep
->visualID
, n
);
208 swaps(&pRep
->class, n
);
209 swapl(&pRep
->backingBitPlanes
, n
);
210 swapl(&pRep
->backingPixel
, n
);
211 swapl(&pRep
->colormap
, n
);
212 swapl(&pRep
->allEventMasks
, n
);
213 swapl(&pRep
->yourEventMask
, n
);
214 swaps(&pRep
->doNotPropagateMask
, n
);
215 (void)WriteToClient(pClient
, size
, (char *) pRep
);
219 SGetGeometryReply(ClientPtr pClient
, int size
, xGetGeometryReply
*pRep
)
223 swaps(&pRep
->sequenceNumber
, n
);
224 swapl(&pRep
->root
, n
);
227 swaps(&pRep
->width
, n
);
228 swaps(&pRep
->height
, n
);
229 swaps(&pRep
->borderWidth
, n
);
230 (void)WriteToClient(pClient
, size
, (char *) pRep
);
234 SQueryTreeReply(ClientPtr pClient
, int size
, xQueryTreeReply
*pRep
)
238 swaps(&pRep
->sequenceNumber
, n
);
239 swapl(&pRep
->length
, n
);
240 swapl(&pRep
->root
, n
);
241 swapl(&pRep
->parent
, n
);
242 swaps(&pRep
->nChildren
, n
);
243 (void)WriteToClient(pClient
, size
, (char *) pRep
);
247 SInternAtomReply(ClientPtr pClient
, int size
, xInternAtomReply
*pRep
)
251 swaps(&pRep
->sequenceNumber
, n
);
252 swapl(&pRep
->atom
, n
);
253 (void)WriteToClient(pClient
, size
, (char *) pRep
);
257 SGetAtomNameReply(ClientPtr pClient
, int size
, xGetAtomNameReply
*pRep
)
261 swaps(&pRep
->sequenceNumber
, n
);
262 swapl(&pRep
->length
, n
);
263 swaps(&pRep
->nameLength
, n
);
264 (void)WriteToClient(pClient
, size
, (char *) pRep
);
269 SGetPropertyReply(ClientPtr pClient
, int size
, xGetPropertyReply
*pRep
)
273 swaps(&pRep
->sequenceNumber
, n
);
274 swapl(&pRep
->length
, n
);
275 swapl(&pRep
->propertyType
, n
);
276 swapl(&pRep
->bytesAfter
, n
);
277 swapl(&pRep
->nItems
, n
);
278 (void)WriteToClient(pClient
, size
, (char *) pRep
);
282 SListPropertiesReply(ClientPtr pClient
, int size
, xListPropertiesReply
*pRep
)
286 swaps(&pRep
->sequenceNumber
, n
);
287 swapl(&pRep
->length
, n
);
288 swaps(&pRep
->nProperties
, n
);
289 (void)WriteToClient(pClient
, size
, (char *) pRep
);
293 SGetSelectionOwnerReply(ClientPtr pClient
, int size
,
294 xGetSelectionOwnerReply
*pRep
)
298 swaps(&pRep
->sequenceNumber
, n
);
299 swapl(&pRep
->owner
, n
);
300 (void)WriteToClient(pClient
, size
, (char *) pRep
);
305 SQueryPointerReply(ClientPtr pClient
, int size
, xQueryPointerReply
*pRep
)
309 swaps(&pRep
->sequenceNumber
, n
);
310 swapl(&pRep
->root
, n
);
311 swapl(&pRep
->child
, n
);
312 swaps(&pRep
->rootX
, n
);
313 swaps(&pRep
->rootY
, n
);
314 swaps(&pRep
->winX
, n
);
315 swaps(&pRep
->winY
, n
);
316 swaps(&pRep
->mask
, n
);
317 (void)WriteToClient(pClient
, size
, (char *) pRep
);
321 SwapTimecoord(xTimecoord
* pCoord
)
325 swapl(&pCoord
->time
, n
);
326 swaps(&pCoord
->x
, n
);
327 swaps(&pCoord
->y
, n
);
331 SwapTimeCoordWrite(ClientPtr pClient
, int size
, xTimecoord
*pRep
)
336 n
= size
/ sizeof(xTimecoord
);
338 for(i
= 0; i
< n
; i
++)
340 SwapTimecoord(pRepT
);
343 (void)WriteToClient(pClient
, size
, (char *) pRep
);
347 SGetMotionEventsReply(ClientPtr pClient
, int size
, xGetMotionEventsReply
*pRep
)
351 swaps(&pRep
->sequenceNumber
, n
);
352 swapl(&pRep
->length
, n
);
353 swapl(&pRep
->nEvents
, n
);
354 (void)WriteToClient(pClient
, size
, (char *) pRep
);
358 STranslateCoordsReply(ClientPtr pClient
, int size
, xTranslateCoordsReply
*pRep
)
362 swaps(&pRep
->sequenceNumber
, n
);
363 swapl(&pRep
->child
, n
);
364 swaps(&pRep
->dstX
, n
);
365 swaps(&pRep
->dstY
, n
);
366 (void)WriteToClient(pClient
, size
, (char *) pRep
);
370 SGetInputFocusReply(ClientPtr pClient
, int size
, xGetInputFocusReply
*pRep
)
374 swaps(&pRep
->sequenceNumber
, n
);
375 swapl(&pRep
->focus
, n
);
376 (void)WriteToClient(pClient
, size
, (char *) pRep
);
379 /* extra long reply */
381 SQueryKeymapReply(ClientPtr pClient
, int size
, xQueryKeymapReply
*pRep
)
385 swaps(&pRep
->sequenceNumber
, n
);
386 swapl(&pRep
->length
, n
);
387 (void)WriteToClient(pClient
, size
, (char *) pRep
);
391 SwapCharInfo(xCharInfo
*pInfo
)
395 swaps(&pInfo
->leftSideBearing
, n
);
396 swaps(&pInfo
->rightSideBearing
, n
);
397 swaps(&pInfo
->characterWidth
, n
);
398 swaps(&pInfo
->ascent
, n
);
399 swaps(&pInfo
->descent
, n
);
400 swaps(&pInfo
->attributes
, n
);
404 SwapFontInfo(xQueryFontReply
*pr
)
408 swaps(&pr
->minCharOrByte2
, n
);
409 swaps(&pr
->maxCharOrByte2
, n
);
410 swaps(&pr
->defaultChar
, n
);
411 swaps(&pr
->nFontProps
, n
);
412 swaps(&pr
->fontAscent
, n
);
413 swaps(&pr
->fontDescent
, n
);
414 SwapCharInfo( &pr
->minBounds
);
415 SwapCharInfo( &pr
->maxBounds
);
416 swapl(&pr
->nCharInfos
, n
);
420 SwapFont(xQueryFontReply
*pr
, Bool hasGlyphs
)
424 unsigned nchars
, nprops
;
428 swaps(&pr
->sequenceNumber
, n
);
429 swapl(&pr
->length
, n
);
430 nchars
= pr
->nCharInfos
;
431 nprops
= pr
->nFontProps
;
433 pby
= (char *) &pr
[1];
434 /* Font properties are an atom and either an int32 or a CARD32, so
435 * they are always 2 4 byte values */
436 for(i
= 0; i
< nprops
; i
++)
445 pxci
= (xCharInfo
*)pby
;
446 for(i
= 0; i
< nchars
; i
++, pxci
++)
452 SQueryFontReply(ClientPtr pClient
, int size
, xQueryFontReply
*pRep
)
454 SwapFont(pRep
, TRUE
);
455 (void)WriteToClient(pClient
, size
, (char *) pRep
);
459 SQueryTextExtentsReply(ClientPtr pClient
, int size
, xQueryTextExtentsReply
*pRep
)
463 swaps(&pRep
->sequenceNumber
, n
);
464 swaps(&pRep
->fontAscent
, n
);
465 swaps(&pRep
->fontDescent
, n
);
466 swaps(&pRep
->overallAscent
, n
);
467 swaps(&pRep
->overallDescent
, n
);
468 swapl(&pRep
->overallWidth
, n
);
469 swapl(&pRep
->overallLeft
, n
);
470 swapl(&pRep
->overallRight
, n
);
471 (void)WriteToClient(pClient
, size
, (char *) pRep
);
475 SListFontsReply(ClientPtr pClient
, int size
, xListFontsReply
*pRep
)
479 swaps(&pRep
->sequenceNumber
, n
);
480 swapl(&pRep
->length
, n
);
481 swaps(&pRep
->nFonts
, n
);
482 (void)WriteToClient(pClient
, size
, (char *) pRep
);
486 SListFontsWithInfoReply(ClientPtr pClient
, int size
,
487 xListFontsWithInfoReply
*pRep
)
489 SwapFont((xQueryFontReply
*)pRep
, FALSE
);
490 (void)WriteToClient(pClient
, size
, (char *) pRep
);
494 SGetFontPathReply(ClientPtr pClient
, int size
, xGetFontPathReply
*pRep
)
498 swaps(&pRep
->sequenceNumber
, n
);
499 swapl(&pRep
->length
, n
);
500 swaps(&pRep
->nPaths
, n
);
501 (void)WriteToClient(pClient
, size
, (char *) pRep
);
505 SGetImageReply(ClientPtr pClient
, int size
, xGetImageReply
*pRep
)
509 swaps(&pRep
->sequenceNumber
, n
);
510 swapl(&pRep
->length
, n
);
511 swapl(&pRep
->visual
, n
);
512 (void)WriteToClient(pClient
, size
, (char *) pRep
);
513 /* Fortunately, image doesn't need swapping */
517 SListInstalledColormapsReply(ClientPtr pClient
, int size
,
518 xListInstalledColormapsReply
*pRep
)
522 swaps(&pRep
->sequenceNumber
, n
);
523 swapl(&pRep
->length
, n
);
524 swaps(&pRep
->nColormaps
, n
);
525 (void)WriteToClient(pClient
, size
, (char *) pRep
);
529 SAllocColorReply(pClient
, size
, pRep
)
532 xAllocColorReply
*pRep
;
536 swaps(&pRep
->sequenceNumber
, n
);
537 swaps(&pRep
->red
, n
);
538 swaps(&pRep
->green
, n
);
539 swaps(&pRep
->blue
, n
);
540 swapl(&pRep
->pixel
, n
);
541 (void)WriteToClient(pClient
, size
, (char *) pRep
);
545 SAllocNamedColorReply(ClientPtr pClient
, int size
, xAllocNamedColorReply
*pRep
)
549 swaps(&pRep
->sequenceNumber
, n
);
550 swapl(&pRep
->pixel
, n
);
551 swaps(&pRep
->exactRed
, n
);
552 swaps(&pRep
->exactGreen
, n
);
553 swaps(&pRep
->exactBlue
, n
);
554 swaps(&pRep
->screenRed
, n
);
555 swaps(&pRep
->screenGreen
, n
);
556 swaps(&pRep
->screenBlue
, n
);
557 (void)WriteToClient(pClient
, size
, (char *) pRep
);
561 SAllocColorCellsReply(ClientPtr pClient
, int size
, xAllocColorCellsReply
*pRep
)
565 swaps(&pRep
->sequenceNumber
, n
);
566 swapl(&pRep
->length
, n
);
567 swaps(&pRep
->nPixels
, n
);
568 swaps(&pRep
->nMasks
, n
);
569 (void)WriteToClient(pClient
, size
, (char *) pRep
);
574 SAllocColorPlanesReply(ClientPtr pClient
, int size
, xAllocColorPlanesReply
*pRep
)
578 swaps(&pRep
->sequenceNumber
, n
);
579 swapl(&pRep
->length
, n
);
580 swaps(&pRep
->nPixels
, n
);
581 swapl(&pRep
->redMask
, n
);
582 swapl(&pRep
->greenMask
, n
);
583 swapl(&pRep
->blueMask
, n
);
584 (void)WriteToClient(pClient
, size
, (char *) pRep
);
592 swaps(&prgb
->red
, n
);
593 swaps(&prgb
->green
, n
);
594 swaps(&prgb
->blue
, n
);
598 SQColorsExtend(ClientPtr pClient
, int size
, xrgb
*prgb
)
603 n
= size
/ sizeof(xrgb
);
605 for(i
= 0; i
< n
; i
++)
610 (void)WriteToClient(pClient
, size
, (char *) prgb
);
614 SQueryColorsReply(ClientPtr pClient
, int size
, xQueryColorsReply
* pRep
)
618 swaps(&pRep
->sequenceNumber
, n
);
619 swapl(&pRep
->length
, n
);
620 swaps(&pRep
->nColors
, n
);
621 (void)WriteToClient(pClient
, size
, (char *) pRep
);
625 SLookupColorReply(ClientPtr pClient
, int size
, xLookupColorReply
*pRep
)
629 swaps(&pRep
->sequenceNumber
, n
);
630 swaps(&pRep
->exactRed
, n
);
631 swaps(&pRep
->exactGreen
, n
);
632 swaps(&pRep
->exactBlue
, n
);
633 swaps(&pRep
->screenRed
, n
);
634 swaps(&pRep
->screenGreen
, n
);
635 swaps(&pRep
->screenBlue
, n
);
636 (void)WriteToClient(pClient
, size
, (char *) pRep
);
640 SQueryBestSizeReply(ClientPtr pClient
, int size
, xQueryBestSizeReply
*pRep
)
644 swaps(&pRep
->sequenceNumber
, n
);
645 swaps(&pRep
->width
, n
);
646 swaps(&pRep
->height
, n
);
647 (void)WriteToClient(pClient
, size
, (char *) pRep
);
651 SListExtensionsReply(ClientPtr pClient
, int size
, xListExtensionsReply
*pRep
)
655 swaps(&pRep
->sequenceNumber
, n
);
656 swapl(&pRep
->length
, n
);
657 (void)WriteToClient(pClient
, size
, (char *) pRep
);
661 SGetKeyboardMappingReply(ClientPtr pClient
, int size
,
662 xGetKeyboardMappingReply
*pRep
)
666 swaps(&pRep
->sequenceNumber
, n
);
667 swapl(&pRep
->length
, n
);
668 (void)WriteToClient(pClient
, size
, (char *) pRep
);
672 SGetPointerMappingReply(ClientPtr pClient
, int size
,
673 xGetPointerMappingReply
*pRep
)
677 swaps(&pRep
->sequenceNumber
, n
);
678 swapl(&pRep
->length
, n
);
679 (void)WriteToClient(pClient
, size
, (char *) pRep
);
683 SGetModifierMappingReply(ClientPtr pClient
, int size
,
684 xGetModifierMappingReply
*pRep
)
688 swaps(&pRep
->sequenceNumber
, n
);
689 swapl(&pRep
->length
, n
);
690 (void)WriteToClient(pClient
, size
, (char *) pRep
);
694 SGetKeyboardControlReply(ClientPtr pClient
, int size
, xGetKeyboardControlReply
*pRep
)
698 swaps(&pRep
->sequenceNumber
, n
);
699 swapl(&pRep
->length
, n
);
700 swapl(&pRep
->ledMask
, n
);
701 swaps(&pRep
->bellPitch
, n
);
702 swaps(&pRep
->bellDuration
, n
);
703 (void)WriteToClient(pClient
, size
, (char *) pRep
);
707 SGetPointerControlReply(ClientPtr pClient
, int size
, xGetPointerControlReply
*pRep
)
711 swaps(&pRep
->sequenceNumber
, n
);
712 swaps(&pRep
->accelNumerator
, n
);
713 swaps(&pRep
->accelDenominator
, n
);
714 swaps(&pRep
->threshold
, n
);
715 (void)WriteToClient(pClient
, size
, (char *) pRep
);
719 SGetScreenSaverReply(ClientPtr pClient
, int size
, xGetScreenSaverReply
*pRep
)
723 swaps(&pRep
->sequenceNumber
, n
);
724 swaps(&pRep
->timeout
, n
);
725 swaps(&pRep
->interval
, n
);
726 (void)WriteToClient(pClient
, size
, (char *) pRep
);
730 SLHostsExtend(ClientPtr pClient
, int size
, char *buf
)
733 char *endbuf
= buf
+ size
;
734 while (bufT
< endbuf
) {
735 xHostEntry
*host
= (xHostEntry
*) bufT
;
736 int len
= host
->length
;
738 swaps (&host
->length
, n
);
739 bufT
+= sizeof (xHostEntry
) + (((len
+ 3) >> 2) << 2);
741 (void)WriteToClient (pClient
, size
, buf
);
745 SListHostsReply(ClientPtr pClient
, int size
, xListHostsReply
*pRep
)
749 swaps(&pRep
->sequenceNumber
, n
);
750 swapl(&pRep
->length
, n
);
751 swaps(&pRep
->nHosts
, n
);
752 (void)WriteToClient(pClient
, size
, (char *) pRep
);
758 SErrorEvent(xError
*from
, xError
*to
)
761 to
->errorCode
= from
->errorCode
;
762 cpswaps(from
->sequenceNumber
, to
->sequenceNumber
);
763 cpswapl(from
->resourceID
, to
->resourceID
);
764 cpswaps(from
->minorCode
, to
->minorCode
);
765 to
->majorCode
= from
->majorCode
;
769 SKeyButtonPtrEvent(xEvent
*from
, xEvent
*to
)
771 to
->u
.u
.type
= from
->u
.u
.type
;
772 to
->u
.u
.detail
= from
->u
.u
.detail
;
773 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
774 cpswapl(from
->u
.keyButtonPointer
.time
,
775 to
->u
.keyButtonPointer
.time
);
776 cpswapl(from
->u
.keyButtonPointer
.root
,
777 to
->u
.keyButtonPointer
.root
);
778 cpswapl(from
->u
.keyButtonPointer
.event
,
779 to
->u
.keyButtonPointer
.event
);
780 cpswapl(from
->u
.keyButtonPointer
.child
,
781 to
->u
.keyButtonPointer
.child
);
782 cpswaps(from
->u
.keyButtonPointer
.rootX
,
783 to
->u
.keyButtonPointer
.rootX
);
784 cpswaps(from
->u
.keyButtonPointer
.rootY
,
785 to
->u
.keyButtonPointer
.rootY
);
786 cpswaps(from
->u
.keyButtonPointer
.eventX
,
787 to
->u
.keyButtonPointer
.eventX
);
788 cpswaps(from
->u
.keyButtonPointer
.eventY
,
789 to
->u
.keyButtonPointer
.eventY
);
790 cpswaps(from
->u
.keyButtonPointer
.state
,
791 to
->u
.keyButtonPointer
.state
);
792 to
->u
.keyButtonPointer
.sameScreen
=
793 from
->u
.keyButtonPointer
.sameScreen
;
797 SEnterLeaveEvent(xEvent
*from
, xEvent
*to
)
799 to
->u
.u
.type
= from
->u
.u
.type
;
800 to
->u
.u
.detail
= from
->u
.u
.detail
;
801 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
802 cpswapl(from
->u
.enterLeave
.time
, to
->u
.enterLeave
.time
);
803 cpswapl(from
->u
.enterLeave
.root
, to
->u
.enterLeave
.root
);
804 cpswapl(from
->u
.enterLeave
.event
, to
->u
.enterLeave
.event
);
805 cpswapl(from
->u
.enterLeave
.child
, to
->u
.enterLeave
.child
);
806 cpswaps(from
->u
.enterLeave
.rootX
, to
->u
.enterLeave
.rootX
);
807 cpswaps(from
->u
.enterLeave
.rootY
, to
->u
.enterLeave
.rootY
);
808 cpswaps(from
->u
.enterLeave
.eventX
, to
->u
.enterLeave
.eventX
);
809 cpswaps(from
->u
.enterLeave
.eventY
, to
->u
.enterLeave
.eventY
);
810 cpswaps(from
->u
.enterLeave
.state
, to
->u
.enterLeave
.state
);
811 to
->u
.enterLeave
.mode
= from
->u
.enterLeave
.mode
;
812 to
->u
.enterLeave
.flags
= from
->u
.enterLeave
.flags
;
816 SFocusEvent(xEvent
*from
, xEvent
*to
)
818 to
->u
.u
.type
= from
->u
.u
.type
;
819 to
->u
.u
.detail
= from
->u
.u
.detail
;
820 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
821 cpswapl(from
->u
.focus
.window
, to
->u
.focus
.window
);
822 to
->u
.focus
.mode
= from
->u
.focus
.mode
;
826 SExposeEvent(xEvent
*from
, xEvent
*to
)
828 to
->u
.u
.type
= from
->u
.u
.type
;
829 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
830 cpswapl(from
->u
.expose
.window
, to
->u
.expose
.window
);
831 cpswaps(from
->u
.expose
.x
, to
->u
.expose
.x
);
832 cpswaps(from
->u
.expose
.y
, to
->u
.expose
.y
);
833 cpswaps(from
->u
.expose
.width
, to
->u
.expose
.width
);
834 cpswaps(from
->u
.expose
.height
, to
->u
.expose
.height
);
835 cpswaps(from
->u
.expose
.count
, to
->u
.expose
.count
);
839 SGraphicsExposureEvent(xEvent
*from
, xEvent
*to
)
841 to
->u
.u
.type
= from
->u
.u
.type
;
842 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
843 cpswapl(from
->u
.graphicsExposure
.drawable
,
844 to
->u
.graphicsExposure
.drawable
);
845 cpswaps(from
->u
.graphicsExposure
.x
,
846 to
->u
.graphicsExposure
.x
);
847 cpswaps(from
->u
.graphicsExposure
.y
,
848 to
->u
.graphicsExposure
.y
);
849 cpswaps(from
->u
.graphicsExposure
.width
,
850 to
->u
.graphicsExposure
.width
);
851 cpswaps(from
->u
.graphicsExposure
.height
,
852 to
->u
.graphicsExposure
.height
);
853 cpswaps(from
->u
.graphicsExposure
.minorEvent
,
854 to
->u
.graphicsExposure
.minorEvent
);
855 cpswaps(from
->u
.graphicsExposure
.count
,
856 to
->u
.graphicsExposure
.count
);
857 to
->u
.graphicsExposure
.majorEvent
=
858 from
->u
.graphicsExposure
.majorEvent
;
862 SNoExposureEvent(xEvent
*from
, xEvent
*to
)
864 to
->u
.u
.type
= from
->u
.u
.type
;
865 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
866 cpswapl(from
->u
.noExposure
.drawable
, to
->u
.noExposure
.drawable
);
867 cpswaps(from
->u
.noExposure
.minorEvent
, to
->u
.noExposure
.minorEvent
);
868 to
->u
.noExposure
.majorEvent
= from
->u
.noExposure
.majorEvent
;
872 SVisibilityEvent(xEvent
*from
, xEvent
*to
)
874 to
->u
.u
.type
= from
->u
.u
.type
;
875 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
876 cpswapl(from
->u
.visibility
.window
, to
->u
.visibility
.window
);
877 to
->u
.visibility
.state
= from
->u
.visibility
.state
;
881 SCreateNotifyEvent(xEvent
*from
, xEvent
*to
)
883 to
->u
.u
.type
= from
->u
.u
.type
;
884 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
885 cpswapl(from
->u
.createNotify
.window
, to
->u
.createNotify
.window
);
886 cpswapl(from
->u
.createNotify
.parent
, to
->u
.createNotify
.parent
);
887 cpswaps(from
->u
.createNotify
.x
, to
->u
.createNotify
.x
);
888 cpswaps(from
->u
.createNotify
.y
, to
->u
.createNotify
.y
);
889 cpswaps(from
->u
.createNotify
.width
, to
->u
.createNotify
.width
);
890 cpswaps(from
->u
.createNotify
.height
, to
->u
.createNotify
.height
);
891 cpswaps(from
->u
.createNotify
.borderWidth
,
892 to
->u
.createNotify
.borderWidth
);
893 to
->u
.createNotify
.override
= from
->u
.createNotify
.override
;
897 SDestroyNotifyEvent(xEvent
*from
, xEvent
*to
)
899 to
->u
.u
.type
= from
->u
.u
.type
;
900 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
901 cpswapl(from
->u
.destroyNotify
.event
, to
->u
.destroyNotify
.event
);
902 cpswapl(from
->u
.destroyNotify
.window
, to
->u
.destroyNotify
.window
);
906 SUnmapNotifyEvent(xEvent
*from
, xEvent
*to
)
908 to
->u
.u
.type
= from
->u
.u
.type
;
909 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
910 cpswapl(from
->u
.unmapNotify
.event
, to
->u
.unmapNotify
.event
);
911 cpswapl(from
->u
.unmapNotify
.window
, to
->u
.unmapNotify
.window
);
912 to
->u
.unmapNotify
.fromConfigure
= from
->u
.unmapNotify
.fromConfigure
;
916 SMapNotifyEvent(xEvent
*from
, xEvent
*to
)
918 to
->u
.u
.type
= from
->u
.u
.type
;
919 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
920 cpswapl(from
->u
.mapNotify
.event
, to
->u
.mapNotify
.event
);
921 cpswapl(from
->u
.mapNotify
.window
, to
->u
.mapNotify
.window
);
922 to
->u
.mapNotify
.override
= from
->u
.mapNotify
.override
;
926 SMapRequestEvent(xEvent
*from
, xEvent
*to
)
928 to
->u
.u
.type
= from
->u
.u
.type
;
929 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
930 cpswapl(from
->u
.mapRequest
.parent
, to
->u
.mapRequest
.parent
);
931 cpswapl(from
->u
.mapRequest
.window
, to
->u
.mapRequest
.window
);
935 SReparentEvent(xEvent
*from
, xEvent
*to
)
937 to
->u
.u
.type
= from
->u
.u
.type
;
938 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
939 cpswapl(from
->u
.reparent
.event
, to
->u
.reparent
.event
);
940 cpswapl(from
->u
.reparent
.window
, to
->u
.reparent
.window
);
941 cpswapl(from
->u
.reparent
.parent
, to
->u
.reparent
.parent
);
942 cpswaps(from
->u
.reparent
.x
, to
->u
.reparent
.x
);
943 cpswaps(from
->u
.reparent
.y
, to
->u
.reparent
.y
);
944 to
->u
.reparent
.override
= from
->u
.reparent
.override
;
948 SConfigureNotifyEvent(xEvent
*from
, xEvent
*to
)
950 to
->u
.u
.type
= from
->u
.u
.type
;
951 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
952 cpswapl(from
->u
.configureNotify
.event
,
953 to
->u
.configureNotify
.event
);
954 cpswapl(from
->u
.configureNotify
.window
,
955 to
->u
.configureNotify
.window
);
956 cpswapl(from
->u
.configureNotify
.aboveSibling
,
957 to
->u
.configureNotify
.aboveSibling
);
958 cpswaps(from
->u
.configureNotify
.x
, to
->u
.configureNotify
.x
);
959 cpswaps(from
->u
.configureNotify
.y
, to
->u
.configureNotify
.y
);
960 cpswaps(from
->u
.configureNotify
.width
, to
->u
.configureNotify
.width
);
961 cpswaps(from
->u
.configureNotify
.height
,
962 to
->u
.configureNotify
.height
);
963 cpswaps(from
->u
.configureNotify
.borderWidth
,
964 to
->u
.configureNotify
.borderWidth
);
965 to
->u
.configureNotify
.override
= from
->u
.configureNotify
.override
;
969 SConfigureRequestEvent(xEvent
*from
, xEvent
*to
)
971 to
->u
.u
.type
= from
->u
.u
.type
;
972 to
->u
.u
.detail
= from
->u
.u
.detail
; /* actually stack-mode */
973 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
974 cpswapl(from
->u
.configureRequest
.parent
,
975 to
->u
.configureRequest
.parent
);
976 cpswapl(from
->u
.configureRequest
.window
,
977 to
->u
.configureRequest
.window
);
978 cpswapl(from
->u
.configureRequest
.sibling
,
979 to
->u
.configureRequest
.sibling
);
980 cpswaps(from
->u
.configureRequest
.x
, to
->u
.configureRequest
.x
);
981 cpswaps(from
->u
.configureRequest
.y
, to
->u
.configureRequest
.y
);
982 cpswaps(from
->u
.configureRequest
.width
,
983 to
->u
.configureRequest
.width
);
984 cpswaps(from
->u
.configureRequest
.height
,
985 to
->u
.configureRequest
.height
);
986 cpswaps(from
->u
.configureRequest
.borderWidth
,
987 to
->u
.configureRequest
.borderWidth
);
988 cpswaps(from
->u
.configureRequest
.valueMask
,
989 to
->u
.configureRequest
.valueMask
);
994 SGravityEvent(xEvent
*from
, xEvent
*to
)
996 to
->u
.u
.type
= from
->u
.u
.type
;
997 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
998 cpswapl(from
->u
.gravity
.event
, to
->u
.gravity
.event
);
999 cpswapl(from
->u
.gravity
.window
, to
->u
.gravity
.window
);
1000 cpswaps(from
->u
.gravity
.x
, to
->u
.gravity
.x
);
1001 cpswaps(from
->u
.gravity
.y
, to
->u
.gravity
.y
);
1005 SResizeRequestEvent(xEvent
*from
, xEvent
*to
)
1007 to
->u
.u
.type
= from
->u
.u
.type
;
1008 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1009 cpswapl(from
->u
.resizeRequest
.window
, to
->u
.resizeRequest
.window
);
1010 cpswaps(from
->u
.resizeRequest
.width
, to
->u
.resizeRequest
.width
);
1011 cpswaps(from
->u
.resizeRequest
.height
, to
->u
.resizeRequest
.height
);
1015 SCirculateEvent(xEvent
*from
, xEvent
*to
)
1017 to
->u
.u
.type
= from
->u
.u
.type
;
1018 to
->u
.u
.detail
= from
->u
.u
.detail
;
1019 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1020 cpswapl(from
->u
.circulate
.event
, to
->u
.circulate
.event
);
1021 cpswapl(from
->u
.circulate
.window
, to
->u
.circulate
.window
);
1022 cpswapl(from
->u
.circulate
.parent
, to
->u
.circulate
.parent
);
1023 to
->u
.circulate
.place
= from
->u
.circulate
.place
;
1027 SPropertyEvent(xEvent
*from
, xEvent
*to
)
1029 to
->u
.u
.type
= from
->u
.u
.type
;
1030 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1031 cpswapl(from
->u
.property
.window
, to
->u
.property
.window
);
1032 cpswapl(from
->u
.property
.atom
, to
->u
.property
.atom
);
1033 cpswapl(from
->u
.property
.time
, to
->u
.property
.time
);
1034 to
->u
.property
.state
= from
->u
.property
.state
;
1038 SSelectionClearEvent(xEvent
*from
, xEvent
*to
)
1040 to
->u
.u
.type
= from
->u
.u
.type
;
1041 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1042 cpswapl(from
->u
.selectionClear
.time
, to
->u
.selectionClear
.time
);
1043 cpswapl(from
->u
.selectionClear
.window
, to
->u
.selectionClear
.window
);
1044 cpswapl(from
->u
.selectionClear
.atom
, to
->u
.selectionClear
.atom
);
1048 SSelectionRequestEvent(xEvent
*from
, xEvent
*to
)
1050 to
->u
.u
.type
= from
->u
.u
.type
;
1051 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1052 cpswapl(from
->u
.selectionRequest
.time
, to
->u
.selectionRequest
.time
);
1053 cpswapl(from
->u
.selectionRequest
.owner
,
1054 to
->u
.selectionRequest
.owner
);
1055 cpswapl(from
->u
.selectionRequest
.requestor
,
1056 to
->u
.selectionRequest
.requestor
);
1057 cpswapl(from
->u
.selectionRequest
.selection
,
1058 to
->u
.selectionRequest
.selection
);
1059 cpswapl(from
->u
.selectionRequest
.target
,
1060 to
->u
.selectionRequest
.target
);
1061 cpswapl(from
->u
.selectionRequest
.property
,
1062 to
->u
.selectionRequest
.property
);
1066 SSelectionNotifyEvent(xEvent
*from
, xEvent
*to
)
1068 to
->u
.u
.type
= from
->u
.u
.type
;
1069 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1070 cpswapl(from
->u
.selectionNotify
.time
, to
->u
.selectionNotify
.time
);
1071 cpswapl(from
->u
.selectionNotify
.requestor
,
1072 to
->u
.selectionNotify
.requestor
);
1073 cpswapl(from
->u
.selectionNotify
.selection
,
1074 to
->u
.selectionNotify
.selection
);
1075 cpswapl(from
->u
.selectionNotify
.target
,
1076 to
->u
.selectionNotify
.target
);
1077 cpswapl(from
->u
.selectionNotify
.property
,
1078 to
->u
.selectionNotify
.property
);
1082 SColormapEvent(xEvent
*from
, xEvent
*to
)
1084 to
->u
.u
.type
= from
->u
.u
.type
;
1085 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1086 cpswapl(from
->u
.colormap
.window
, to
->u
.colormap
.window
);
1087 cpswapl(from
->u
.colormap
.colormap
, to
->u
.colormap
.colormap
);
1088 to
->u
.colormap
.new = from
->u
.colormap
.new;
1089 to
->u
.colormap
.state
= from
->u
.colormap
.state
;
1093 SMappingEvent(xEvent
*from
, xEvent
*to
)
1095 to
->u
.u
.type
= from
->u
.u
.type
;
1096 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1097 to
->u
.mappingNotify
.request
= from
->u
.mappingNotify
.request
;
1098 to
->u
.mappingNotify
.firstKeyCode
=
1099 from
->u
.mappingNotify
.firstKeyCode
;
1100 to
->u
.mappingNotify
.count
= from
->u
.mappingNotify
.count
;
1104 SClientMessageEvent(xEvent
*from
, xEvent
*to
)
1106 to
->u
.u
.type
= from
->u
.u
.type
;
1107 to
->u
.u
.detail
= from
->u
.u
.detail
; /* actually format */
1108 cpswaps(from
->u
.u
.sequenceNumber
, to
->u
.u
.sequenceNumber
);
1109 cpswapl(from
->u
.clientMessage
.window
, to
->u
.clientMessage
.window
);
1110 cpswapl(from
->u
.clientMessage
.u
.l
.type
,
1111 to
->u
.clientMessage
.u
.l
.type
);
1112 switch (from
->u
.u
.detail
) {
1114 memmove(to
->u
.clientMessage
.u
.b
.bytes
,
1115 from
->u
.clientMessage
.u
.b
.bytes
,20);
1118 cpswaps(from
->u
.clientMessage
.u
.s
.shorts0
,
1119 to
->u
.clientMessage
.u
.s
.shorts0
);
1120 cpswaps(from
->u
.clientMessage
.u
.s
.shorts1
,
1121 to
->u
.clientMessage
.u
.s
.shorts1
);
1122 cpswaps(from
->u
.clientMessage
.u
.s
.shorts2
,
1123 to
->u
.clientMessage
.u
.s
.shorts2
);
1124 cpswaps(from
->u
.clientMessage
.u
.s
.shorts3
,
1125 to
->u
.clientMessage
.u
.s
.shorts3
);
1126 cpswaps(from
->u
.clientMessage
.u
.s
.shorts4
,
1127 to
->u
.clientMessage
.u
.s
.shorts4
);
1128 cpswaps(from
->u
.clientMessage
.u
.s
.shorts5
,
1129 to
->u
.clientMessage
.u
.s
.shorts5
);
1130 cpswaps(from
->u
.clientMessage
.u
.s
.shorts6
,
1131 to
->u
.clientMessage
.u
.s
.shorts6
);
1132 cpswaps(from
->u
.clientMessage
.u
.s
.shorts7
,
1133 to
->u
.clientMessage
.u
.s
.shorts7
);
1134 cpswaps(from
->u
.clientMessage
.u
.s
.shorts8
,
1135 to
->u
.clientMessage
.u
.s
.shorts8
);
1136 cpswaps(from
->u
.clientMessage
.u
.s
.shorts9
,
1137 to
->u
.clientMessage
.u
.s
.shorts9
);
1140 cpswapl(from
->u
.clientMessage
.u
.l
.longs0
,
1141 to
->u
.clientMessage
.u
.l
.longs0
);
1142 cpswapl(from
->u
.clientMessage
.u
.l
.longs1
,
1143 to
->u
.clientMessage
.u
.l
.longs1
);
1144 cpswapl(from
->u
.clientMessage
.u
.l
.longs2
,
1145 to
->u
.clientMessage
.u
.l
.longs2
);
1146 cpswapl(from
->u
.clientMessage
.u
.l
.longs3
,
1147 to
->u
.clientMessage
.u
.l
.longs3
);
1148 cpswapl(from
->u
.clientMessage
.u
.l
.longs4
,
1149 to
->u
.clientMessage
.u
.l
.longs4
);
1155 SKeymapNotifyEvent(xEvent
*from
, xEvent
*to
)
1157 /* Keymap notify events are special; they have no
1158 sequence number field, and contain entirely 8-bit data */
1163 SwapConnSetup(xConnSetup
*pConnSetup
, xConnSetup
*pConnSetupT
)
1165 cpswapl(pConnSetup
->release
, pConnSetupT
->release
);
1166 cpswapl(pConnSetup
->ridBase
, pConnSetupT
->ridBase
);
1167 cpswapl(pConnSetup
->ridMask
, pConnSetupT
->ridMask
);
1168 cpswapl(pConnSetup
->motionBufferSize
, pConnSetupT
->motionBufferSize
);
1169 cpswaps(pConnSetup
->nbytesVendor
, pConnSetupT
->nbytesVendor
);
1170 cpswaps(pConnSetup
->maxRequestSize
, pConnSetupT
->maxRequestSize
);
1171 pConnSetupT
->minKeyCode
= pConnSetup
->minKeyCode
;
1172 pConnSetupT
->maxKeyCode
= pConnSetup
->maxKeyCode
;
1173 pConnSetupT
->numRoots
= pConnSetup
->numRoots
;
1174 pConnSetupT
->numFormats
= pConnSetup
->numFormats
;
1175 pConnSetupT
->imageByteOrder
= pConnSetup
->imageByteOrder
;
1176 pConnSetupT
->bitmapBitOrder
= pConnSetup
->bitmapBitOrder
;
1177 pConnSetupT
->bitmapScanlineUnit
= pConnSetup
->bitmapScanlineUnit
;
1178 pConnSetupT
->bitmapScanlinePad
= pConnSetup
->bitmapScanlinePad
;
1182 SwapWinRoot(xWindowRoot
*pRoot
, xWindowRoot
*pRootT
)
1184 cpswapl(pRoot
->windowId
, pRootT
->windowId
);
1185 cpswapl(pRoot
->defaultColormap
, pRootT
->defaultColormap
);
1186 cpswapl(pRoot
->whitePixel
, pRootT
->whitePixel
);
1187 cpswapl(pRoot
->blackPixel
, pRootT
->blackPixel
);
1188 cpswapl(pRoot
->currentInputMask
, pRootT
->currentInputMask
);
1189 cpswaps(pRoot
->pixWidth
, pRootT
->pixWidth
);
1190 cpswaps(pRoot
->pixHeight
, pRootT
->pixHeight
);
1191 cpswaps(pRoot
->mmWidth
, pRootT
->mmWidth
);
1192 cpswaps(pRoot
->mmHeight
, pRootT
->mmHeight
);
1193 cpswaps(pRoot
->minInstalledMaps
, pRootT
->minInstalledMaps
);
1194 cpswaps(pRoot
->maxInstalledMaps
, pRootT
->maxInstalledMaps
);
1195 cpswapl(pRoot
->rootVisualID
, pRootT
->rootVisualID
);
1196 pRootT
->backingStore
= pRoot
->backingStore
;
1197 pRootT
->saveUnders
= pRoot
->saveUnders
;
1198 pRootT
->rootDepth
= pRoot
->rootDepth
;
1199 pRootT
->nDepths
= pRoot
->nDepths
;
1203 SwapVisual(xVisualType
*pVis
, xVisualType
*pVisT
)
1205 cpswapl(pVis
->visualID
, pVisT
->visualID
);
1206 pVisT
->class = pVis
->class;
1207 pVisT
->bitsPerRGB
= pVis
->bitsPerRGB
;
1208 cpswaps(pVis
->colormapEntries
, pVisT
->colormapEntries
);
1209 cpswapl(pVis
->redMask
, pVisT
->redMask
);
1210 cpswapl(pVis
->greenMask
, pVisT
->greenMask
);
1211 cpswapl(pVis
->blueMask
, pVisT
->blueMask
);
1221 xConnSetup
*pConnSetup
= (xConnSetup
*)pInfo
;
1225 SwapConnSetup(pConnSetup
, (xConnSetup
*)pInfoT
);
1226 pInfo
+= sizeof(xConnSetup
);
1227 pInfoT
+= sizeof(xConnSetup
);
1229 /* Copy the vendor string */
1230 i
= (pConnSetup
->nbytesVendor
+ 3) & ~3;
1231 memcpy(pInfoT
, pInfo
, i
);
1235 /* The Pixmap formats don't need to be swapped, just copied. */
1236 i
= sizeof(xPixmapFormat
) * pConnSetup
->numFormats
;
1237 memcpy(pInfoT
, pInfo
, i
);
1241 for(i
= 0; i
< pConnSetup
->numRoots
; i
++)
1243 root
= (xWindowRoot
*)pInfo
;
1244 SwapWinRoot(root
, (xWindowRoot
*)pInfoT
);
1245 pInfo
+= sizeof(xWindowRoot
);
1246 pInfoT
+= sizeof(xWindowRoot
);
1248 for(j
= 0; j
< root
->nDepths
; j
++)
1250 depth
= (xDepth
*)pInfo
;
1251 ((xDepth
*)pInfoT
)->depth
= depth
->depth
;
1252 cpswaps(depth
->nVisuals
, ((xDepth
*)pInfoT
)->nVisuals
);
1253 pInfo
+= sizeof(xDepth
);
1254 pInfoT
+= sizeof(xDepth
);
1255 for(k
= 0; k
< depth
->nVisuals
; k
++)
1257 SwapVisual((xVisualType
*)pInfo
, (xVisualType
*)pInfoT
);
1258 pInfo
+= sizeof(xVisualType
);
1259 pInfoT
+= sizeof(xVisualType
);
1266 WriteSConnectionInfo(ClientPtr pClient
, unsigned long size
, char *pInfo
)
1270 pInfoTBase
= (char *) ALLOCATE_LOCAL(size
);
1273 pClient
->noClientException
= -1;
1276 SwapConnSetupInfo(pInfo
, pInfoTBase
);
1277 (void)WriteToClient(pClient
, (int)size
, (char *) pInfoTBase
);
1278 DEALLOCATE_LOCAL(pInfoTBase
);
1282 SwapConnSetupPrefix(xConnSetupPrefix
*pcspFrom
, xConnSetupPrefix
*pcspTo
)
1284 pcspTo
->success
= pcspFrom
->success
;
1285 pcspTo
->lengthReason
= pcspFrom
->lengthReason
;
1286 cpswaps(pcspFrom
->majorVersion
, pcspTo
->majorVersion
);
1287 cpswaps(pcspFrom
->minorVersion
, pcspTo
->minorVersion
);
1288 cpswaps(pcspFrom
->length
, pcspTo
->length
);
1292 WriteSConnSetupPrefix(ClientPtr pClient
, xConnSetupPrefix
*pcsp
)
1294 xConnSetupPrefix cspT
;
1296 SwapConnSetupPrefix(pcsp
, &cspT
);
1297 (void)WriteToClient(pClient
, sizeof(cspT
), (char *) &cspT
);