[PATCH xserver 05/17] Test: Input: Test up to supported server, not protocol, events

Daniel Stone daniel at fooishbar.org
Tue Dec 28 09:57:56 PST 2010


When building against a newer inputproto, the server may support fewer
than XI_LASTEVENT events.  We already have XI2LASTEVENT for the highest
event number supported by the server, so use that instead.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 test/xi2/protocol-xiselectevents.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c
index fe1c26d..f951a14 100644
--- a/test/xi2/protocol-xiselectevents.c
+++ b/test/xi2/protocol-xiselectevents.c
@@ -131,7 +131,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
 {
     int i, j;
     xXIEventMask *mask;
-    int nmasks = (XI_LASTEVENT + 7)/8;
+    int nmasks = (XI2LASTEVENT + 7)/8;
     unsigned char *bits;
 
     mask = (xXIEventMask*)&req[1];
@@ -150,14 +150,14 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         request_XISelectEvent(req, Success);
 
         /* Test 1:
-         * mask may be larger than needed for XI_LASTEVENT.
+         * mask may be larger than needed for XI2LASTEVENT.
          * Test setting each valid mask bit, while leaving unneeded bits 0.
          * -> Success
          */
         bits = (unsigned char*)&mask[1];
         mask->mask_len = (nmasks + 3)/4 * 10;
         memset(bits, 0, mask->mask_len * 4);
-        for (j = 0; j <= XI_LASTEVENT; j++)
+        for (j = 0; j <= XI2LASTEVENT; j++)
         {
             SetBit(bits, j);
             request_XISelectEvent(req, Success);
@@ -165,7 +165,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         }
 
         /* Test 2:
-         * mask may be larger than needed for XI_LASTEVENT.
+         * mask may be larger than needed for XI2LASTEVENT.
          * Test setting all valid mask bits, while leaving unneeded bits 0.
          * -> Success
          */
@@ -173,21 +173,21 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         mask->mask_len = (nmasks + 3)/4 * 10;
         memset(bits, 0, mask->mask_len * 4);
 
-        for (j = 0; j <= XI_LASTEVENT; j++)
+        for (j = 0; j <= XI2LASTEVENT; j++)
         {
             SetBit(bits, j);
             request_XISelectEvent(req, Success);
         }
 
         /* Test 3:
-         * mask is larger than needed for XI_LASTEVENT. If any unneeded bit
+         * mask is larger than needed for XI2LASTEVENT. If any unneeded bit
          * is set -> BadValue
          */
         bits = (unsigned char*)&mask[1];
         mask->mask_len = (nmasks + 3)/4 * 10;
         memset(bits, 0, mask->mask_len * 4);
 
-        for (j = XI_LASTEVENT + 1; j < mask->mask_len * 4; j++)
+        for (j = XI2LASTEVENT + 1; j < mask->mask_len * 4; j++)
         {
             SetBit(bits, j);
             request_XISelectEvent(req, BadValue);
@@ -200,7 +200,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         bits = (unsigned char*)&mask[1];
         mask->mask_len = (nmasks + 3)/4;
         memset(bits, 0, mask->mask_len * 4);
-        for (j = 0; j <= XI_LASTEVENT; j++)
+        for (j = 0; j <= XI2LASTEVENT; j++)
         {
             SetBit(bits, j);
             request_XISelectEvent(req, Success);
@@ -228,7 +228,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         bits = (unsigned char*)&mask[1];
         mask->mask_len = (nmasks + 3)/4;
         memset(bits, 0, mask->mask_len * 4);
-        for (j = 0; j <= XI_LASTEVENT; j++)
+        for (j = 0; j <= XI2LASTEVENT; j++)
             SetBit(bits, j);
         ClearBit(bits, XI_HierarchyChanged);
         for (j = 1; j < 6; j++)
-- 
1.7.2.3



More information about the xorg-devel mailing list