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"
30 #include <picturestr.h>
31 extern int RenderErrBase
;
33 #include <regionstr.h>
37 RESTYPE RegionResType
;
40 RegionResFree (pointer data
, XID id
)
42 RegionPtr pRegion
= (RegionPtr
) data
;
44 REGION_DESTROY (0, pRegion
);
49 XFixesRegionCopy (RegionPtr pRegion
)
51 RegionPtr pNew
= REGION_CREATE (0, REGION_EXTENTS(0, pRegion
),
52 REGION_NUM_RECTS(pRegion
));
55 if (!REGION_COPY (0, pNew
, pRegion
))
57 REGION_DESTROY (0, pNew
);
64 XFixesRegionInit (void)
66 RegionResType
= CreateNewResourceType(RegionResFree
);
71 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
= RECTS_TO_REGION(0, things
, (xRectangle
*) (stuff
+ 1), CT_UNSORTED
);
88 if (!AddResource (stuff
->region
, RegionResType
, (pointer
) pRegion
))
91 return(client
->noClientException
);
95 SProcXFixesCreateRegion (ClientPtr client
)
98 REQUEST(xXFixesCreateRegionReq
);
100 swaps(&stuff
->length
, n
);
101 REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq
);
102 swapl(&stuff
->region
, n
);
104 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
108 ProcXFixesCreateRegionFromBitmap (ClientPtr client
)
112 REQUEST (xXFixesCreateRegionFromBitmapReq
);
114 REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq
);
115 LEGAL_NEW_RESOURCE (stuff
->region
, client
);
117 pPixmap
= (PixmapPtr
) SecurityLookupIDByType (client
, stuff
->bitmap
,
122 client
->errorValue
= stuff
->bitmap
;
125 if (pPixmap
->drawable
.depth
!= 1)
128 pRegion
= BITMAP_TO_REGION(pPixmap
->drawable
.pScreen
, pPixmap
);
133 if (!AddResource (stuff
->region
, RegionResType
, (pointer
) pRegion
))
136 return(client
->noClientException
);
140 SProcXFixesCreateRegionFromBitmap (ClientPtr client
)
143 REQUEST (xXFixesCreateRegionFromBitmapReq
);
145 swaps(&stuff
->length
, n
);
146 REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq
);
147 swapl(&stuff
->region
, n
);
148 swapl(&stuff
->bitmap
, n
);
149 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
153 ProcXFixesCreateRegionFromWindow (ClientPtr client
)
158 REQUEST (xXFixesCreateRegionFromWindowReq
);
160 REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq
);
161 LEGAL_NEW_RESOURCE (stuff
->region
, client
);
162 pWin
= (WindowPtr
) LookupIDByType (stuff
->window
, RT_WINDOW
);
165 client
->errorValue
= stuff
->window
;
168 switch (stuff
->kind
) {
169 case WindowRegionBounding
:
171 pRegion
= wBoundingShape(pWin
);
175 pRegion
= CreateBoundingShape (pWin
);
179 case WindowRegionClip
:
181 pRegion
= wClipShape(pWin
);
185 pRegion
= CreateClipShape (pWin
);
190 client
->errorValue
= stuff
->kind
;
194 pRegion
= XFixesRegionCopy (pRegion
);
197 if (!AddResource (stuff
->region
, RegionResType
, (pointer
) pRegion
))
200 return(client
->noClientException
);
204 SProcXFixesCreateRegionFromWindow (ClientPtr client
)
207 REQUEST (xXFixesCreateRegionFromWindowReq
);
209 swaps(&stuff
->length
, n
);
210 REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq
);
211 swapl(&stuff
->region
, n
);
212 swapl(&stuff
->window
, n
);
213 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
217 ProcXFixesCreateRegionFromGC (ClientPtr client
)
219 RegionPtr pRegion
, pClip
;
222 REQUEST (xXFixesCreateRegionFromGCReq
);
224 REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq
);
225 LEGAL_NEW_RESOURCE (stuff
->region
, client
);
227 rc
= dixLookupGC(&pGC
, stuff
->gc
, client
, DixReadAccess
);
231 switch (pGC
->clientClipType
) {
233 pRegion
= BITMAP_TO_REGION(pGC
->pScreen
, (PixmapPtr
) pGC
->clientClip
);
238 pClip
= (RegionPtr
) pGC
->clientClip
;
239 pRegion
= XFixesRegionCopy (pClip
);
244 return BadImplementation
; /* assume sane server bits */
247 if (!AddResource (stuff
->region
, RegionResType
, (pointer
) pRegion
))
250 return(client
->noClientException
);
254 SProcXFixesCreateRegionFromGC (ClientPtr client
)
257 REQUEST (xXFixesCreateRegionFromGCReq
);
259 swaps(&stuff
->length
, n
);
260 REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq
);
261 swapl(&stuff
->region
, n
);
262 swapl(&stuff
->gc
, n
);
263 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
267 ProcXFixesCreateRegionFromPicture (ClientPtr client
)
272 REQUEST (xXFixesCreateRegionFromPictureReq
);
274 REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq
);
275 LEGAL_NEW_RESOURCE (stuff
->region
, client
);
277 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixReadAccess
,
278 RenderErrBase
+ BadPicture
);
280 switch (pPicture
->clientClipType
) {
282 pRegion
= BITMAP_TO_REGION(pPicture
->pDrawable
->pScreen
,
283 (PixmapPtr
) pPicture
->clientClip
);
288 pRegion
= XFixesRegionCopy ((RegionPtr
) pPicture
->clientClip
);
293 return BadImplementation
; /* assume sane server bits */
296 if (!AddResource (stuff
->region
, RegionResType
, (pointer
) pRegion
))
299 return(client
->noClientException
);
306 SProcXFixesCreateRegionFromPicture (ClientPtr client
)
309 REQUEST (xXFixesCreateRegionFromPictureReq
);
311 swaps(&stuff
->length
, n
);
312 REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq
);
313 swapl(&stuff
->region
, n
);
314 swapl(&stuff
->picture
, n
);
315 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
319 ProcXFixesDestroyRegion (ClientPtr client
)
321 REQUEST (xXFixesDestroyRegionReq
);
324 REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq
);
325 VERIFY_REGION(pRegion
, stuff
->region
, client
, DixWriteAccess
);
326 FreeResource (stuff
->region
, RT_NONE
);
327 return(client
->noClientException
);
331 SProcXFixesDestroyRegion (ClientPtr client
)
334 REQUEST (xXFixesDestroyRegionReq
);
336 swaps (&stuff
->length
, n
);
337 REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq
);
338 swapl (&stuff
->region
, n
);
339 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
343 ProcXFixesSetRegion (ClientPtr client
)
346 RegionPtr pRegion
, pNew
;
347 REQUEST (xXFixesSetRegionReq
);
349 REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq
);
350 VERIFY_REGION(pRegion
, stuff
->region
, client
, DixWriteAccess
);
352 things
= (client
->req_len
<< 2) - sizeof (xXFixesCreateRegionReq
);
357 pNew
= RECTS_TO_REGION(0, things
, (xRectangle
*) (stuff
+ 1), CT_UNSORTED
);
360 if (!REGION_COPY (0, pRegion
, pNew
))
362 REGION_DESTROY (0, pNew
);
365 REGION_DESTROY (0, pNew
);
366 return(client
->noClientException
);
370 SProcXFixesSetRegion (ClientPtr client
)
373 REQUEST (xXFixesSetRegionReq
);
375 swaps (&stuff
->length
, n
);
376 REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq
);
377 swapl (&stuff
->region
, n
);
379 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
383 ProcXFixesCopyRegion (ClientPtr client
)
385 RegionPtr pSource
, pDestination
;
386 REQUEST (xXFixesCopyRegionReq
);
388 VERIFY_REGION(pSource
, stuff
->source
, client
, DixReadAccess
);
389 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
391 if (!REGION_COPY(pScreen
, pDestination
, pSource
))
394 return(client
->noClientException
);
398 SProcXFixesCopyRegion (ClientPtr client
)
401 REQUEST (xXFixesCopyRegionReq
);
403 swaps (&stuff
->length
, n
);
404 REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq
);
405 swapl (&stuff
->source
, n
);
406 swapl (&stuff
->destination
, n
);
407 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
411 ProcXFixesCombineRegion (ClientPtr client
)
413 RegionPtr pSource1
, pSource2
, pDestination
;
415 REQUEST (xXFixesCombineRegionReq
);
417 REQUEST_SIZE_MATCH (xXFixesCombineRegionReq
);
418 VERIFY_REGION(pSource1
, stuff
->source1
, client
, DixReadAccess
);
419 VERIFY_REGION(pSource2
, stuff
->source2
, client
, DixReadAccess
);
420 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
422 switch (stuff
->xfixesReqType
) {
423 case X_XFixesUnionRegion
:
424 if (!REGION_UNION (0, pDestination
, pSource1
, pSource2
))
427 case X_XFixesIntersectRegion
:
428 if (!REGION_INTERSECT (0, pDestination
, pSource1
, pSource2
))
431 case X_XFixesSubtractRegion
:
432 if (!REGION_SUBTRACT (0, pDestination
, pSource1
, pSource2
))
438 ret
= client
->noClientException
;
443 SProcXFixesCombineRegion (ClientPtr client
)
446 REQUEST (xXFixesCombineRegionReq
);
448 swaps (&stuff
->length
, n
);
449 REQUEST_SIZE_MATCH (xXFixesCombineRegionReq
);
450 swapl (&stuff
->source1
, n
);
451 swapl (&stuff
->source2
, n
);
452 swapl (&stuff
->destination
, n
);
453 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
457 ProcXFixesInvertRegion (ClientPtr client
)
459 RegionPtr pSource
, pDestination
;
462 REQUEST(xXFixesInvertRegionReq
);
464 REQUEST_SIZE_MATCH(xXFixesInvertRegionReq
);
465 VERIFY_REGION(pSource
, stuff
->source
, client
, DixReadAccess
);
466 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
468 /* Compute bounds, limit to 16 bits */
469 bounds
.x1
= stuff
->x
;
470 bounds
.y1
= stuff
->y
;
471 if ((int) stuff
->x
+ (int) stuff
->width
> MAXSHORT
)
472 bounds
.x2
= MAXSHORT
;
474 bounds
.x2
= stuff
->x
+ stuff
->width
;
476 if ((int) stuff
->y
+ (int) stuff
->height
> MAXSHORT
)
477 bounds
.y2
= MAXSHORT
;
479 bounds
.y2
= stuff
->y
+ stuff
->height
;
481 if (!REGION_INVERSE(0, pDestination
, pSource
, &bounds
))
485 ret
= client
->noClientException
;
490 SProcXFixesInvertRegion (ClientPtr client
)
493 REQUEST(xXFixesInvertRegionReq
);
495 swaps (&stuff
->length
, n
);
496 REQUEST_SIZE_MATCH(xXFixesInvertRegionReq
);
497 swapl (&stuff
->source
, n
);
498 swaps (&stuff
->x
, n
);
499 swaps (&stuff
->y
, n
);
500 swaps (&stuff
->width
, n
);
501 swaps (&stuff
->height
, n
);
502 swapl (&stuff
->destination
, n
);
503 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
507 ProcXFixesTranslateRegion (ClientPtr client
)
510 REQUEST(xXFixesTranslateRegionReq
);
512 REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq
);
513 VERIFY_REGION(pRegion
, stuff
->region
, client
, DixWriteAccess
);
515 REGION_TRANSLATE(pScreen
, pRegion
, stuff
->dx
, stuff
->dy
);
516 return (client
->noClientException
);
520 SProcXFixesTranslateRegion (ClientPtr client
)
523 REQUEST(xXFixesTranslateRegionReq
);
525 swaps (&stuff
->length
, n
);
526 REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq
);
527 swapl (&stuff
->region
, n
);
528 swaps (&stuff
->dx
, n
);
529 swaps (&stuff
->dy
, n
);
530 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
534 ProcXFixesRegionExtents (ClientPtr client
)
536 RegionPtr pSource
, pDestination
;
537 REQUEST(xXFixesRegionExtentsReq
);
539 REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq
);
540 VERIFY_REGION(pSource
, stuff
->source
, client
, DixReadAccess
);
541 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
543 REGION_RESET (0, pDestination
, REGION_EXTENTS (0, pSource
));
545 return (client
->noClientException
);
549 SProcXFixesRegionExtents (ClientPtr client
)
552 REQUEST(xXFixesRegionExtentsReq
);
554 swaps (&stuff
->length
, n
);
555 REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq
);
556 swapl (&stuff
->source
, n
);
557 swapl (&stuff
->destination
, n
);
558 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
562 ProcXFixesFetchRegion (ClientPtr client
)
565 xXFixesFetchRegionReply
*reply
;
570 REQUEST(xXFixesFetchRegionReq
);
572 REQUEST_SIZE_MATCH(xXFixesFetchRegionReq
);
573 VERIFY_REGION(pRegion
, stuff
->region
, client
, DixReadAccess
);
575 pExtent
= REGION_EXTENTS (0, pRegion
);
576 pBox
= REGION_RECTS (pRegion
);
577 nBox
= REGION_NUM_RECTS (pRegion
);
579 reply
= xalloc (sizeof (xXFixesFetchRegionReply
) +
580 nBox
* sizeof (xRectangle
));
583 reply
->type
= X_Reply
;
584 reply
->sequenceNumber
= client
->sequence
;
585 reply
->length
= nBox
<< 1;
586 reply
->x
= pExtent
->x1
;
587 reply
->y
= pExtent
->y1
;
588 reply
->width
= pExtent
->x2
- pExtent
->x1
;
589 reply
->height
= pExtent
->y2
- pExtent
->y1
;
591 pRect
= (xRectangle
*) (reply
+ 1);
592 for (i
= 0; i
< nBox
; i
++)
594 pRect
[i
].x
= pBox
[i
].x1
;
595 pRect
[i
].y
= pBox
[i
].y1
;
596 pRect
[i
].width
= pBox
[i
].x2
- pBox
[i
].x1
;
597 pRect
[i
].height
= pBox
[i
].y2
- pBox
[i
].y1
;
602 swaps (&reply
->sequenceNumber
, n
);
603 swapl (&reply
->length
, n
);
604 swaps (&reply
->x
, n
);
605 swaps (&reply
->y
, n
);
606 swaps (&reply
->width
, n
);
607 swaps (&reply
->height
, n
);
608 SwapShorts ((INT16
*) pRect
, nBox
* 4);
610 (void) WriteToClient(client
, sizeof (xXFixesFetchRegionReply
) +
611 nBox
* sizeof (xRectangle
), (char *) reply
);
613 return (client
->noClientException
);
617 SProcXFixesFetchRegion (ClientPtr client
)
620 REQUEST(xXFixesFetchRegionReq
);
622 swaps (&stuff
->length
, n
);
623 REQUEST_SIZE_MATCH(xXFixesFetchRegionReq
);
624 swapl (&stuff
->region
, n
);
625 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
629 ProcXFixesSetGCClipRegion (ClientPtr client
)
635 REQUEST(xXFixesSetGCClipRegionReq
);
636 REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq
);
638 rc
= dixLookupGC(&pGC
, stuff
->gc
, client
, DixWriteAccess
);
642 VERIFY_REGION_OR_NONE (pRegion
, stuff
->region
, client
, DixReadAccess
);
646 pRegion
= XFixesRegionCopy (pRegion
);
651 vals
[0] = stuff
->xOrigin
;
652 vals
[1] = stuff
->yOrigin
;
653 DoChangeGC (pGC
, GCClipXOrigin
|GCClipYOrigin
, vals
, 0);
654 (*pGC
->funcs
->ChangeClip
)(pGC
, pRegion
? CT_REGION
: CT_NONE
, (pointer
)pRegion
, 0);
656 return (client
->noClientException
);
660 SProcXFixesSetGCClipRegion (ClientPtr client
)
663 REQUEST(xXFixesSetGCClipRegionReq
);
665 swaps (&stuff
->length
, n
);
666 REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq
);
667 swapl (&stuff
->gc
, n
);
668 swapl (&stuff
->region
, n
);
669 swaps (&stuff
->xOrigin
, n
);
670 swaps (&stuff
->yOrigin
, n
);
671 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
674 typedef RegionPtr (*CreateDftPtr
)(WindowPtr pWin
);
677 ProcXFixesSetWindowShapeRegion (ClientPtr client
)
683 RegionPtr
*pDestRegion
;
684 REQUEST(xXFixesSetWindowShapeRegionReq
);
686 REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq
);
687 pWin
= (WindowPtr
) LookupIDByType (stuff
->dest
, RT_WINDOW
);
690 client
->errorValue
= stuff
->dest
;
693 VERIFY_REGION_OR_NONE(pRegion
, stuff
->region
, client
, DixWriteAccess
);
694 pScreen
= pWin
->drawable
.pScreen
;
695 switch (stuff
->destKind
) {
701 client
->errorValue
= stuff
->destKind
;
706 pRegion
= XFixesRegionCopy (pRegion
);
710 MakeWindowOptional (pWin
);
711 switch (stuff
->destKind
) {
714 pDestRegion
= &pWin
->optional
->boundingShape
;
717 pDestRegion
= &pWin
->optional
->clipShape
;
720 pDestRegion
= &pWin
->optional
->inputShape
;
723 if (stuff
->xOff
|| stuff
->yOff
)
724 REGION_TRANSLATE (0, pRegion
, stuff
->xOff
, stuff
->yOff
);
730 switch (stuff
->destKind
) {
733 pDestRegion
= &pWin
->optional
->boundingShape
;
736 pDestRegion
= &pWin
->optional
->clipShape
;
739 pDestRegion
= &pWin
->optional
->inputShape
;
744 pDestRegion
= &pRegion
; /* a NULL region pointer */
747 REGION_DESTROY(pScreen
, *pDestRegion
);
748 *pDestRegion
= pRegion
;
749 (*pScreen
->SetShape
) (pWin
);
750 SendShapeNotify (pWin
, stuff
->destKind
);
751 return (client
->noClientException
);
758 SProcXFixesSetWindowShapeRegion (ClientPtr client
)
761 REQUEST(xXFixesSetWindowShapeRegionReq
);
763 swaps (&stuff
->length
, n
);
764 REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq
);
765 swapl (&stuff
->dest
, n
);
766 swaps (&stuff
->xOff
, n
);
767 swaps (&stuff
->yOff
, n
);
768 swapl (&stuff
->region
, n
);
769 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
773 ProcXFixesSetPictureClipRegion (ClientPtr client
)
780 REQUEST(xXFixesSetPictureClipRegionReq
);
782 REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq
);
783 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixWriteAccess
,
784 RenderErrBase
+ BadPicture
);
785 pScreen
= pPicture
->pDrawable
->pScreen
;
786 ps
= GetPictureScreen (pScreen
);
787 VERIFY_REGION_OR_NONE(pRegion
, stuff
->region
, client
, DixReadAccess
);
789 return SetPictureClipRegion (pPicture
, stuff
->xOrigin
, stuff
->yOrigin
,
797 SProcXFixesSetPictureClipRegion (ClientPtr client
)
800 REQUEST(xXFixesSetPictureClipRegionReq
);
802 swaps (&stuff
->length
, n
);
803 REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq
);
804 swapl (&stuff
->picture
, n
);
805 swapl (&stuff
->region
, n
);
806 swaps (&stuff
->xOrigin
, n
);
807 swaps (&stuff
->yOrigin
, n
);
808 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);
812 ProcXFixesExpandRegion (ClientPtr client
)
814 RegionPtr pSource
, pDestination
;
816 REQUEST (xXFixesExpandRegionReq
);
822 REQUEST_SIZE_MATCH (xXFixesExpandRegionReq
);
823 VERIFY_REGION(pSource
, stuff
->source
, client
, DixReadAccess
);
824 VERIFY_REGION(pDestination
, stuff
->destination
, client
, DixWriteAccess
);
826 nBoxes
= REGION_NUM_RECTS(pSource
);
827 pSrc
= REGION_RECTS(pSource
);
830 pTmp
= xalloc (nBoxes
* sizeof (BoxRec
));
833 for (i
= 0; i
< nBoxes
; i
++)
835 pTmp
[i
].x1
= pSrc
[i
].x1
- stuff
->left
;
836 pTmp
[i
].x2
= pSrc
[i
].x2
+ stuff
->right
;
837 pTmp
[i
].y1
= pSrc
[i
].y1
- stuff
->top
;
838 pTmp
[i
].y2
= pSrc
[i
].y2
+ stuff
->bottom
;
840 REGION_EMPTY (pScreen
, pDestination
);
841 for (i
= 0; i
< nBoxes
; i
++)
844 REGION_INIT (pScreen
, &r
, &pTmp
[i
], 0);
845 REGION_UNION (pScreen
, pDestination
, pDestination
, &r
);
850 ret
= client
->noClientException
;
855 SProcXFixesExpandRegion (ClientPtr client
)
858 REQUEST (xXFixesExpandRegionReq
);
860 swaps (&stuff
->length
, n
);
861 REQUEST_SIZE_MATCH (xXFixesExpandRegionReq
);
862 swapl (&stuff
->source
, n
);
863 swapl (&stuff
->destination
, n
);
864 swaps (&stuff
->left
, n
);
865 swaps (&stuff
->right
, n
);
866 swaps (&stuff
->top
, n
);
867 swaps (&stuff
->bottom
, n
);
868 return (*ProcXFixesVector
[stuff
->xfixesReqType
]) (client
);