xserver: Branch 'master' - 4 commits

Peter Hutterer whot at kemper.freedesktop.org
Thu Jun 4 23:09:59 PDT 2009


 Xi/chdevcur.c      |    6 ++++++
 Xi/chdevhier.c     |   35 +++++++++++++++++++++++++++++++++++
 Xi/extinit.c       |    2 ++
 Xi/querydev.c      |    6 ++++++
 Xi/querydp.c       |    6 ++++++
 Xi/queryversion.c  |   17 ++++++++++++++---
 Xi/setcptr.c       |    5 +++++
 Xi/warpdevp.c      |    6 ++++++
 Xi/xiallowev.c     |    6 ++++++
 Xi/xigrabdev.c     |    9 +++++++++
 Xi/xipassivegrab.c |    9 +++++++++
 Xi/xiproperty.c    |   26 ++++++++++++++++++++++++++
 Xi/xiselectev.c    |    6 ++++++
 Xi/xisetdevfocus.c |   12 ++++++++++++
 14 files changed, 148 insertions(+), 3 deletions(-)

New commits:
commit d770d57f1701c7c8272b4ca3714f64c46c47adf1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jun 5 11:38:22 2009 +1000

    Xi: fix XIQueryVersion major/minor swapping.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/queryversion.c b/Xi/queryversion.c
index 230e207..4d644a9 100644
--- a/Xi/queryversion.c
+++ b/Xi/queryversion.c
@@ -112,7 +112,7 @@ SProcXIQueryVersion(ClientPtr client)
     swaps(&stuff->length, n);
     REQUEST_AT_LEAST_SIZE(xXIQueryVersionReq);
     swaps(&stuff->major_version, n);
-    swaps(&stuff->major_version, n);
+    swaps(&stuff->minor_version, n);
     return (ProcXIQueryVersion(client));
 }
 
commit 17d62306b602ec61e8c5b44a79c9e1edc6b63a21
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jun 5 11:31:39 2009 +1000

    Xi: add XIQueryVersion reply swapping hook.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 23704b1..549c5ca 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -511,6 +511,8 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
 	SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
     else if (rep->RepType == X_XIGetClientPointer)
         SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep);
+    else if (rep->RepType == X_XIQueryVersion)
+        SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep);
     else if (rep->RepType == X_XIQueryDevice)
         SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
     else if (rep->RepType == X_XIGrabDevice)
commit 2b459f44f3edaea137df9a28bc7adfeb1b9f1df7
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jun 5 10:15:04 2009 +1000

    Xi: return BadImplementation for deviceids 256 and above
    
    The protocol allows for 16 bit device ids, but the implementation doesn't
    yet. We need to break the input ABI once more to shift the DeviceIntRec's
    CARD8 to a CARD16, along with some changes in the privates.
    
    Once that is done, revert this patch.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/chdevcur.c b/Xi/chdevcur.c
index fdea106..9dba78b 100644
--- a/Xi/chdevcur.c
+++ b/Xi/chdevcur.c
@@ -74,6 +74,12 @@ int ProcXIChangeCursor(ClientPtr client)
     REQUEST(xXIChangeCursorReq);
     REQUEST_SIZE_MATCH(xXIChangeCursorReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess);
     if (rc != Success)
         return rc;
diff --git a/Xi/chdevhier.c b/Xi/chdevhier.c
index 927df55..bd3da08 100644
--- a/Xi/chdevhier.c
+++ b/Xi/chdevhier.c
@@ -238,6 +238,12 @@ ProcXIChangeHierarchy(ClientPtr client)
                             r->return_mode != XIFloating)
                         return BadValue;
 
+                    if (r->deviceid > 0xFF) /* FIXME */
+                    {
+                        client->errorValue = r->deviceid;
+                        return BadImplementation;
+                    }
+
                     rc = dixLookupDevice(&ptr, r->deviceid, client,
                                          DixDestroyAccess);
                     if (rc != Success)
@@ -338,6 +344,12 @@ ProcXIChangeHierarchy(ClientPtr client)
                                      newptr,
                                      newkeybd;
 
+                        if (r->return_pointer > 0xFF) /* FIXME */
+                        {
+                            client->errorValue = r->deviceid;
+                            return BadImplementation;
+                        }
+
                         rc = dixLookupDevice(&newptr, r->return_pointer,
                                              client, DixWriteAccess);
                         if (rc != Success)
@@ -350,6 +362,12 @@ ProcXIChangeHierarchy(ClientPtr client)
                             goto unwind;
                         }
 
