xserver: Branch 'master' - 5 commits

Peter Hutterer whot at kemper.freedesktop.org
Thu Jun 11 19:41:22 PDT 2009


 Xi/getcptr.c  |   18 +++++++++---------
 Xi/setcptr.c  |   17 ++++++++++++-----
 dix/events.c  |    5 ++---
 include/dix.h |    3 +--
 4 files changed, 24 insertions(+), 19 deletions(-)

New commits:
commit 5e0ca6fabd12401de6bd6039484be2079e28851e
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jun 11 16:26:23 2009 +1000

    input: remove un-used "setter" argument from SetClientPointer.
    
    It's obsolete, not likely to come back, let's drop it.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index 0589381..d23b2d8 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -103,7 +103,7 @@ ProcXISetClientPointer(ClientPtr client)
     } else
         targetClient = client;
 
-    if (!SetClientPointer(targetClient, client, pDev))
+    if (!SetClientPointer(targetClient, pDev))
     {
         client->errorValue = stuff->deviceid;
         return BadDevice;
diff --git a/dix/events.c b/dix/events.c
index ffeb449..43e1bd2 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -5691,8 +5691,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
 }
 
 /*
- * Set the client pointer for the given client. Second parameter setter could
- * be used in the future to determine access rights. Unused for now.
+ * Set the client pointer for the given client.
  *
  * A client can have exactly one ClientPointer. Each time a
  * request/reply/event is processed and the choice of devices is ambiguous
@@ -5701,7 +5700,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
  * If a keyboard is needed, the first keyboard paired with the CP is used.
  */
 Bool
-SetClientPointer(ClientPtr client, ClientPtr setter, DeviceIntPtr device)
+SetClientPointer(ClientPtr client, DeviceIntPtr device)
 {
     if (!IsMaster(device))
     {
diff --git a/include/dix.h b/include/dix.h
index df73519..c4a6394 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -486,8 +486,7 @@ extern _X_EXPORT int TryClientEvents(
 extern _X_EXPORT void WindowsRestructured(void);
 
 extern Bool SetClientPointer(
-        ClientPtr /* client */, 
-        ClientPtr /* setter */, 
+        ClientPtr /* client */,
         DeviceIntPtr /* device */);
 
 extern _X_EXPORT DeviceIntPtr PickPointer(
commit e6a18762ef113296c6a09833be70cb4b45aa3940
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jun 11 15:40:56 2009 +1000

    Xi: fix XISetClientPointer return values.
    
    If SetClientPointer fails, the only reason may be that the device is not a
    pointer or that the device is an SD. Return BadDevice instead of BadAccess.
    (BadAccess is a leftover from the early times of the ClientPointer
    implementation when only one client was allowed to set it).
    
    If the window parameter doesn't name a valid window or client, return
    BadWindow.
    
    Finally, allow both master keyboards and master pointers as deviceid.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index 9d1a54c..0589381 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -79,29 +79,34 @@ ProcXISetClientPointer(ClientPtr client)
 
     rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
     if (rc != Success)
+    {
+        client->errorValue = stuff->deviceid;
         return rc;
+    }
 
-    if (!IsPointerDevice(pDev) || !IsMaster(pDev))
+    if (!IsMaster(pDev))
     {
         client->errorValue = stuff->deviceid;
         return BadDevice;
     }
 
+    pDev = GetMaster(pDev, MASTER_POINTER);
+
     if (stuff->win != None)
     {
         rc = dixLookupClient(&targetClient, stuff->win, client,
                 DixWriteAccess);
 
         if (rc != Success)
-            return rc;
+            return BadWindow;
 
     } else
         targetClient = client;
 
     if (!SetClientPointer(targetClient, client, pDev))
     {
-        client->errorValue = stuff->win;
-        return BadAccess;
+        client->errorValue = stuff->deviceid;
+        return BadDevice;
     }
 
     return Success;
commit ae7dab2a136d15b976b956f68feec53886951dd6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jun 11 15:40:38 2009 +1000

    Xi: Fix XISetClientPointer swapping.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index ba76246..9d1a54c 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -55,6 +55,8 @@ SProcXISetClientPointer(ClientPtr client)
 
     REQUEST(xXISetClientPointerReq);
     swaps(&stuff->length, n);
+    swapl(&stuff->win, n);
+    swaps(&stuff->deviceid, n);
     REQUEST_SIZE_MATCH(xXISetClientPointerReq);
     return (ProcXISetClientPointer(client));
 }
commit 98e8ec8deb09db1c56e06afed267e6f517042fa3
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jun 12 10:54:55 2009 +1000

    Xi: sanitize ProcXIGetClientPointer.
    
    This was quite old code and can be streamlined a bit. The new code is
    essentially the same as in ProcXISetClientPointer.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/getcptr.c b/Xi/getcptr.c
index 9cce5c3..92fae82 100644
--- a/Xi/getcptr.c
+++ b/Xi/getcptr.c
@@ -59,22 +59,21 @@ SProcXIGetClientPointer(ClientPtr client)
 
 int ProcXIGetClientPointer(ClientPtr client)
 {
-    int err;
-    WindowPtr win;
+    int rc;
     ClientPtr winclient;
     xXIGetClientPointerReply rep;
     REQUEST(xXIGetClientPointerReq);
     REQUEST_SIZE_MATCH(xXIGetClientPointerReq);
 
-    err = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
-    if (err != Success)
+    if (stuff->win != None)
     {
-        SendErrorToClient(client, IReqCode, X_XIGetClientPointer,
-                stuff->win, err);
-        return Success;
-    }
+        rc = dixLookupClient(&winclient, stuff->win, client,
+                DixWriteAccess);
 
-    winclient = wClient(win);
+        if (rc != Success)
+            return BadWindow;
+    } else
+        winclient = client;
 
     rep.repType = X_Reply;
     rep.RepType = X_XIGetClientPointer;
commit 96ea82fdac7c28feb2748cd4ff7faa7c00dbbdcd
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jun 12 10:54:25 2009 +1000

    Xi: fix reply swapping in XIGetClientPointer.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/getcptr.c b/Xi/getcptr.c
index 5c69942..9cce5c3 100644
--- a/Xi/getcptr.c
+++ b/Xi/getcptr.c
@@ -101,6 +101,7 @@ SRepXIGetClientPointer(ClientPtr client, int size,
     char n;
     swaps(&rep->sequenceNumber, n);
     swapl(&rep->length, n);
+    swaps(&rep->deviceid, n);
     WriteToClient(client, size, (char *)rep);
 }
 


More information about the xorg-commit mailing list