From c8dd981c7f67d26850fad8c8a01f5de9850aa454 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 18 Feb 2010 15:49:09 +1000 Subject: [PATCH] Xi: assume BadMode for non-BadMatch errors returned from SetDeviceMode. 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 Reviewed-by: Dan Nicholson Signed-off-by: Keith Packard (cherry picked from commit e40ba5798c367bec584f6437b23d2c5f801fd013) Signed-off-by: Peter Hutterer --- Xi/setmode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Xi/setmode.c b/Xi/setmode.c index 51e57675f..ce2ad47c7 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;