summaryrefslogtreecommitdiff
path: root/damageext
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-01-05 18:12:04 -0800
committerEric Anholt <eric@anholt.net>2007-01-05 18:26:58 -0800
commit0b73a7eb17fd848c6bdc6a65ba835aa2cbfc3cfd (patch)
treec5a69aff071fafd724581f8152337b84bcfc4107 /damageext
parentdfb2c10413e22afd8d486a982870f874326d5ef4 (diff)
Add support for the DamagePost (XDamage 1.1) request.
This makes damageproto >= 1.1 a requirement to build.
Diffstat (limited to 'damageext')
-rwxr-xr-xdamageext/damageext.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 6083693a4..a90dfb823 100755
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -279,10 +279,35 @@ ProcDamageSubtract (ClientPtr client)
return (client->noClientException);
}
+static int
+ProcDamagePost (ClientPtr client)
+{
+ REQUEST(xDamagePostReq);
+ DrawablePtr pDrawable;
+ RegionPtr pRegion;
+ int rc;
+
+ REQUEST_SIZE_MATCH(xDamagePostReq);
+ VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ /* The region is relative to the drawable origin, so translate it out to
+ * screen coordinates like damage expects.
+ */
+ REGION_TRANSLATE(pScreen, pRegion, pDrawable->x, pDrawable->y);
+ DamageDamageRegion(pDrawable, pRegion);
+ REGION_TRANSLATE(pScreen, pRegion, -pDrawable->x, -pDrawable->y);
+
+ return (client->noClientException);
+}
+
/* Major version controls available requests */
static const int version_requests[] = {
X_DamageQueryVersion, /* before client sends QueryVersion */
- X_DamageSubtract, /* Version 1 */
+ X_DamagePost, /* Version 1 */
};
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
@@ -293,6 +318,8 @@ int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
ProcDamageCreate,
ProcDamageDestroy,
ProcDamageSubtract,
+/*************** Version 1.1 ****************/
+ ProcDamagePost,
};
@@ -361,12 +388,27 @@ SProcDamageSubtract (ClientPtr client)
return (*ProcDamageVector[stuff->damageReqType]) (client);
}
+static int
+SProcDamagePost (ClientPtr client)
+{
+ register int n;
+ REQUEST(xDamagePostReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDamageSubtractReq);
+ swapl (&stuff->drawable, n);
+ swapl (&stuff->region, n);
+ return (*ProcDamageVector[stuff->damageReqType]) (client);
+}
+
int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
/*************** Version 1 ******************/
SProcDamageQueryVersion,
SProcDamageCreate,
SProcDamageDestroy,
SProcDamageSubtract,
+/*************** Version 1.1 ****************/
+ SProcDamagePost,
};
static int