summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorAdam Jackson <ajax@nwnk.net>2005-06-10 04:01:14 +0000
committerAdam Jackson <ajax@nwnk.net>2005-06-10 04:01:14 +0000
commit988ffddfe082fb27fadf9aa60ab22dce6855508c (patch)
tree59390df386beab4f68b7e6ee98aba6f81f006b70 /Xext
parentd24ed90547122832d4168ad761f68e107bb1a2db (diff)
Bug #2799: Input shape. (Keith Packard)
Diffstat (limited to 'Xext')
-rw-r--r--Xext/shape.c95
1 files changed, 78 insertions, 17 deletions
diff --git a/Xext/shape.c b/Xext/shape.c
index 1e8cdb1bd..50a403443 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -320,7 +320,6 @@ ProcShapeRectangles (client)
RegionPtr srcRgn;
RegionPtr *destRgn;
CreateDftPtr createDefault;
- int destBounding;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
UpdateCurrentTime();
@@ -329,13 +328,14 @@ ProcShapeRectangles (client)
return BadWindow;
switch (stuff->destKind) {
case ShapeBounding:
- destBounding = 1;
createDefault = CreateBoundingShape;
break;
case ShapeClip:
- destBounding = 0;
createDefault = CreateClipShape;
break;
+ case ShapeInput:
+ createDefault = CreateBoundingShape;
+ break;
default:
client->errorValue = stuff->destKind;
return BadValue;
@@ -359,10 +359,19 @@ ProcShapeRectangles (client)
if (!pWin->optional)
MakeWindowOptional (pWin);
- if (destBounding)
+ switch (stuff->destKind) {
+ case ShapeBounding:
destRgn = &pWin->optional->boundingShape;
- else
+ break;
+ case ShapeClip:
destRgn = &pWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ destRgn = &pWin->optional->inputShape;
+ break;
+ default:
+ return BadValue;
+ }
return RegionOperate (client, pWin, (int)stuff->destKind,
destRgn, srcRgn, (int)stuff->op,
@@ -410,7 +419,6 @@ ProcShapeMask (client)
RegionPtr *destRgn;
PixmapPtr pPixmap;
CreateDftPtr createDefault;
- int destBounding;
REQUEST_SIZE_MATCH (xShapeMaskReq);
UpdateCurrentTime();
@@ -419,13 +427,14 @@ ProcShapeMask (client)
return BadWindow;
switch (stuff->destKind) {
case ShapeBounding:
- destBounding = 1;
createDefault = CreateBoundingShape;
break;
case ShapeClip:
- destBounding = 0;
createDefault = CreateClipShape;
break;
+ case ShapeInput:
+ createDefault = CreateBoundingShape;
+ break;
default:
client->errorValue = stuff->destKind;
return BadValue;
@@ -448,10 +457,19 @@ ProcShapeMask (client)
if (!pWin->optional)
MakeWindowOptional (pWin);
- if (destBounding)
+ switch (stuff->destKind) {
+ case ShapeBounding:
destRgn = &pWin->optional->boundingShape;
- else
+ break;
+ case ShapeClip:
destRgn = &pWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ destRgn = &pWin->optional->inputShape;
+ break;
+ default:
+ return BadValue;
+ }
return RegionOperate (client, pWin, (int)stuff->destKind,
destRgn, srcRgn, (int)stuff->op,
@@ -508,7 +526,6 @@ ProcShapeCombine (client)
CreateDftPtr createDefault;
CreateDftPtr createSrc;
RegionPtr tmp;
- int destBounding;
REQUEST_SIZE_MATCH (xShapeCombineReq);
UpdateCurrentTime();
@@ -519,13 +536,14 @@ ProcShapeCombine (client)
MakeWindowOptional (pDestWin);
switch (stuff->destKind) {
case ShapeBounding:
- destBounding = 1;
createDefault = CreateBoundingShape;
break;
case ShapeClip:
- destBounding = 0;
createDefault = CreateClipShape;
break;
+ case ShapeInput:
+ createDefault = CreateBoundingShape;
+ break;
default:
client->errorValue = stuff->destKind;
return BadValue;
@@ -544,6 +562,10 @@ ProcShapeCombine (client)
srcRgn = wClipShape (pSrcWin);
createSrc = CreateClipShape;
break;
+ case ShapeInput:
+ srcRgn = wInputShape (pSrcWin);
+ createSrc = CreateBoundingShape;
+ break;
default:
client->errorValue = stuff->srcKind;
return BadValue;
@@ -562,10 +584,19 @@ ProcShapeCombine (client)
if (!pDestWin->optional)
MakeWindowOptional (pDestWin);
- if (destBounding)
+ switch (stuff->destKind) {
+ case ShapeBounding:
destRgn = &pDestWin->optional->boundingShape;
- else
+ break;
+ case ShapeClip:
destRgn = &pDestWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ destRgn = &pDestWin->optional->inputShape;
+ break;
+ default:
+ return BadValue;
+ }
return RegionOperate (client, pDestWin, (int)stuff->destKind,
destRgn, srcRgn, (int)stuff->op,
@@ -627,6 +658,9 @@ ProcShapeOffset (client)
case ShapeClip:
srcRgn = wClipShape(pWin);
break;
+ case ShapeInput:
+ srcRgn = wInputShape (pWin);
+ break;
default:
client->errorValue = stuff->destKind;
return BadValue;
@@ -888,7 +922,8 @@ SendShapeNotify (pWin, which)
pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType);
if (!pHead)
return;
- if (which == ShapeBounding) {
+ switch (which) {
+ case ShapeBounding:
region = wBoundingShape(pWin);
if (region) {
extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
@@ -900,7 +935,8 @@ SendShapeNotify (pWin, which)
extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
shaped = xFalse;
}
- } else {
+ break;
+ case ShapeClip:
region = wClipShape(pWin);
if (region) {
extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
@@ -912,6 +948,22 @@ SendShapeNotify (pWin, which)
extents.y2 = pWin->drawable.height;
shaped = xFalse;
}
+ break;
+ case ShapeInput:
+ region = wInputShape(pWin);
+ if (region) {
+ extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ shaped = xTrue;
+ } else {
+ extents.x1 = -wBorderWidth (pWin);
+ extents.y1 = -wBorderWidth (pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
+ shaped = xFalse;
+ }
+ break;
+ default:
+ return;
}
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
client = pShapeEvent->client;
@@ -995,6 +1047,9 @@ ProcShapeGetRectangles (client)
case ShapeClip:
region = wClipShape(pWin);
break;
+ case ShapeInput:
+ region = wInputShape (pWin);
+ break;
default:
client->errorValue = stuff->kind;
return BadValue;
@@ -1017,6 +1072,12 @@ ProcShapeGetRectangles (client)
rects->width = pWin->drawable.width;
rects->height = pWin->drawable.height;
break;
+ case ShapeInput:
+ rects->x = - (int) wBorderWidth (pWin);
+ rects->y = - (int) wBorderWidth (pWin);
+ rects->width = pWin->drawable.width + wBorderWidth (pWin);
+ rects->height = pWin->drawable.height + wBorderWidth (pWin);
+ break;
}
} else {
BoxPtr box;