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

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 11 17:45:17 PST 2010


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 <peter.hutterer at who-t.net>
---
 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



More information about the xorg-devel mailing list