+                        if (r->return_keyboard > 0xFF) /* FIXME */
+                        {
+                            client->errorValue = r->deviceid;
+                            return BadImplementation;
+                        }
+
                         rc = dixLookupDevice(&newkeybd, r->return_keyboard,
                                              client, DixWriteAccess);
                         if (rc != Success)
@@ -413,6 +431,12 @@ ProcXIChangeHierarchy(ClientPtr client)
                     xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any;
                     DeviceIntPtr *xtstdevice;
 
+                    if (c->deviceid > 0xFF) /* FIXME */
+                    {
+                        client->errorValue = c->deviceid;
+                        return BadImplementation;
+                    }
+
                     rc = dixLookupDevice(&ptr, c->deviceid, client,
                                           DixWriteAccess);
                     if (rc != Success)
@@ -446,6 +470,17 @@ ProcXIChangeHierarchy(ClientPtr client)
                     DeviceIntPtr newmaster;
                     DeviceIntPtr *xtstdevice;
 
+                    if (c->deviceid > 0xFF) /* FIXME */
+                    {
+                        client->errorValue = c->deviceid;
+                        return BadImplementation;
+                    }
+                    if (c->new_master > 0xFF) /* FIXME */
+                    {
+                        client->errorValue = c->new_master;
+                        return BadImplementation;
+                    }
+
                     rc = dixLookupDevice(&ptr, c->deviceid, client,
                                           DixWriteAccess);
                     if (rc != Success)
