diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-31 21:29:47 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-02 13:25:49 +1000 |
commit | 2174d35d5cdc475699be968a0c1b1aa82566171f (patch) | |
tree | 9bce3101f63becc0255837ce1d23abbaf15d5d54 /src/XIQueryVersion.c | |
parent | b1dedc1293a854360d44856cd603d339ce95c777 (diff) |
Return BadRequest from XIQueryVersion if XI2 isn't supported.
XIQueryVersion (like all other calls) makes sure XGetExtensionVersion is
called beforehand anyway. So if that doesn't match 2.0 or higher, return
BadRquest before issuing the real request (which would trigger a BadRequest
error). This way, clients can use XIQueryVersion without having to set up
the error handler.
XIQueryVersion is now guaranteed to return the server-supported version.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/XIQueryVersion.c')
-rw-r--r-- | src/XIQueryVersion.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/XIQueryVersion.c b/src/XIQueryVersion.c index 851d0d4..a14e9c9 100644 --- a/src/XIQueryVersion.c +++ b/src/XIQueryVersion.c @@ -50,8 +50,26 @@ _xiQueryVersion(Display * dpy, int *major, int *minor, XExtDisplayInfo *info) xXIQueryVersionReq *req; xXIQueryVersionReply rep; - if (_XiCheckExtInit(dpy, Dont_Check, info) == -1) + /* This could mean either a malloc problem, or supported + version < XInput_2_0 */ + if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1) + { + XExtensionVersion *ext; + XExtDisplayInfo *info = XInput_find_display(dpy); + + if (!info || !info->data) { + *major = 0; + *minor = 0; + UnlockDisplay(dpy); + return BadRequest; + } + + ext = ((XInputData*)info->data)->vers; + + *major = ext->major_version; + *minor = ext->minor_version; return BadRequest; + } GetReq(XIQueryVersion, req); req->reqType = info->codes->major_opcode; |