aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xfixes/region.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/xfixes/region.c')
-rw-r--r--xorg-server/xfixes/region.c758
1 files changed, 384 insertions, 374 deletions
diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c
index 4c2263702..624109de1 100644
--- a/xorg-server/xfixes/region.c
+++ b/xorg-server/xfixes/region.c
@@ -28,6 +28,7 @@
#include "scrnintstr.h"
#include <picturestr.h>
extern int RenderErrBase;
+
#include <regionstr.h>
#include <gcstruct.h>
#include <window.h>
@@ -35,31 +36,31 @@ extern int RenderErrBase;
RESTYPE RegionResType;
static int
-RegionResFree (pointer data, XID id)
+RegionResFree(pointer data, XID id)
{
- RegionPtr pRegion = (RegionPtr) data;
+ RegionPtr pRegion = (RegionPtr) data;
RegionDestroy(pRegion);
return Success;
}
RegionPtr
-XFixesRegionCopy (RegionPtr pRegion)
+XFixesRegionCopy(RegionPtr pRegion)
{
- RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
- RegionNumRects(pRegion));
+ RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
+ RegionNumRects(pRegion));
+
if (!pNew)
- return 0;
- if (!RegionCopy(pNew, pRegion))
- {
- RegionDestroy(pNew);
- return 0;
+ return 0;
+ if (!RegionCopy(pNew, pRegion)) {
+ RegionDestroy(pNew);
+ return 0;
}
return pNew;
}
Bool
-XFixesRegionInit (void)
+XFixesRegionInit(void)
{
RegionResType = CreateNewResourceType(RegionResFree, "XFixesRegion");
@@ -67,34 +68,35 @@ XFixesRegionInit (void)
}
int
-ProcXFixesCreateRegion (ClientPtr client)
+ProcXFixesCreateRegion(ClientPtr client)
{
- int things;
- RegionPtr pRegion;
- REQUEST (xXFixesCreateRegionReq);
-
+ int things;
+ RegionPtr pRegion;
+
+ REQUEST(xXFixesCreateRegionReq);
+
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
-
- things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+
+ things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pRegion)
- return BadAlloc;
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegion (ClientPtr client)
+SProcXFixesCreateRegion(ClientPtr client)
{
REQUEST(xXFixesCreateRegionReq);
-
+
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
swapl(&stuff->region);
@@ -103,221 +105,221 @@ SProcXFixesCreateRegion (ClientPtr client)
}
int
-ProcXFixesCreateRegionFromBitmap (ClientPtr client)
+ProcXFixesCreateRegionFromBitmap(ClientPtr client)
{
- RegionPtr pRegion;
- PixmapPtr pPixmap;
+ RegionPtr pRegion;
+ PixmapPtr pPixmap;
int rc;
- REQUEST (xXFixesCreateRegionFromBitmapReq);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST(xXFixesCreateRegionFromBitmapReq);
- rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP,
- client, DixReadAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->bitmap;
- return rc;
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+
+ rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->bitmap, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->bitmap;
+ return rc;
}
if (pPixmap->drawable.depth != 1)
- return BadMatch;
+ return BadMatch;
pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap);
if (!pRegion)
- return BadAlloc;
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromBitmap (ClientPtr client)
+SProcXFixesCreateRegionFromBitmap(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromBitmapReq);
+ REQUEST(xXFixesCreateRegionFromBitmapReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
swapl(&stuff->region);
swapl(&stuff->bitmap);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromWindow (ClientPtr client)
+ProcXFixesCreateRegionFromWindow(ClientPtr client)
{
- RegionPtr pRegion;
- Bool copy = TRUE;
- WindowPtr pWin;
+ RegionPtr pRegion;
+ Bool copy = TRUE;
+ WindowPtr pWin;
int rc;
- REQUEST (xXFixesCreateRegionFromWindowReq);
-
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
- client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return rc;
+
+ REQUEST(xXFixesCreateRegionFromWindowReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+ rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+ client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->window;
+ return rc;
}
switch (stuff->kind) {
case WindowRegionBounding:
- pRegion = wBoundingShape(pWin);
- if (!pRegion)
- {
- pRegion = CreateBoundingShape (pWin);
- copy = FALSE;
- }
- break;
+ pRegion = wBoundingShape(pWin);
+ if (!pRegion) {
+ pRegion = CreateBoundingShape(pWin);
+ copy = FALSE;
+ }
+ break;
case WindowRegionClip:
- pRegion = wClipShape(pWin);
- if (!pRegion)
- {
- pRegion = CreateClipShape (pWin);
- copy = FALSE;
- }
- break;
+ pRegion = wClipShape(pWin);
+ if (!pRegion) {
+ pRegion = CreateClipShape(pWin);
+ copy = FALSE;
+ }
+ break;
default:
- client->errorValue = stuff->kind;
- return BadValue;
+ client->errorValue = stuff->kind;
+ return BadValue;
}
if (copy && pRegion)
- pRegion = XFixesRegionCopy (pRegion);
+ pRegion = XFixesRegionCopy(pRegion);
if (!pRegion)
- return BadAlloc;
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromWindow (ClientPtr client)
+SProcXFixesCreateRegionFromWindow(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromWindowReq);
+ REQUEST(xXFixesCreateRegionFromWindowReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
swapl(&stuff->region);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromGC (ClientPtr client)
+ProcXFixesCreateRegionFromGC(ClientPtr client)
{
- RegionPtr pRegion, pClip;
- GCPtr pGC;
- int rc;
- REQUEST (xXFixesCreateRegionFromGCReq);
+ RegionPtr pRegion, pClip;
+ GCPtr pGC;
+ int rc;
+
+ REQUEST(xXFixesCreateRegionFromGCReq);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
-
+ return rc;
+
switch (pGC->clientClipType) {
case CT_PIXMAP:
- pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
case CT_REGION:
- pClip = (RegionPtr) pGC->clientClip;
- pRegion = XFixesRegionCopy (pClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pClip = (RegionPtr) pGC->clientClip;
+ pRegion = XFixesRegionCopy(pClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
default:
- return BadImplementation; /* assume sane server bits */
+ return BadImplementation; /* assume sane server bits */
}
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromGC (ClientPtr client)
+SProcXFixesCreateRegionFromGC(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromGCReq);
+ REQUEST(xXFixesCreateRegionFromGCReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
swapl(&stuff->region);
swapl(&stuff->gc);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromPicture (ClientPtr client)
+ProcXFixesCreateRegionFromPicture(ClientPtr client)
{
- RegionPtr pRegion;
- PicturePtr pPicture;
- REQUEST (xXFixesCreateRegionFromPictureReq);
+ RegionPtr pRegion;
+ PicturePtr pPicture;
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST(xXFixesCreateRegionFromPictureReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
-
+
switch (pPicture->clientClipType) {
case CT_PIXMAP:
- pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
- (PixmapPtr) pPicture->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
+ (PixmapPtr) pPicture->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
case CT_REGION:
- pRegion = XFixesRegionCopy ((RegionPtr) pPicture->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = XFixesRegionCopy((RegionPtr) pPicture->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
default:
- return BadImplementation; /* assume sane server bits */
+ return BadImplementation; /* assume sane server bits */
}
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromPicture (ClientPtr client)
+SProcXFixesCreateRegionFromPicture(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromPictureReq);
+ REQUEST(xXFixesCreateRegionFromPictureReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
swapl(&stuff->region);
swapl(&stuff->picture);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesDestroyRegion (ClientPtr client)
+ProcXFixesDestroyRegion(ClientPtr client)
{
- REQUEST (xXFixesDestroyRegionReq);
- RegionPtr pRegion;
+ REQUEST(xXFixesDestroyRegionReq);
+ RegionPtr pRegion;
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
- FreeResource (stuff->region, RT_NONE);
+ FreeResource(stuff->region, RT_NONE);
return Success;
}
int
-SProcXFixesDestroyRegion (ClientPtr client)
+SProcXFixesDestroyRegion(ClientPtr client)
{
- REQUEST (xXFixesDestroyRegionReq);
+ REQUEST(xXFixesDestroyRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
@@ -326,36 +328,36 @@ SProcXFixesDestroyRegion (ClientPtr client)
}
int
-ProcXFixesSetRegion (ClientPtr client)
+ProcXFixesSetRegion(ClientPtr client)
{
- int things;
- RegionPtr pRegion, pNew;
- REQUEST (xXFixesSetRegionReq);
+ int things;
+ RegionPtr pRegion, pNew;
+
+ REQUEST(xXFixesSetRegionReq);
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
-
- things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);
+
+ things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pNew)
- return BadAlloc;
- if (!RegionCopy(pRegion, pNew))
- {
- RegionDestroy(pNew);
- return BadAlloc;
+ return BadAlloc;
+ if (!RegionCopy(pRegion, pNew)) {
+ RegionDestroy(pNew);
+ return BadAlloc;
}
RegionDestroy(pNew);
return Success;
}
int
-SProcXFixesSetRegion (ClientPtr client)
+SProcXFixesSetRegion(ClientPtr client)
{
- REQUEST (xXFixesSetRegionReq);
+ REQUEST(xXFixesSetRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
@@ -365,24 +367,25 @@ SProcXFixesSetRegion (ClientPtr client)
}
int
-ProcXFixesCopyRegion (ClientPtr client)
+ProcXFixesCopyRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- REQUEST (xXFixesCopyRegionReq);
-
+ RegionPtr pSource, pDestination;
+
+ REQUEST(xXFixesCopyRegionReq);
+
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
if (!RegionCopy(pDestination, pSource))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
int
-SProcXFixesCopyRegion (ClientPtr client)
+SProcXFixesCopyRegion(ClientPtr client)
{
- REQUEST (xXFixesCopyRegionReq);
+ REQUEST(xXFixesCopyRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq);
@@ -392,41 +395,42 @@ SProcXFixesCopyRegion (ClientPtr client)
}
int
-ProcXFixesCombineRegion (ClientPtr client)
+ProcXFixesCombineRegion(ClientPtr client)
{
- RegionPtr pSource1, pSource2, pDestination;
- REQUEST (xXFixesCombineRegionReq);
+ RegionPtr pSource1, pSource2, pDestination;
- REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
+ REQUEST(xXFixesCombineRegionReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess);
VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
switch (stuff->xfixesReqType) {
case X_XFixesUnionRegion:
- if (!RegionUnion(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionUnion(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
case X_XFixesIntersectRegion:
- if (!RegionIntersect(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionIntersect(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
case X_XFixesSubtractRegion:
- if (!RegionSubtract(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionSubtract(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
}
-
+
return Success;
}
int
-SProcXFixesCombineRegion (ClientPtr client)
+SProcXFixesCombineRegion(ClientPtr client)
{
- REQUEST (xXFixesCombineRegionReq);
+ REQUEST(xXFixesCombineRegionReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
swapl(&stuff->source1);
swapl(&stuff->source2);
swapl(&stuff->destination);
@@ -434,10 +438,11 @@ SProcXFixesCombineRegion (ClientPtr client)
}
int
-ProcXFixesInvertRegion (ClientPtr client)
+ProcXFixesInvertRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- BoxRec bounds;
+ RegionPtr pSource, pDestination;
+ BoxRec bounds;
+
REQUEST(xXFixesInvertRegionReq);
REQUEST_SIZE_MATCH(xXFixesInvertRegionReq);
@@ -448,23 +453,23 @@ ProcXFixesInvertRegion (ClientPtr client)
bounds.x1 = stuff->x;
bounds.y1 = stuff->y;
if ((int) stuff->x + (int) stuff->width > MAXSHORT)
- bounds.x2 = MAXSHORT;
+ bounds.x2 = MAXSHORT;
else
- bounds.x2 = stuff->x + stuff->width;
-
+ bounds.x2 = stuff->x + stuff->width;
+
if ((int) stuff->y + (int) stuff->height > MAXSHORT)
- bounds.y2 = MAXSHORT;
+ bounds.y2 = MAXSHORT;
else
- bounds.y2 = stuff->y + stuff->height;
+ bounds.y2 = stuff->y + stuff->height;
if (!RegionInverse(pDestination, pSource, &bounds))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
int
-SProcXFixesInvertRegion (ClientPtr client)
+SProcXFixesInvertRegion(ClientPtr client)
{
REQUEST(xXFixesInvertRegionReq);
@@ -480,9 +485,10 @@ SProcXFixesInvertRegion (ClientPtr client)
}
int
-ProcXFixesTranslateRegion (ClientPtr client)
+ProcXFixesTranslateRegion(ClientPtr client)
{
- RegionPtr pRegion;
+ RegionPtr pRegion;
+
REQUEST(xXFixesTranslateRegionReq);
REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
@@ -493,7 +499,7 @@ ProcXFixesTranslateRegion (ClientPtr client)
}
int
-SProcXFixesTranslateRegion (ClientPtr client)
+SProcXFixesTranslateRegion(ClientPtr client)
{
REQUEST(xXFixesTranslateRegionReq);
@@ -506,9 +512,10 @@ SProcXFixesTranslateRegion (ClientPtr client)
}
int
-ProcXFixesRegionExtents (ClientPtr client)
+ProcXFixesRegionExtents(ClientPtr client)
{
- RegionPtr pSource, pDestination;
+ RegionPtr pSource, pDestination;
+
REQUEST(xXFixesRegionExtentsReq);
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
@@ -521,10 +528,10 @@ ProcXFixesRegionExtents (ClientPtr client)
}
int
-SProcXFixesRegionExtents (ClientPtr client)
+SProcXFixesRegionExtents(ClientPtr client)
{
REQUEST(xXFixesRegionExtentsReq);
-
+
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
swapl(&stuff->source);
@@ -533,27 +540,27 @@ SProcXFixesRegionExtents (ClientPtr client)
}
int
-ProcXFixesFetchRegion (ClientPtr client)
+ProcXFixesFetchRegion(ClientPtr client)
{
- RegionPtr pRegion;
+ RegionPtr pRegion;
xXFixesFetchRegionReply *reply;
- xRectangle *pRect;
- BoxPtr pExtent;
- BoxPtr pBox;
- int i, nBox;
+ xRectangle *pRect;
+ BoxPtr pExtent;
+ BoxPtr pBox;
+ int i, nBox;
+
REQUEST(xXFixesFetchRegionReq);
REQUEST_SIZE_MATCH(xXFixesFetchRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);
pExtent = RegionExtents(pRegion);
- pBox = RegionRects (pRegion);
- nBox = RegionNumRects (pRegion);
-
- reply = malloc(sizeof (xXFixesFetchRegionReply) +
- nBox * sizeof (xRectangle));
+ pBox = RegionRects(pRegion);
+ nBox = RegionNumRects(pRegion);
+
+ reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle));
if (!reply)
- return BadAlloc;
+ return BadAlloc;
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = nBox << 1;
@@ -563,31 +570,29 @@ ProcXFixesFetchRegion (ClientPtr client)
reply->height = pExtent->y2 - pExtent->y1;
pRect = (xRectangle *) (reply + 1);
- for (i = 0; i < nBox; i++)
- {
- pRect[i].x = pBox[i].x1;
- pRect[i].y = pBox[i].y1;
- pRect[i].width = pBox[i].x2 - pBox[i].x1;
- pRect[i].height = pBox[i].y2 - pBox[i].y1;
+ for (i = 0; i < nBox; i++) {
+ pRect[i].x = pBox[i].x1;
+ pRect[i].y = pBox[i].y1;
+ pRect[i].width = pBox[i].x2 - pBox[i].x1;
+ pRect[i].height = pBox[i].y2 - pBox[i].y1;
}
- if (client->swapped)
- {
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swaps(&reply->x);
- swaps(&reply->y);
- swaps(&reply->width);
- swaps(&reply->height);
- SwapShorts ((INT16 *) pRect, nBox * 4);
+ if (client->swapped) {
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swaps(&reply->x);
+ swaps(&reply->y);
+ swaps(&reply->width);
+ swaps(&reply->height);
+ SwapShorts((INT16 *) pRect, nBox * 4);
}
- (void) WriteToClient(client, sizeof (xXFixesFetchRegionReply) +
- nBox * sizeof (xRectangle), (char *) reply);
+ (void) WriteToClient(client, sizeof(xXFixesFetchRegionReply) +
+ nBox * sizeof(xRectangle), (char *) reply);
free(reply);
return Success;
}
int
-SProcXFixesFetchRegion (ClientPtr client)
+SProcXFixesFetchRegion(ClientPtr client)
{
REQUEST(xXFixesFetchRegionReq);
@@ -598,38 +603,39 @@ SProcXFixesFetchRegion (ClientPtr client)
}
int
-ProcXFixesSetGCClipRegion (ClientPtr client)
+ProcXFixesSetGCClipRegion(ClientPtr client)
{
- GCPtr pGC;
- RegionPtr pRegion;
- ChangeGCVal vals[2];
- int rc;
+ GCPtr pGC;
+ RegionPtr pRegion;
+ ChangeGCVal vals[2];
+ int rc;
+
REQUEST(xXFixesSetGCClipRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess);
+ VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
- if (pRegion)
- {
- pRegion = XFixesRegionCopy (pRegion);
- if (!pRegion)
- return BadAlloc;
+ if (pRegion) {
+ pRegion = XFixesRegionCopy(pRegion);
+ if (!pRegion)
+ return BadAlloc;
}
-
+
vals[0].val = stuff->xOrigin;
vals[1].val = stuff->yOrigin;
- ChangeGC (NullClient, pGC, GCClipXOrigin|GCClipYOrigin, vals);
- (*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (pointer)pRegion, 0);
+ ChangeGC(NullClient, pGC, GCClipXOrigin | GCClipYOrigin, vals);
+ (*pGC->funcs->ChangeClip) (pGC, pRegion ? CT_REGION : CT_NONE,
+ (pointer) pRegion, 0);
return Success;
}
int
-SProcXFixesSetGCClipRegion (ClientPtr client)
+SProcXFixesSetGCClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetGCClipRegionReq);
@@ -642,87 +648,84 @@ SProcXFixesSetGCClipRegion (ClientPtr client)
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-typedef RegionPtr (*CreateDftPtr)(WindowPtr pWin);
+typedef RegionPtr (*CreateDftPtr) (WindowPtr pWin);
int
-ProcXFixesSetWindowShapeRegion (ClientPtr client)
+ProcXFixesSetWindowShapeRegion(ClientPtr client)
{
- WindowPtr pWin;
- RegionPtr pRegion;
- RegionPtr *pDestRegion;
+ WindowPtr pWin;
+ RegionPtr pRegion;
+ RegionPtr *pDestRegion;
int rc;
+
REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->dest, RT_WINDOW,
- client, DixSetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->dest;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &pWin, stuff->dest, RT_WINDOW,
+ client, DixSetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->dest;
+ return rc;
}
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess);
switch (stuff->destKind) {
case ShapeBounding:
case ShapeClip:
case ShapeInput:
- break;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
- if (pRegion)
- {
- pRegion = XFixesRegionCopy (pRegion);
- if (!pRegion)
- return BadAlloc;
- if (!pWin->optional)
- MakeWindowOptional (pWin);
- switch (stuff->destKind) {
- default:
- case ShapeBounding:
- pDestRegion = &pWin->optional->boundingShape;
- break;
- case ShapeClip:
- pDestRegion = &pWin->optional->clipShape;
- break;
- case ShapeInput:
- pDestRegion = &pWin->optional->inputShape;
- break;
- }
- if (stuff->xOff || stuff->yOff)
- RegionTranslate(pRegion, stuff->xOff, stuff->yOff);
+ if (pRegion) {
+ pRegion = XFixesRegionCopy(pRegion);
+ if (!pRegion)
+ return BadAlloc;
+ if (!pWin->optional)
+ MakeWindowOptional(pWin);
+ switch (stuff->destKind) {
+ default:
+ case ShapeBounding:
+ pDestRegion = &pWin->optional->boundingShape;
+ break;
+ case ShapeClip:
+ pDestRegion = &pWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ pDestRegion = &pWin->optional->inputShape;
+ break;
+ }
+ if (stuff->xOff || stuff->yOff)
+ RegionTranslate(pRegion, stuff->xOff, stuff->yOff);
}
- else
- {
- if (pWin->optional)
- {
- switch (stuff->destKind) {
- default:
- case ShapeBounding:
- pDestRegion = &pWin->optional->boundingShape;
- break;
- case ShapeClip:
- pDestRegion = &pWin->optional->clipShape;
- break;
- case ShapeInput:
- pDestRegion = &pWin->optional->inputShape;
- break;
- }
- }
- else
- pDestRegion = &pRegion; /* a NULL region pointer */
+ else {
+ if (pWin->optional) {
+ switch (stuff->destKind) {
+ default:
+ case ShapeBounding:
+ pDestRegion = &pWin->optional->boundingShape;
+ break;
+ case ShapeClip:
+ pDestRegion = &pWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ pDestRegion = &pWin->optional->inputShape;
+ break;
+ }
+ }
+ else
+ pDestRegion = &pRegion; /* a NULL region pointer */
}
if (*pDestRegion)
- RegionDestroy(*pDestRegion);
+ RegionDestroy(*pDestRegion);
*pDestRegion = pRegion;
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
- SendShapeNotify (pWin, stuff->destKind);
+ SendShapeNotify(pWin, stuff->destKind);
return Success;
}
int
-SProcXFixesSetWindowShapeRegion (ClientPtr client)
+SProcXFixesSetWindowShapeRegion(ClientPtr client)
{
REQUEST(xXFixesSetWindowShapeRegionReq);
@@ -736,27 +739,28 @@ SProcXFixesSetWindowShapeRegion (ClientPtr client)
}
int
-ProcXFixesSetPictureClipRegion (ClientPtr client)
+ProcXFixesSetPictureClipRegion(ClientPtr client)
{
- PicturePtr pPicture;
- RegionPtr pRegion;
+ PicturePtr pPicture;
+ RegionPtr pRegion;
+
REQUEST(xXFixesSetPictureClipRegionReq);
-
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
-
- return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin,
- pRegion);
+
+ return SetPictureClipRegion(pPicture, stuff->xOrigin, stuff->yOrigin,
+ pRegion);
}
int
-SProcXFixesSetPictureClipRegion (ClientPtr client)
+SProcXFixesSetPictureClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetPictureClipRegionReq);
-
+
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
swapl(&stuff->picture);
swapl(&stuff->region);
swaps(&stuff->xOrigin);
@@ -765,52 +769,51 @@ SProcXFixesSetPictureClipRegion (ClientPtr client)
}
int
-ProcXFixesExpandRegion (ClientPtr client)
+ProcXFixesExpandRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- REQUEST (xXFixesExpandRegionReq);
- BoxPtr pTmp;
- BoxPtr pSrc;
- int nBoxes;
- int i;
+ RegionPtr pSource, pDestination;
+
+ REQUEST(xXFixesExpandRegionReq);
+ BoxPtr pTmp;
+ BoxPtr pSrc;
+ int nBoxes;
+ int i;
- REQUEST_SIZE_MATCH (xXFixesExpandRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
nBoxes = RegionNumRects(pSource);
pSrc = RegionRects(pSource);
- if (nBoxes)
- {
- pTmp = malloc(nBoxes * sizeof (BoxRec));
- if (!pTmp)
- return BadAlloc;
- for (i = 0; i < nBoxes; i++)
- {
- pTmp[i].x1 = pSrc[i].x1 - stuff->left;
- pTmp[i].x2 = pSrc[i].x2 + stuff->right;
- pTmp[i].y1 = pSrc[i].y1 - stuff->top;
- pTmp[i].y2 = pSrc[i].y2 + stuff->bottom;
- }
- RegionEmpty(pDestination);
- for (i = 0; i < nBoxes; i++)
- {
- RegionRec r;
- RegionInit(&r, &pTmp[i], 0);
- RegionUnion(pDestination, pDestination, &r);
- }
- free(pTmp);
+ if (nBoxes) {
+ pTmp = malloc(nBoxes * sizeof(BoxRec));
+ if (!pTmp)
+ return BadAlloc;
+ for (i = 0; i < nBoxes; i++) {
+ pTmp[i].x1 = pSrc[i].x1 - stuff->left;
+ pTmp[i].x2 = pSrc[i].x2 + stuff->right;
+ pTmp[i].y1 = pSrc[i].y1 - stuff->top;
+ pTmp[i].y2 = pSrc[i].y2 + stuff->bottom;
+ }
+ RegionEmpty(pDestination);
+ for (i = 0; i < nBoxes; i++) {
+ RegionRec r;
+
+ RegionInit(&r, &pTmp[i], 0);
+ RegionUnion(pDestination, pDestination, &r);
+ }
+ free(pTmp);
}
return Success;
}
int
-SProcXFixesExpandRegion (ClientPtr client)
+SProcXFixesExpandRegion(ClientPtr client)
{
- REQUEST (xXFixesExpandRegionReq);
+ REQUEST(xXFixesExpandRegionReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesExpandRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
swapl(&stuff->source);
swapl(&stuff->destination);
swaps(&stuff->left);
@@ -825,73 +828,80 @@ SProcXFixesExpandRegion (ClientPtr client)
#include "panoramiXsrv.h"
int
-PanoramiXFixesSetGCClipRegion (ClientPtr client)
+PanoramiXFixesSetGCClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetGCClipRegionReq);
- int result = Success, j;
- PanoramiXRes *gc;
+ int result = Success, j;
+ PanoramiXRes *gc;
+
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
- if ((result = dixLookupResourceByType((void **)&gc, stuff->gc, XRT_GC,
- client, DixWriteAccess))) {
- client->errorValue = stuff->gc;
- return result;
+ if ((result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
+ client, DixWriteAccess))) {
+ client->errorValue = stuff->gc;
+ return result;
}
FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id;
result = (*PanoramiXSaveXFixesVector[X_XFixesSetGCClipRegion]) (client);
- if(result != Success) break;
+ if (result != Success)
+ break;
}
return result;
}
int
-PanoramiXFixesSetWindowShapeRegion (ClientPtr client)
+PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
{
- int result = Success, j;
- PanoramiXRes *win;
+ int result = Success, j;
+ PanoramiXRes *win;
+
REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
- if ((result = dixLookupResourceByType((void **)&win, stuff->dest,
- XRT_WINDOW, client,
- DixWriteAccess))) {
- client->errorValue = stuff->dest;
- return result;
+ if ((result = dixLookupResourceByType((void **) &win, stuff->dest,
+ XRT_WINDOW, client,
+ DixWriteAccess))) {
+ client->errorValue = stuff->dest;
+ return result;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->dest = win->info[j].id;
- result = (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
- if(result != Success) break;
+ stuff->dest = win->info[j].id;
+ result =
+ (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
+ if (result != Success)
+ break;
}
return result;
}
int
-PanoramiXFixesSetPictureClipRegion (ClientPtr client)
+PanoramiXFixesSetPictureClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetPictureClipRegionReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
- if ((result = dixLookupResourceByType((void **)&pict, stuff->picture,
- XRT_PICTURE, client,
- DixWriteAccess))) {
- client->errorValue = stuff->picture;
- return result;
+ if ((result = dixLookupResourceByType((void **) &pict, stuff->picture,
+ XRT_PICTURE, client,
+ DixWriteAccess))) {
+ client->errorValue = stuff->picture;
+ return result;
}
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
+ if (result != Success)
+ break;
}
return result;