[PATCH 2/5] cursor: CreatePointerBarrier has a variable request length

Jasper St. Pierre jstpierre at mecheye.net
Sat Nov 3 15:39:33 PDT 2012


From: "Jasper St. Pierre" <jstpierre at mecheye.net>

Support this, and swap the devices in the SProc as well. Don't
actually do anything with the devices just yet -- specifying any
should still emit a BadImplementation.

Based on a patch by Peter Hutterer <peter.hutterer at who-t.net>

Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.net>
---
 xfixes/cursor.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index c45da27..9d7c0f0 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1279,7 +1279,7 @@ ProcXFixesCreatePointerBarrier(ClientPtr client)
 
     REQUEST(xXFixesCreatePointerBarrierReq);
 
-    REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
     LEGAL_NEW_RESOURCE(stuff->barrier, client);
 
     err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
@@ -1318,9 +1318,13 @@ int
 SProcXFixesCreatePointerBarrier(ClientPtr client)
 {
     REQUEST(xXFixesCreatePointerBarrierReq);
+    int i;
+    CARD16 *in_devices = (CARD16 *) &stuff[1];
 
     swaps(&stuff->length);
-    REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+    swaps(&stuff->num_devices);
+    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
+
     swapl(&stuff->barrier);
     swapl(&stuff->window);
     swaps(&stuff->x1);
@@ -1328,6 +1332,10 @@ SProcXFixesCreatePointerBarrier(ClientPtr client)
     swaps(&stuff->x2);
     swaps(&stuff->y2);
     swapl(&stuff->directions);
+    for (i = 0; i < stuff->num_devices; i++) {
+        swapl(in_devices + i);
+    }
+
     return ProcXFixesVector[stuff->xfixesReqType] (client);
 }
 
-- 
1.7.12.1



More information about the xorg-devel mailing list