diff --git a/Xi/querydev.c b/Xi/querydev.c
index 0d661a9..a44cf22 100644
--- a/Xi/querydev.c
+++ b/Xi/querydev.c
@@ -70,6 +70,12 @@ ProcXIQueryDevice(ClientPtr client)
     REQUEST(xXIQueryDeviceReq);
     REQUEST_SIZE_MATCH(xXIQueryDeviceReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     if (stuff->deviceid != XIAllDevices && stuff->deviceid != XIAllMasterDevices)
     {
         rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
diff --git a/Xi/querydp.c b/Xi/querydp.c
index 2e2cfaa..bc6feb1 100644
--- a/Xi/querydp.c
+++ b/Xi/querydp.c
@@ -81,6 +81,12 @@ ProcXIQueryPointer(ClientPtr client)
     REQUEST(xXIQueryPointerReq);
     REQUEST_SIZE_MATCH(xXIQueryPointerReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
     if (rc != Success)
         return rc;
diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index 0bfc1ea..ba76246 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -69,6 +69,11 @@ ProcXISetClientPointer(ClientPtr client)
     REQUEST(xXISetClientPointerReq);
     REQUEST_SIZE_MATCH(xXISetClientPointerReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
 
     rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
     if (rc != Success)
diff --git a/Xi/warpdevp.c b/Xi/warpdevp.c
index 025a4ce..bb45bda 100644
--- a/Xi/warpdevp.c
+++ b/Xi/warpdevp.c
@@ -76,6 +76,12 @@ ProcXIWarpPointer(ClientPtr client)
     REQUEST(xXIWarpPointerReq);
     REQUEST_SIZE_MATCH(xXIWarpPointerReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     /* FIXME: panoramix stuff is missing, look at ProcWarpPointer */
 
     rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c
index 3077e1a..dd52c53 100644
--- a/Xi/xiallowev.c
+++ b/Xi/xiallowev.c
@@ -65,6 +65,12 @@ ProcXIAllowEvents(ClientPtr client)
     REQUEST(xXIAllowEventsReq);
     REQUEST_SIZE_MATCH(xXIAllowEventsReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
     if (ret != Success)
 	return ret;
diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
index 95beb83..a825a89 100644
--- a/Xi/xigrabdev.c
+++ b/Xi/xigrabdev.c
@@ -70,6 +70,9 @@ ProcXIGrabDevice(ClientPtr client)
     REQUEST(xXIGrabDeviceReq);
     REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+        return BadImplementation;
+
     ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
     if (ret != Success)
 	return ret;
@@ -129,6 +132,12 @@ ProcXIUngrabDevice(ClientPtr client)
 
     REQUEST(xXIUngrabDeviceReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
     if (ret != Success)
 	return ret;
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 0c74544..25ecc03 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -90,6 +90,9 @@ ProcXIPassiveGrabDevice(ClientPtr client)
     REQUEST(xXIPassiveGrabDeviceReq);
     REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+        return BadImplementation;
+
     if (stuff->deviceid == XIAllDevices)
         dev = inputInfo.all_devices;
     else if (stuff->deviceid == XIAllMasterDevices)
@@ -260,6 +263,12 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
     REQUEST(xXIPassiveUngrabDeviceReq);
     REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
     if (rc != Success)
 	return rc;
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index cd49460..dc54d10 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -1102,6 +1102,12 @@ ProcXIListProperties(ClientPtr client)
     REQUEST(xXIListPropertiesReq);
     REQUEST_SIZE_MATCH(xXIListPropertiesReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
     if (rc != Success)
         return rc;
@@ -1136,6 +1142,12 @@ ProcXIChangeProperty(ClientPtr client)
 
     REQUEST(xXIChangePropertyReq);
     REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
+
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
     UpdateCurrentTime();
 
     rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
@@ -1164,6 +1176,13 @@ ProcXIDeleteProperty(ClientPtr client)
     REQUEST(xXIDeletePropertyReq);
 
     REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
+
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     UpdateCurrentTime();
     rc =  dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
     if (rc != Success)
@@ -1192,6 +1211,13 @@ ProcXIGetProperty(ClientPtr client)
     Atom                        type;
 
     REQUEST_SIZE_MATCH(xXIGetPropertyReq);
+
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     if (stuff->delete)
         UpdateCurrentTime();
     rc = dixLookupDevice (&dev, stuff->deviceid, client,
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 31e6a77..9dbdea7 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -82,6 +82,12 @@ ProcXISelectEvent(ClientPtr client)
     num_masks = stuff->num_masks;
     while(num_masks--)
     {
+        if (evmask->deviceid > 0xFF) /* FIXME */
+        {
+            client->errorValue = evmask->deviceid;
+            return BadImplementation;
+        }
+
         if (evmask->deviceid != XIAllDevices &&
             evmask->deviceid != XIAllMasterDevices)
             rc = dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess);
diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c
index 32f7e59..cd1f6a6 100644
--- a/Xi/xisetdevfocus.c
+++ b/Xi/xisetdevfocus.c
@@ -75,6 +75,12 @@ ProcXISetFocus(ClientPtr client)
     REQUEST(xXISetFocusReq);
     REQUEST_AT_LEAST_SIZE(xXISetFocusReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetFocusAccess);
     if (ret != Success)
 	return ret;
@@ -95,6 +101,12 @@ ProcXIGetFocus(ClientPtr client)
     REQUEST(xXIGetFocusReq);
     REQUEST_AT_LEAST_SIZE(xXIGetFocusReq);
 
+    if (stuff->deviceid > 0xFF) /* FIXME */
+    {
+        client->errorValue = stuff->deviceid;
+        return BadImplementation;
+    }
+
     ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetFocusAccess);
     if (ret != Success)
 	return ret;
commit c77f42049f77417c68bbce3dd2e995d916fc5af5
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jun 5 09:29:04 2009 +1000

    Xi: fix flawed logic in XIQueryVersion return value.
    
    The server returned the minimum of major/minor each instead of the lower of
    the combined major.minor version. As a result, a client reporting
    3.0 and a server supporting 2.7, the return value would be 2.0 (the minimum
    of both).
    
    Reported-by: Rémi Cardona
    Reported-by: Simon Thum
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/queryversion.c b/Xi/queryversion.c
index 385c965..230e207 100644
--- a/Xi/queryversion.c
+++ b/Xi/queryversion.c
@@ -58,6 +58,7 @@ ProcXIQueryVersion(ClientPtr client)
     xXIQueryVersionReply rep;
     XIClientPtr pXIClient;
     int major, minor;
+    unsigned int sversion, cversion;
 
     REQUEST(xXIQueryVersionReq);
     REQUEST_SIZE_MATCH(xXIQueryVersionReq);
@@ -71,8 +72,18 @@ ProcXIQueryVersion(ClientPtr client)
 
     pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
 
-    major = min(XIVersion.major_version, stuff->major_version);
-    minor = min(XIVersion.minor_version, stuff->minor_version);
+    sversion = XIVersion.major_version * 1000 + XIVersion.minor_version;
+    cversion = stuff->major_version * 1000 + stuff->minor_version;
+
+    if (sversion > cversion)
+    {
+        major = stuff->major_version;
+        minor = stuff->minor_version;
+    } else
+    {
+        major = XIVersion.major_version;
+        minor = XIVersion.minor_version;
+    }
 
     pXIClient->major_version = major;
     pXIClient->minor_version = minor;


More information about the xorg-commit mailing list