Drivers can't know the error code for BadMode and DeviceBusy, they only have
the XI_* defines to go on (the error code is dynamically allocated for
extension errors).  Assume that anything that's not XI_DeviceBusy is a
BadMode error.

While some drivers returned BadMatch, the protocol spec and library
documentation was ambiguous about it. Return BadMatch only for devices
without valuators, BadMode for an invalid mode.

Signed-off-by: Peter Hutterer <[email protected]>
---
 Xi/setmode.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Xi/setmode.c b/Xi/setmode.c
index 51e5767..e1bc682 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -112,7 +112,16 @@ ProcXSetDeviceMode(ClientPtr client)
     if (rep.status == Success)
        dev->valuator->mode = stuff->mode;
     else if (rep.status != AlreadyGrabbed)
+    {
+       /* Drivers can't know the error code for BadMode and DeviceBusy,
+        * they only have the XI_* defines to go on. So assume anything
+       * that's not XI_DeviceBusy is BadMode. */
+       if (rep.status == XI_DeviceBusy)
+           rep.status = DeviceBusy;
+       else
+           rep.status = BadMode;
        return rep.status;
+    }
 
     WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
     return Success;
-- 
1.6.6

_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to