2 * Copyright © 2003 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 #ifdef HAVE_DIX_CONFIG_H
24 #include <dix-config.h>
27 #include "xfixesint.h"
28 #include "scrnintstr.h"
29 #include <picturestr.h>
31 #include <regionstr.h>
35 RESTYPE RegionResType
;
38 RegionResFree(pointer data
, XID id
)
40 RegionPtr pRegion
= (RegionPtr
) data
;
42 RegionDestroy(pRegion
);
47 XFixesRegionCopy(RegionPtr pRegion
)
49 RegionPtr pNew
= RegionCreate(RegionExtents(pRegion
),
50 RegionNumRects(pRegion
));
54 if (!RegionCopy(pNew
, pRegion
)) {
62 XFixesRegionInit(void)
64 RegionResType
= CreateNewResourceType(RegionResFree
, "XFixesRegion");
66 return RegionResType
!= 0;
70 ProcXFixesCreateRegion(ClientPtr client
)
75 REQUEST(xXFixesCreateRegionReq
);
77 REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq
);
78 LEGAL_NEW_RESOURCE(stuff
->region
, client
);
80 things
= (client
->req_len
<< 2) - sizeof(xXFixesCreateRegionReq
);
85 pRegion
= RegionFromRects(things
, (xRectangle
*) (stuff
+ 1), CT_UNSORTED
);
88 if (!AddResource(stuff
->region
, RegionResType
, (pointer
) pRegion
))
95 SProcXFixesCreateRegion(ClientPtr client
)
97 REQUEST(xXFixesCreateRegionReq
);
99 swaps(&stuff
->length
);
100 REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq
);
101 swapl(&stuff
->region
);
103 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
107 ProcXFixesCreateRegionFromBitmap(ClientPtr client
)
113 REQUEST(xXFixesCreateRegionFromBitmapReq
);
115 REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq
);
116 LEGAL_NEW_RESOURCE(stuff
->region
, client
);
118 rc
= dixLookupResourceByType((pointer
*) &pPixmap
, stuff
->bitmap
, RT_PIXMAP
,
119 client
, DixReadAccess
);
121 client
->errorValue
= stuff
->bitmap
;
124 if (pPixmap
->drawable
.depth
!= 1)
127 pRegion
= BitmapToRegion(pPixmap
->drawable
.pScreen
, pPixmap
);
132 if (!AddResource(stuff
->region
, RegionResType
, (pointer
) pRegion
))
139 SProcXFixesCreateRegionFromBitmap(ClientPtr client
)
141 REQUEST(xXFixesCreateRegionFromBitmapReq
);
143 swaps(&stuff
->length
);
144 REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq
);
145 swapl(&stuff
->region
);
146 swapl(&stuff
->bitmap
);
147 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
151 ProcXFixesCreateRegionFromWindow(ClientPtr client
)
158 REQUEST(xXFixesCreateRegionFromWindowReq
);
160 REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq
);
161 LEGAL_NEW_RESOURCE(stuff
->region
, client
);
162 rc
= dixLookupResourceByType((pointer
*) &pWin
, stuff
->window
, RT_WINDOW
,
163 client
, DixGetAttrAccess
);
165 client
->errorValue
= stuff
->window
;
168 switch (stuff
->kind
) {
169 case WindowRegionBounding
:
170 pRegion
= wBoundingShape(pWin
);
172 pRegion
= CreateBoundingShape(pWin
);
176 case WindowRegionClip
:
177 pRegion
= wClipShape(pWin
);
179 pRegion
= CreateClipShape(pWin
);
184 client
->errorValue
= stuff
->kind
;
188 pRegion
= XFixesRegionCopy(pRegion
);
191 if (!AddResource(stuff
->region
, RegionResType
, (pointer
) pRegion
))
198 SProcXFixesCreateRegionFromWindow(ClientPtr client
)
200 REQUEST(xXFixesCreateRegionFromWindowReq
);
202 swaps(&stuff
->length
);
203 REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq
);
204 swapl(&stuff
->region
);
205 swapl(&stuff
->window
);
206 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
210 ProcXFixesCreateRegionFromGC(ClientPtr client
)
212 RegionPtr pRegion
, pClip
;
216 REQUEST(xXFixesCreateRegionFromGCReq
);
218 REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq
);
219 LEGAL_NEW_RESOURCE(stuff
->region
, client
);
221 rc
= dixLookupGC(&pGC
, stuff
->gc
, client
, DixGetAttrAccess
);
225 switch (pGC
->clientClipType
) {
227 pRegion
= BitmapToRegion(pGC
->pScreen
, (PixmapPtr
) pGC
->clientClip
);
232 pClip
= (RegionPtr
) pGC
->clientClip
;
233 pRegion
= XFixesRegionCopy(pClip
);
238 return BadImplementation
; /* assume sane server bits */
241 if (!AddResource(stuff
->region
, RegionResType
, (pointer
) pRegion
))
248 SProcXFixesCreateRegionFromGC(ClientPtr client
)
250 REQUEST(xXFixesCreateRegionFromGCReq
);
252 swaps(&stuff
->length
);
253 REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq
);
254 swapl(&stuff
->region
);
256 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
260 ProcXFixesCreateRegionFromPicture(ClientPtr client
)
265 REQUEST(xXFixesCreateRegionFromPictureReq
);
267 REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq
);
268 LEGAL_NEW_RESOURCE(stuff
->region
, client
);
270 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixGetAttrAccess
);
272 switch (pPicture
->clientClipType
) {
274 pRegion
= BitmapToRegion(pPicture
->pDrawable
->pScreen
,
275 (PixmapPtr
) pPicture
->clientClip
);
280 pRegion
= XFixesRegionCopy((RegionPtr
) pPicture
->clientClip
);
285 return BadImplementation
; /* assume sane server bits */
288 if (!AddResource(stuff
->region
, RegionResType
, (pointer
) pRegion
))
295 SProcXFixesCreateRegionFromPicture(ClientPtr client
)
297 REQUEST(xXFixesCreateRegionFromPictureReq
);
299 swaps(&stuff
->length
);
300 REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq
);
301 swapl(&stuff
->region
);
302 swapl(&stuff
->picture
);
303 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
307 ProcXFixesDestroyRegion(ClientPtr client
)
309 REQUEST(xXFixesDestroyRegionReq
);
312 REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq
);
313 VERIFY_REGION(pRegion
, stuff
->region
, client
, DixWriteAccess
);
314 FreeResource(stuff
->region
, RT_NONE
);
319 SProcXFixesDestroyRegion(ClientPtr client
)
321 REQUEST(xXFixesDestroyRegionReq
);
323 swaps(&stuff
->length
);
324 REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq
);
325 swapl(&stuff
->region
);
326 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
330 ProcXFixesSetRegion(ClientPtr client
)
333 RegionPtr pRegion
, pNew
;
335 REQUEST(xXFixesSetRegionReq
);
337 REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq
);
338 VERIFY_REGION(pRegion
, stuff
->region
, client
, DixWriteAccess
);
340 things
= (client
->req_len
<< 2) - sizeof(xXFixesCreateRegionReq
);
345 pNew
= RegionFromRects(things
, (xRectangle
*) (stuff
+ 1), CT_UNSORTED
);
348 if (!RegionCopy(pRegion
, pNew
)) {
357 SProcXFixesSetRegion(ClientPtr client
)
359 REQUEST(xXFixesSetRegionReq
);
361 swaps(&stuff
->length
);
362 REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq
);
363 swapl(&stuff
->region
);
365 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
369 ProcXFixesCopyRegion(ClientPtr client
)
371 RegionPtr pSource
, pDestination
;
373 REQUEST(xXFixesCopyRegionReq
);
375 VERIFY_REGION(pSource
, stuff
->source
, client
, DixReadAccess
);
376 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
378 if (!RegionCopy(pDestination
, pSource
))
385 SProcXFixesCopyRegion(ClientPtr client
)
387 REQUEST(xXFixesCopyRegionReq
);
389 swaps(&stuff
->length
);
390 REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq
);
391 swapl(&stuff
->source
);
392 swapl(&stuff
->destination
);
393 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
397 ProcXFixesCombineRegion(ClientPtr client
)
399 RegionPtr pSource1
, pSource2
, pDestination
;
401 REQUEST(xXFixesCombineRegionReq
);
403 REQUEST_SIZE_MATCH(xXFixesCombineRegionReq
);
404 VERIFY_REGION(pSource1
, stuff
->source1
, client
, DixReadAccess
);
405 VERIFY_REGION(pSource2
, stuff
->source2
, client
, DixReadAccess
);
406 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
408 switch (stuff
->xfixesReqType
) {
409 case X_XFixesUnionRegion
:
410 if (!RegionUnion(pDestination
, pSource1
, pSource2
))
413 case X_XFixesIntersectRegion
:
414 if (!RegionIntersect(pDestination
, pSource1
, pSource2
))
417 case X_XFixesSubtractRegion
:
418 if (!RegionSubtract(pDestination
, pSource1
, pSource2
))
427 SProcXFixesCombineRegion(ClientPtr client
)
429 REQUEST(xXFixesCombineRegionReq
);
431 swaps(&stuff
->length
);
432 REQUEST_SIZE_MATCH(xXFixesCombineRegionReq
);
433 swapl(&stuff
->source1
);
434 swapl(&stuff
->source2
);
435 swapl(&stuff
->destination
);
436 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
440 ProcXFixesInvertRegion(ClientPtr client
)
442 RegionPtr pSource
, pDestination
;
445 REQUEST(xXFixesInvertRegionReq
);
447 REQUEST_SIZE_MATCH(xXFixesInvertRegionReq
);
448 VERIFY_REGION(pSource
, stuff
->source
, client
, DixReadAccess
);
449 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
451 /* Compute bounds, limit to 16 bits */
452 bounds
.x1
= stuff
->x
;
453 bounds
.y1
= stuff
->y
;
454 if ((int) stuff
->x
+ (int) stuff
->width
> MAXSHORT
)
455 bounds
.x2
= MAXSHORT
;
457 bounds
.x2
= stuff
->x
+ stuff
->width
;
459 if ((int) stuff
->y
+ (int) stuff
->height
> MAXSHORT
)
460 bounds
.y2
= MAXSHORT
;
462 bounds
.y2
= stuff
->y
+ stuff
->height
;
464 if (!RegionInverse(pDestination
, pSource
, &bounds
))
471 SProcXFixesInvertRegion(ClientPtr client
)
473 REQUEST(xXFixesInvertRegionReq
);
475 swaps(&stuff
->length
);
476 REQUEST_SIZE_MATCH(xXFixesInvertRegionReq
);
477 swapl(&stuff
->source
);
480 swaps(&stuff
->width
);
481 swaps(&stuff
->height
);
482 swapl(&stuff
->destination
);
483 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
487 ProcXFixesTranslateRegion(ClientPtr client
)
491 REQUEST(xXFixesTranslateRegionReq
);
493 REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq
);
494 VERIFY_REGION(pRegion
, stuff
->region
, client
, DixWriteAccess
);
496 RegionTranslate(pRegion
, stuff
->dx
, stuff
->dy
);
501 SProcXFixesTranslateRegion(ClientPtr client
)
503 REQUEST(xXFixesTranslateRegionReq
);
505 swaps(&stuff
->length
);
506 REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq
);
507 swapl(&stuff
->region
);
510 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
514 ProcXFixesRegionExtents(ClientPtr client
)
516 RegionPtr pSource
, pDestination
;
518 REQUEST(xXFixesRegionExtentsReq
);
520 REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq
);
521 VERIFY_REGION(pSource
, stuff
->source
, client
, DixReadAccess
);
522 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
524 RegionReset(pDestination
, RegionExtents(pSource
));
530 SProcXFixesRegionExtents(ClientPtr client
)
532 REQUEST(xXFixesRegionExtentsReq
);
534 swaps(&stuff
->length
);
535 REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq
);
536 swapl(&stuff
->source
);
537 swapl(&stuff
->destination
);
538 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
542 ProcXFixesFetchRegion(ClientPtr client
)
545 xXFixesFetchRegionReply
*reply
;
551 REQUEST(xXFixesFetchRegionReq
);
553 REQUEST_SIZE_MATCH(xXFixesFetchRegionReq
);
554 VERIFY_REGION(pRegion
, stuff
->region
, client
, DixReadAccess
);
556 pExtent
= RegionExtents(pRegion
);
557 pBox
= RegionRects(pRegion
);
558 nBox
= RegionNumRects(pRegion
);
560 reply
= calloc(sizeof(xXFixesFetchRegionReply
) + nBox
* sizeof(xRectangle
),
564 reply
->type
= X_Reply
;
565 reply
->sequenceNumber
= client
->sequence
;
566 reply
->length
= nBox
<< 1;
567 reply
->x
= pExtent
->x1
;
568 reply
->y
= pExtent
->y1
;
569 reply
->width
= pExtent
->x2
- pExtent
->x1
;
570 reply
->height
= pExtent
->y2
- pExtent
->y1
;
572 pRect
= (xRectangle
*) (reply
+ 1);
573 for (i
= 0; i
< nBox
; i
++) {
574 pRect
[i
].x
= pBox
[i
].x1
;
575 pRect
[i
].y
= pBox
[i
].y1
;
576 pRect
[i
].width
= pBox
[i
].x2
- pBox
[i
].x1
;
577 pRect
[i
].height
= pBox
[i
].y2
- pBox
[i
].y1
;
579 if (client
->swapped
) {
580 swaps(&reply
->sequenceNumber
);
581 swapl(&reply
->length
);
584 swaps(&reply
->width
);
585 swaps(&reply
->height
);
586 SwapShorts((INT16
*) pRect
, nBox
* 4);
588 WriteToClient(client
, sizeof(xXFixesFetchRegionReply
) +
589 nBox
* sizeof(xRectangle
), (char *) reply
);
595 SProcXFixesFetchRegion(ClientPtr client
)
597 REQUEST(xXFixesFetchRegionReq
);
599 swaps(&stuff
->length
);
600 REQUEST_SIZE_MATCH(xXFixesFetchRegionReq
);
601 swapl(&stuff
->region
);
602 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
606 ProcXFixesSetGCClipRegion(ClientPtr client
)
613 REQUEST(xXFixesSetGCClipRegionReq
);
614 REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq
);
616 rc
= dixLookupGC(&pGC
, stuff
->gc
, client
, DixSetAttrAccess
);
620 VERIFY_REGION_OR_NONE(pRegion
, stuff
->region
, client
, DixReadAccess
);
623 pRegion
= XFixesRegionCopy(pRegion
);
628 vals
[0].val
= stuff
->xOrigin
;
629 vals
[1].val
= stuff
->yOrigin
;
630 ChangeGC(NullClient
, pGC
, GCClipXOrigin
| GCClipYOrigin
, vals
);
631 (*pGC
->funcs
->ChangeClip
) (pGC
, pRegion
? CT_REGION
: CT_NONE
,
632 (pointer
) pRegion
, 0);
638 SProcXFixesSetGCClipRegion(ClientPtr client
)
640 REQUEST(xXFixesSetGCClipRegionReq
);
642 swaps(&stuff
->length
);
643 REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq
);
645 swapl(&stuff
->region
);
646 swaps(&stuff
->xOrigin
);
647 swaps(&stuff
->yOrigin
);
648 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
651 typedef RegionPtr (*CreateDftPtr
) (WindowPtr pWin
);
654 ProcXFixesSetWindowShapeRegion(ClientPtr client
)
658 RegionPtr
*pDestRegion
;
661 REQUEST(xXFixesSetWindowShapeRegionReq
);
663 REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq
);
664 rc
= dixLookupResourceByType((pointer
*) &pWin
, stuff
->dest
, RT_WINDOW
,
665 client
, DixSetAttrAccess
);
667 client
->errorValue
= stuff
->dest
;
670 VERIFY_REGION_OR_NONE(pRegion
, stuff
->region
, client
, DixWriteAccess
);
671 switch (stuff
->destKind
) {
677 client
->errorValue
= stuff
->destKind
;
681 pRegion
= XFixesRegionCopy(pRegion
);
685 MakeWindowOptional(pWin
);
686 switch (stuff
->destKind
) {
689 pDestRegion
= &pWin
->optional
->boundingShape
;
692 pDestRegion
= &pWin
->optional
->clipShape
;
695 pDestRegion
= &pWin
->optional
->inputShape
;
698 if (stuff
->xOff
|| stuff
->yOff
)
699 RegionTranslate(pRegion
, stuff
->xOff
, stuff
->yOff
);
702 if (pWin
->optional
) {
703 switch (stuff
->destKind
) {
706 pDestRegion
= &pWin
->optional
->boundingShape
;
709 pDestRegion
= &pWin
->optional
->clipShape
;
712 pDestRegion
= &pWin
->optional
->inputShape
;
717 pDestRegion
= &pRegion
; /* a NULL region pointer */
720 RegionDestroy(*pDestRegion
);
721 *pDestRegion
= pRegion
;
722 (*pWin
->drawable
.pScreen
->SetShape
) (pWin
, stuff
->destKind
);
723 SendShapeNotify(pWin
, stuff
->destKind
);
728 SProcXFixesSetWindowShapeRegion(ClientPtr client
)
730 REQUEST(xXFixesSetWindowShapeRegionReq
);
732 swaps(&stuff
->length
);
733 REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq
);
737 swapl(&stuff
->region
);
738 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
742 ProcXFixesSetPictureClipRegion(ClientPtr client
)
747 REQUEST(xXFixesSetPictureClipRegionReq
);
749 REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq
);
750 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixSetAttrAccess
);
751 VERIFY_REGION_OR_NONE(pRegion
, stuff
->region
, client
, DixReadAccess
);
753 return SetPictureClipRegion(pPicture
, stuff
->xOrigin
, stuff
->yOrigin
,
758 SProcXFixesSetPictureClipRegion(ClientPtr client
)
760 REQUEST(xXFixesSetPictureClipRegionReq
);
762 swaps(&stuff
->length
);
763 REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq
);
764 swapl(&stuff
->picture
);
765 swapl(&stuff
->region
);
766 swaps(&stuff
->xOrigin
);
767 swaps(&stuff
->yOrigin
);
768 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
772 ProcXFixesExpandRegion(ClientPtr client
)
774 RegionPtr pSource
, pDestination
;
776 REQUEST(xXFixesExpandRegionReq
);
782 REQUEST_SIZE_MATCH(xXFixesExpandRegionReq
);
783 VERIFY_REGION(pSource
, stuff
->source
, client
, DixReadAccess
);
784 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
786 nBoxes
= RegionNumRects(pSource
);
787 pSrc
= RegionRects(pSource
);
789 pTmp
= malloc(nBoxes
* sizeof(BoxRec
));
792 for (i
= 0; i
< nBoxes
; i
++) {
793 pTmp
[i
].x1
= pSrc
[i
].x1
- stuff
->left
;
794 pTmp
[i
].x2
= pSrc
[i
].x2
+ stuff
->right
;
795 pTmp
[i
].y1
= pSrc
[i
].y1
- stuff
->top
;
796 pTmp
[i
].y2
= pSrc
[i
].y2
+ stuff
->bottom
;
798 RegionEmpty(pDestination
);
799 for (i
= 0; i
< nBoxes
; i
++) {
802 RegionInit(&r
, &pTmp
[i
], 0);
803 RegionUnion(pDestination
, pDestination
, &r
);
811 SProcXFixesExpandRegion(ClientPtr client
)
813 REQUEST(xXFixesExpandRegionReq
);
815 swaps(&stuff
->length
);
816 REQUEST_SIZE_MATCH(xXFixesExpandRegionReq
);
817 swapl(&stuff
->source
);
818 swapl(&stuff
->destination
);
820 swaps(&stuff
->right
);
822 swaps(&stuff
->bottom
);
823 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
827 #include "panoramiX.h"
828 #include "panoramiXsrv.h"
831 PanoramiXFixesSetGCClipRegion(ClientPtr client
)
833 REQUEST(xXFixesSetGCClipRegionReq
);
834 int result
= Success
, j
;
837 REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq
);
839 if ((result
= dixLookupResourceByType((void **) &gc
, stuff
->gc
, XRT_GC
,
840 client
, DixWriteAccess
))) {
841 client
->errorValue
= stuff
->gc
;
845 FOR_NSCREENS_BACKWARD(j
) {
846 stuff
->gc
= gc
->info
[j
].id
;
847 result
= (*PanoramiXSaveXFixesVector
[X_XFixesSetGCClipRegion
]) (client
);
848 if (result
!= Success
)
856 PanoramiXFixesSetWindowShapeRegion(ClientPtr client
)
858 int result
= Success
, j
;
860 RegionPtr reg
= NULL
;
862 REQUEST(xXFixesSetWindowShapeRegionReq
);
864 REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq
);
866 if ((result
= dixLookupResourceByType((void **) &win
, stuff
->dest
,
869 client
->errorValue
= stuff
->dest
;
874 VERIFY_REGION_OR_NONE(reg
, stuff
->region
, client
, DixReadAccess
);
876 FOR_NSCREENS_FORWARD(j
) {
877 ScreenPtr screen
= screenInfo
.screens
[j
];
878 stuff
->dest
= win
->info
[j
].id
;
881 RegionTranslate(reg
, -screen
->x
, -screen
->y
);
884 (*PanoramiXSaveXFixesVector
[X_XFixesSetWindowShapeRegion
]) (client
);
887 RegionTranslate(reg
, screen
->x
, screen
->y
);
889 if (result
!= Success
)
897 PanoramiXFixesSetPictureClipRegion(ClientPtr client
)
899 REQUEST(xXFixesSetPictureClipRegionReq
);
900 int result
= Success
, j
;
902 RegionPtr reg
= NULL
;
904 REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq
);
906 if ((result
= dixLookupResourceByType((void **) &pict
, stuff
->picture
,
909 client
->errorValue
= stuff
->picture
;
913 if (pict
->u
.pict
.root
)
914 VERIFY_REGION_OR_NONE(reg
, stuff
->region
, client
, DixReadAccess
);
916 FOR_NSCREENS_BACKWARD(j
) {
917 ScreenPtr screen
= screenInfo
.screens
[j
];
918 stuff
->picture
= pict
->info
[j
].id
;
921 RegionTranslate(reg
, -screen
->x
, -screen
->y
);
924 (*PanoramiXSaveXFixesVector
[X_XFixesSetPictureClipRegion
]) (client
);
927 RegionTranslate(reg
, screen
->x
, screen
->y
);
929 if (result
!= Success
)