1 /************************************************************
3 Copyright (c) 1989 X Consortium
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
26 ********************************************************/
28 /* $TOG: shape.c /main/37 1997/05/22 10:11:40 kaleb $ */
33 /* $XFree86: xc/programs/Xserver/Xext/shape.c,v 3.1.2.1 1997/05/23 12:19:34 dawes Exp $ */
41 #include "windowstr.h"
42 #include "scrnintstr.h"
43 #include "pixmapstr.h"
44 #include "extnsionst.h"
45 #include "dixstruct.h"
48 #define _SHAPE_SERVER_ /* don't want Xlib structures */
50 #include "regionstr.h"
53 typedef RegionPtr (*CreateDftPtr)(
54 #if NeedNestedPrototypes
59 static int ShapeFreeClient(
60 #if NeedFunctionPrototypes
65 static int ShapeFreeEvents(
66 #if NeedFunctionPrototypes
71 static void SendShapeNotify(
72 #if NeedFunctionPrototypes
77 static void ShapeResetProc(
78 #if NeedFunctionPrototypes
79 ExtensionEntry * /* extEntry */
82 static void SShapeNotifyEvent(
83 #if NeedFunctionPrototypes
84 xShapeNotifyEvent * /* from */,
85 xShapeNotifyEvent * /* to */
90 #if NeedFunctionPrototypes
91 ClientPtr /* client */,
94 RegionPtr * /* destRgnp */,
95 RegionPtr /* srcRgn */,
99 CreateDftPtr /* create */
103 #if NeedFunctionPrototypes
104 #define CREATE_PROC(func) RegionPtr func(WindowPtr /* pWin */)
106 #define CREATE_PROC(func) RegionPtr func(/* WindowPtr pWin */)
109 static CREATE_PROC(CreateBoundingShape);
110 static CREATE_PROC(CreateClipShape);
114 static DISPATCH_PROC(ProcShapeCombine);
115 static DISPATCH_PROC(ProcShapeDispatch);
116 static DISPATCH_PROC(ProcShapeGetRectangles);
117 static DISPATCH_PROC(ProcShapeInputSelected);
118 static DISPATCH_PROC(ProcShapeMask);
119 static DISPATCH_PROC(ProcShapeOffset);
120 static DISPATCH_PROC(ProcShapeQueryExtents);
121 static DISPATCH_PROC(ProcShapeQueryVersion);
122 static DISPATCH_PROC(ProcShapeRectangles);
123 static DISPATCH_PROC(ProcShapeSelectInput);
124 static DISPATCH_PROC(SProcShapeCombine);
125 static DISPATCH_PROC(SProcShapeDispatch);
126 static DISPATCH_PROC(SProcShapeGetRectangles);
127 static DISPATCH_PROC(SProcShapeInputSelected);
128 static DISPATCH_PROC(SProcShapeMask);
129 static DISPATCH_PROC(SProcShapeOffset);
130 static DISPATCH_PROC(SProcShapeQueryExtents);
131 static DISPATCH_PROC(SProcShapeQueryVersion);
132 static DISPATCH_PROC(SProcShapeRectangles);
133 static DISPATCH_PROC(SProcShapeSelectInput);
135 static unsigned char ShapeReqCode = 0;
136 static int ShapeEventBase = 0;
137 static RESTYPE ClientType, EventType; /* resource types for event masks */
140 * each window has a list of clients requesting
141 * ShapeNotify events. Each client has a resource
142 * for each window it selects ShapeNotify input for,
143 * this resource is used to delete the ShapeNotifyRec
144 * entry from the per-window queue.
147 typedef struct _ShapeEvent *ShapeEventPtr;
149 typedef struct _ShapeEvent {
159 * Called from InitExtensions in main() or from QueryExtension() if the
160 * extension is dynamically loaded.
167 ExtensionEntry *extEntry;
169 ClientType = CreateNewResourceType(ShapeFreeClient);
170 EventType = CreateNewResourceType(ShapeFreeEvents);
171 if (ClientType && EventType &&
172 (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
173 ProcShapeDispatch, SProcShapeDispatch,
174 ShapeResetProc, StandardMinorOpcode)))
176 ShapeReqCode = (unsigned char)extEntry->base;
177 ShapeEventBase = extEntry->eventBase;
178 EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
184 ShapeResetProc (extEntry)
185 ExtensionEntry *extEntry;
190 RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
194 RegionPtr *destRgnp, srcRgn;
197 CreateDftPtr create; /* creates a reasonable *destRgnp */
199 ScreenPtr pScreen = pWin->drawable.pScreen;
201 if (srcRgn && (xoff || yoff))
202 REGION_TRANSLATE(pScreen, srcRgn, xoff, yoff);
206 REGION_DESTROY(pScreen, srcRgn);
212 REGION_DESTROY(pScreen, *destRgnp);
217 if (*destRgnp && srcRgn)
218 REGION_UNION(pScreen, *destRgnp, *destRgnp, srcRgn);
221 if (*destRgnp && srcRgn)
222 REGION_INTERSECT(pScreen, *destRgnp, *destRgnp, srcRgn);
230 *destRgnp = (*create)(pWin);
232 REGION_SUBTRACT(pScreen, *destRgnp, *destRgnp, srcRgn);
236 *destRgnp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
238 REGION_SUBTRACT(pScreen, *destRgnp, srcRgn, *destRgnp);
241 client->errorValue = op;
245 REGION_DESTROY(pScreen, srcRgn);
246 (*pScreen->SetShape) (pWin);
247 SendShapeNotify (pWin, kind);
252 CreateBoundingShape (pWin)
257 extents.x1 = -wBorderWidth (pWin);
258 extents.y1 = -wBorderWidth (pWin);
259 extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
260 extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
261 return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
265 CreateClipShape (pWin)
272 extents.x2 = pWin->drawable.width;
273 extents.y2 = pWin->drawable.height;
274 return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
278 ProcShapeQueryVersion (client)
279 register ClientPtr client;
281 xShapeQueryVersionReply rep;
284 REQUEST_SIZE_MATCH (xShapeQueryVersionReq);
287 rep.sequenceNumber = client->sequence;
288 rep.majorVersion = SHAPE_MAJOR_VERSION;
289 rep.minorVersion = SHAPE_MINOR_VERSION;
290 if (client->swapped) {
291 swaps(&rep.sequenceNumber, n);
292 swapl(&rep.length, n);
293 swaps(&rep.majorVersion, n);
294 swaps(&rep.minorVersion, n);
296 WriteToClient(client, sizeof (xShapeQueryVersionReply), (char *)&rep);
297 return (client->noClientException);
301 * ProcShapeRectangles
306 ProcShapeRectangles (client)
307 register ClientPtr client;
311 REQUEST(xShapeRectanglesReq);
316 CreateDftPtr createDefault;
319 REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
321 pWin = LookupWindow (stuff->dest, client);
324 switch (stuff->destKind) {
327 createDefault = CreateBoundingShape;
331 createDefault = CreateClipShape;
334 client->errorValue = stuff->destKind;
337 if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
338 (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
340 client->errorValue = stuff->ordering;
343 pScreen = pWin->drawable.pScreen;
344 nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
348 prects = (xRectangle *) &stuff[1];
349 ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering);
352 srcRgn = RECTS_TO_REGION(pScreen, nrects, prects, ctype);
355 MakeWindowOptional (pWin);
357 destRgn = &pWin->optional->boundingShape;
359 destRgn = &pWin->optional->clipShape;
361 return RegionOperate (client, pWin, (int)stuff->destKind,
362 destRgn, srcRgn, (int)stuff->op,
363 stuff->xOff, stuff->yOff, createDefault);
371 ProcShapeMask (client)
372 register ClientPtr client;
376 REQUEST(xShapeMaskReq);
380 CreateDftPtr createDefault;
383 REQUEST_SIZE_MATCH (xShapeMaskReq);
385 pWin = SecurityLookupWindow (stuff->dest, client, SecurityWriteAccess);
388 switch (stuff->destKind) {
391 createDefault = CreateBoundingShape;
395 createDefault = CreateClipShape;
398 client->errorValue = stuff->destKind;
401 pScreen = pWin->drawable.pScreen;
402 if (stuff->src == None)
405 pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src,
406 RT_PIXMAP, SecurityReadAccess);
409 if (pPixmap->drawable.pScreen != pScreen ||
410 pPixmap->drawable.depth != 1)
412 srcRgn = BITMAP_TO_REGION(pScreen, pPixmap);
418 MakeWindowOptional (pWin);
420 destRgn = &pWin->optional->boundingShape;
422 destRgn = &pWin->optional->clipShape;
424 return RegionOperate (client, pWin, (int)stuff->destKind,
425 destRgn, srcRgn, (int)stuff->op,
426 stuff->xOff, stuff->yOff, createDefault);
434 ProcShapeCombine (client)
435 register ClientPtr client;
437 WindowPtr pSrcWin, pDestWin;
439 REQUEST(xShapeCombineReq);
442 CreateDftPtr createDefault;
443 CreateDftPtr createSrc;
447 REQUEST_SIZE_MATCH (xShapeCombineReq);
449 pDestWin = LookupWindow (stuff->dest, client);
452 if (!pDestWin->optional)
453 MakeWindowOptional (pDestWin);
454 switch (stuff->destKind) {
457 createDefault = CreateBoundingShape;
461 createDefault = CreateClipShape;
464 client->errorValue = stuff->destKind;
467 pScreen = pDestWin->drawable.pScreen;
469 pSrcWin = LookupWindow (stuff->src, client);
472 switch (stuff->srcKind) {
474 srcRgn = wBoundingShape (pSrcWin);
475 createSrc = CreateBoundingShape;
478 srcRgn = wClipShape (pSrcWin);
479 createSrc = CreateClipShape;
482 client->errorValue = stuff->srcKind;
485 if (pSrcWin->drawable.pScreen != pScreen)
491 tmp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
492 REGION_COPY(pScreen, tmp, srcRgn);
495 srcRgn = (*createSrc) (pSrcWin);
497 if (!pDestWin->optional)
498 MakeWindowOptional (pDestWin);
500 destRgn = &pDestWin->optional->boundingShape;
502 destRgn = &pDestWin->optional->clipShape;
504 return RegionOperate (client, pDestWin, (int)stuff->destKind,
505 destRgn, srcRgn, (int)stuff->op,
506 stuff->xOff, stuff->yOff, createDefault);
514 ProcShapeOffset (client)
515 register ClientPtr client;
519 REQUEST(xShapeOffsetReq);
522 REQUEST_SIZE_MATCH (xShapeOffsetReq);
524 pWin = LookupWindow (stuff->dest, client);
527 switch (stuff->destKind) {
529 srcRgn = wBoundingShape (pWin);
532 srcRgn = wClipShape(pWin);
535 client->errorValue = stuff->destKind;
538 pScreen = pWin->drawable.pScreen;
541 REGION_TRANSLATE(pScreen, srcRgn, stuff->xOff, stuff->yOff);
542 (*pScreen->SetShape) (pWin);
544 SendShapeNotify (pWin, (int)stuff->destKind);
549 ProcShapeQueryExtents (client)
550 register ClientPtr client;
552 REQUEST(xShapeQueryExtentsReq);
554 xShapeQueryExtentsReply rep;
555 BoxRec extents, *pExtents;
558 REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
559 pWin = LookupWindow (stuff->window, client);
564 rep.sequenceNumber = client->sequence;
565 rep.boundingShaped = (wBoundingShape(pWin) != 0);
566 rep.clipShaped = (wClipShape(pWin) != 0);
567 if (wBoundingShape(pWin)) {
568 /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
569 pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wBoundingShape(pWin));
572 extents.x1 = -wBorderWidth (pWin);
573 extents.y1 = -wBorderWidth (pWin);
574 extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
575 extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
577 rep.xBoundingShape = extents.x1;
578 rep.yBoundingShape = extents.y1;
579 rep.widthBoundingShape = extents.x2 - extents.x1;
580 rep.heightBoundingShape = extents.y2 - extents.y1;
581 if (wClipShape(pWin)) {
582 /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
583 pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wClipShape(pWin));
588 extents.x2 = pWin->drawable.width;
589 extents.y2 = pWin->drawable.height;
591 rep.xClipShape = extents.x1;
592 rep.yClipShape = extents.y1;
593 rep.widthClipShape = extents.x2 - extents.x1;
594 rep.heightClipShape = extents.y2 - extents.y1;
595 if (client->swapped) {
596 swaps(&rep.sequenceNumber, n);
597 swapl(&rep.length, n);
598 swaps(&rep.xBoundingShape, n);
599 swaps(&rep.yBoundingShape, n);
600 swaps(&rep.widthBoundingShape, n);
601 swaps(&rep.heightBoundingShape, n);
602 swaps(&rep.xClipShape, n);
603 swaps(&rep.yClipShape, n);
604 swaps(&rep.widthClipShape, n);
605 swaps(&rep.heightClipShape, n);
607 WriteToClient(client, sizeof (xShapeQueryExtentsReply), (char *)&rep);
608 return (client->noClientException);
613 ShapeFreeClient (data, id)
617 ShapeEventPtr pShapeEvent;
619 ShapeEventPtr *pHead, pCur, pPrev;
621 pShapeEvent = (ShapeEventPtr) data;
622 pWin = pShapeEvent->window;
623 pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType);
626 for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur=pCur->next)
631 pPrev->next = pShapeEvent->next;
633 *pHead = pShapeEvent->next;
636 xfree ((pointer) pShapeEvent);
642 ShapeFreeEvents (data, id)
646 ShapeEventPtr *pHead, pCur, pNext;
648 pHead = (ShapeEventPtr *) data;
649 for (pCur = *pHead; pCur; pCur = pNext) {
651 FreeResource (pCur->clientResource, ClientType);
652 xfree ((pointer) pCur);
654 xfree ((pointer) pHead);
659 ProcShapeSelectInput (client)
660 register ClientPtr client;
662 REQUEST(xShapeSelectInputReq);
664 ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
667 REQUEST_SIZE_MATCH (xShapeSelectInputReq);
668 pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess);
671 pHead = (ShapeEventPtr *)SecurityLookupIDByType(client,
672 pWin->drawable.id, EventType, SecurityWriteAccess);
673 switch (stuff->enable) {
677 /* check for existing entry. */
678 for (pShapeEvent = *pHead;
680 pShapeEvent = pShapeEvent->next)
682 if (pShapeEvent->client == client)
687 /* build the entry */
688 pNewShapeEvent = (ShapeEventPtr)
689 xalloc (sizeof (ShapeEventRec));
692 pNewShapeEvent->next = 0;
693 pNewShapeEvent->client = client;
694 pNewShapeEvent->window = pWin;
696 * add a resource that will be deleted when
697 * the client goes away
699 clientResource = FakeClientID (client->index);
700 pNewShapeEvent->clientResource = clientResource;
701 if (!AddResource (clientResource, ClientType, (pointer)pNewShapeEvent))
704 * create a resource to contain a pointer to the list
705 * of clients selecting input. This must be indirect as
706 * the list may be arbitrarily rearranged which cannot be
707 * done through the resource database.
711 pHead = (ShapeEventPtr *) xalloc (sizeof (ShapeEventPtr));
713 !AddResource (pWin->drawable.id, EventType, (pointer)pHead))
715 FreeResource (clientResource, RT_NONE);
720 pNewShapeEvent->next = *pHead;
721 *pHead = pNewShapeEvent;
724 /* delete the interest */
727 for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
728 if (pShapeEvent->client == client)
730 pNewShapeEvent = pShapeEvent;
733 FreeResource (pShapeEvent->clientResource, ClientType);
735 pNewShapeEvent->next = pShapeEvent->next;
737 *pHead = pShapeEvent->next;
743 client->errorValue = stuff->enable;
754 SendShapeNotify (pWin, which)
758 ShapeEventPtr *pHead, pShapeEvent;
760 xShapeNotifyEvent se;
765 pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType);
768 if (which == ShapeBounding) {
769 region = wBoundingShape(pWin);
771 extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
774 extents.x1 = -wBorderWidth (pWin);
775 extents.y1 = -wBorderWidth (pWin);
776 extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
777 extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
781 region = wClipShape(pWin);
783 extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
788 extents.x2 = pWin->drawable.width;
789 extents.y2 = pWin->drawable.height;
793 for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
794 client = pShapeEvent->client;
795 if (client == serverClient || client->clientGone)
797 se.type = ShapeNotify + ShapeEventBase;
799 se.window = pWin->drawable.id;
800 se.sequenceNumber = client->sequence;
803 se.width = extents.x2 - extents.x1;
804 se.height = extents.y2 - extents.y1;
805 se.time = currentTime.milliseconds;
807 WriteEventsToClient (client, 1, (xEvent *) &se);
812 ProcShapeInputSelected (client)
813 register ClientPtr client;
815 REQUEST(xShapeInputSelectedReq);
817 ShapeEventPtr pShapeEvent, *pHead;
819 xShapeInputSelectedReply rep;
822 REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
823 pWin = LookupWindow (stuff->window, client);
826 pHead = (ShapeEventPtr *) SecurityLookupIDByType(client,
827 pWin->drawable.id, EventType, SecurityReadAccess);
830 for (pShapeEvent = *pHead;
832 pShapeEvent = pShapeEvent->next)
834 if (pShapeEvent->client == client) {
842 rep.sequenceNumber = client->sequence;
843 rep.enabled = enabled;
844 if (client->swapped) {
845 swaps (&rep.sequenceNumber, n);
846 swapl (&rep.length, n);
848 WriteToClient (client, sizeof (xShapeInputSelectedReply), (char *) &rep);
849 return (client->noClientException);
853 ProcShapeGetRectangles (client)
854 register ClientPtr client;
856 REQUEST(xShapeGetRectanglesReq);
858 xShapeGetRectanglesReply rep;
864 REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
865 pWin = LookupWindow (stuff->window, client);
868 switch (stuff->kind) {
870 region = wBoundingShape(pWin);
873 region = wClipShape(pWin);
876 client->errorValue = stuff->kind;
881 rects = (xRectangle *) ALLOCATE_LOCAL (sizeof (xRectangle));
884 switch (stuff->kind) {
886 rects->x = - (int) wBorderWidth (pWin);
887 rects->y = - (int) wBorderWidth (pWin);
888 rects->width = pWin->drawable.width + wBorderWidth (pWin);
889 rects->height = pWin->drawable.height + wBorderWidth (pWin);
894 rects->width = pWin->drawable.width;
895 rects->height = pWin->drawable.height;
900 nrects = REGION_NUM_RECTS(region);
901 box = REGION_RECTS(region);
902 rects = (xRectangle *) ALLOCATE_LOCAL (nrects * sizeof (xRectangle));
903 if (!rects && nrects)
905 for (i = 0; i < nrects; i++, box++) {
906 rects[i].x = box->x1;
907 rects[i].y = box->y1;
908 rects[i].width = box->x2 - box->x1;
909 rects[i].height = box->y2 - box->y1;
913 rep.sequenceNumber = client->sequence;
914 rep.length = (nrects * sizeof (xRectangle)) >> 2;
915 rep.ordering = YXBanded;
917 if (client->swapped) {
918 swaps (&rep.sequenceNumber, n);
919 swapl (&rep.length, n);
920 swapl (&rep.nrects, n);
921 SwapShorts ((short *)rects, (unsigned long)nrects * 4);
923 WriteToClient (client, sizeof (rep), (char *) &rep);
924 WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
925 DEALLOCATE_LOCAL (rects);
926 return client->noClientException;
930 ProcShapeDispatch (client)
931 register ClientPtr client;
934 switch (stuff->data) {
935 case X_ShapeQueryVersion:
936 return ProcShapeQueryVersion (client);
937 case X_ShapeRectangles:
938 return ProcShapeRectangles (client);
940 return ProcShapeMask (client);
942 return ProcShapeCombine (client);
944 return ProcShapeOffset (client);
945 case X_ShapeQueryExtents:
946 return ProcShapeQueryExtents (client);
947 case X_ShapeSelectInput:
948 return ProcShapeSelectInput (client);
949 case X_ShapeInputSelected:
950 return ProcShapeInputSelected (client);
951 case X_ShapeGetRectangles:
952 return ProcShapeGetRectangles (client);
959 SShapeNotifyEvent(from, to)
960 xShapeNotifyEvent *from, *to;
962 to->type = from->type;
963 to->kind = from->kind;
964 cpswapl (from->window, to->window);
965 cpswaps (from->sequenceNumber, to->sequenceNumber);
966 cpswaps (from->x, to->x);
967 cpswaps (from->y, to->y);
968 cpswaps (from->width, to->width);
969 cpswaps (from->height, to->height);
970 cpswapl (from->time, to->time);
971 to->shaped = from->shaped;
975 SProcShapeQueryVersion (client)
976 register ClientPtr client;
979 REQUEST (xShapeQueryVersionReq);
981 swaps (&stuff->length, n);
982 return ProcShapeQueryVersion (client);
986 SProcShapeRectangles (client)
987 register ClientPtr client;
990 REQUEST (xShapeRectanglesReq);
992 swaps (&stuff->length, n);
993 REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
994 swapl (&stuff->dest, n);
995 swaps (&stuff->xOff, n);
996 swaps (&stuff->yOff, n);
998 return ProcShapeRectangles (client);
1002 SProcShapeMask (client)
1003 register ClientPtr client;
1006 REQUEST (xShapeMaskReq);
1008 swaps (&stuff->length, n);
1009 REQUEST_SIZE_MATCH (xShapeMaskReq);
1010 swapl (&stuff->dest, n);
1011 swaps (&stuff->xOff, n);
1012 swaps (&stuff->yOff, n);
1013 swapl (&stuff->src, n);
1014 return ProcShapeMask (client);
1018 SProcShapeCombine (client)
1019 register ClientPtr client;
1022 REQUEST (xShapeCombineReq);
1024 swaps (&stuff->length, n);
1025 REQUEST_SIZE_MATCH (xShapeCombineReq);
1026 swapl (&stuff->dest, n);
1027 swaps (&stuff->xOff, n);
1028 swaps (&stuff->yOff, n);
1029 swapl (&stuff->src, n);
1030 return ProcShapeCombine (client);
1034 SProcShapeOffset (client)
1035 register ClientPtr client;
1038 REQUEST (xShapeOffsetReq);
1040 swaps (&stuff->length, n);
1041 REQUEST_SIZE_MATCH (xShapeOffsetReq);
1042 swapl (&stuff->dest, n);
1043 swaps (&stuff->xOff, n);
1044 swaps (&stuff->yOff, n);
1045 return ProcShapeOffset (client);
1049 SProcShapeQueryExtents (client)
1050 register ClientPtr client;
1053 REQUEST (xShapeQueryExtentsReq);
1055 swaps (&stuff->length, n);
1056 REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
1057 swapl (&stuff->window, n);
1058 return ProcShapeQueryExtents (client);
1062 SProcShapeSelectInput (client)
1063 register ClientPtr client;
1066 REQUEST (xShapeSelectInputReq);
1068 swaps (&stuff->length, n);
1069 REQUEST_SIZE_MATCH (xShapeSelectInputReq);
1070 swapl (&stuff->window, n);
1071 return ProcShapeSelectInput (client);
1075 SProcShapeInputSelected (client)
1076 register ClientPtr client;
1079 REQUEST (xShapeInputSelectedReq);
1081 swaps (&stuff->length, n);
1082 REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
1083 swapl (&stuff->window, n);
1084 return ProcShapeInputSelected (client);
1088 SProcShapeGetRectangles (client)
1089 register ClientPtr client;
1091 REQUEST(xShapeGetRectanglesReq);
1094 swaps (&stuff->length, n);
1095 REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
1096 swapl (&stuff->window, n);
1097 return ProcShapeGetRectangles (client);
1101 SProcShapeDispatch (client)
1102 register ClientPtr client;
1105 switch (stuff->data) {
1106 case X_ShapeQueryVersion:
1107 return SProcShapeQueryVersion (client);
1108 case X_ShapeRectangles:
1109 return SProcShapeRectangles (client);
1111 return SProcShapeMask (client);
1112 case X_ShapeCombine:
1113 return SProcShapeCombine (client);
1115 return SProcShapeOffset (client);
1116 case X_ShapeQueryExtents:
1117 return SProcShapeQueryExtents (client);
1118 case X_ShapeSelectInput:
1119 return SProcShapeSelectInput (client);
1120 case X_ShapeInputSelected:
1121 return SProcShapeInputSelected (client);
1122 case X_ShapeGetRectangles:
1123 return SProcShapeGetRectangles (client);