[PATCH] Xi: assume BadMode for non-BadMatch errors returned from SetDeviceMode.

Peter Hutterer peter.hutterer at who-t.net
Wed Feb 17 21:49:09 PST 2010


The XI protocol spec only allows for two errors on the SetDeviceMode
requests: BadMatch or BadMode. BadMode however is a dynamically assigned
extension error and the driver doesn't have access to the actual error
number. Hence, if a SetDeviceMode driver returns an error other than
BadMatch, assume BadMode.

The two exceptions are BadAlloc and BadImplementations, pass these on to the
client (any request is allowed to return either of those).

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
That's the easy one, the others may take a bit longer. Keith, if you're
happy with this one feel free to push, otherwise I'll get it into my next
pull request.

 Xi/setmode.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Xi/setmode.c b/Xi/setmode.c
index 51e5767..ce2ad47 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -112,7 +112,17 @@ ProcXSetDeviceMode(ClientPtr client)
     if (rep.status == Success)
 	dev->valuator->mode = stuff->mode;
     else if (rep.status != AlreadyGrabbed)
+    {
+	switch(rep.status) {
+	    case BadMatch:
+	    case BadImplementation:
+	    case BadAlloc:
+		break;
+	    default:
+		rep.status = BadMode;
+	}
 	return rep.status;
+    }
 
     WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
     return Success;
-- 
1.6.6.1


More information about the xorg-devel mailing list