summaryrefslogtreecommitdiff
path: root/Xi/xiqueryversion.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-04-23 10:35:53 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-05-01 11:36:30 +1000
commitea51e9b2877df60135edaf2a8f88d0f2a2b41060 (patch)
tree64e39f4ade95456f6445e6c06c996cf859b85d49 /Xi/xiqueryversion.c
parent93d6ba5b711cbd3f502d83e54c9739856d2e6f2a (diff)
Xi: return BadValue on XIQueryVersion if the version is less than first call
Clients that use plugin systems may require multiple calls to XIQueryVersion from different plugins. The current error handling requires client-side synchronisation of version numbers. The first call to XIQueryVersion defines the server behaviour. Once cached, always return that version number to any clients. Unless a client requests a version lower than the first defined one, then a BadValue must be returned to be protocol-compatible. Introduced in 2c23ef83b0e03e163aeeb06133538606886f4e9c Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'Xi/xiqueryversion.c')
-rw-r--r--Xi/xiqueryversion.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/Xi/xiqueryversion.c b/Xi/xiqueryversion.c
index fc0ca751b..6081c413d 100644
--- a/Xi/xiqueryversion.c
+++ b/Xi/xiqueryversion.c
@@ -70,28 +70,29 @@ ProcXIQueryVersion(ClientPtr client)
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
- if (pXIClient->major_version &&
- (stuff->major_version != pXIClient->major_version ||
- stuff->minor_version != pXIClient->minor_version))
- {
- client->errorValue = stuff->major_version;
- return BadValue;
+ if (pXIClient->major_version) {
+ if (version_compare(stuff->major_version, stuff->minor_version,
+ pXIClient->major_version, pXIClient->minor_version) < 0) {
+ client->errorValue = stuff->major_version;
+ return BadValue;
+ }
+ major = pXIClient->major_version;
+ minor = pXIClient->minor_version;
+ } else {
+ if (version_compare(XIVersion.major_version, XIVersion.minor_version,
+ stuff->major_version, stuff->minor_version) > 0) {
+ major = stuff->major_version;
+ minor = stuff->minor_version;
+ }
+ else {
+ major = XIVersion.major_version;
+ minor = XIVersion.minor_version;
+ }
+
+ pXIClient->major_version = major;
+ pXIClient->minor_version = minor;
}
-
- if (version_compare(XIVersion.major_version, XIVersion.minor_version,
- stuff->major_version, stuff->minor_version) > 0) {
- major = stuff->major_version;
- minor = stuff->minor_version;
- }
- else {
- major = XIVersion.major_version;
- minor = XIVersion.minor_version;
- }
-
- pXIClient->major_version = major;
- pXIClient->minor_version = minor;
-
memset(&rep, 0, sizeof(xXIQueryVersionReply));
rep.repType = X_Reply;
rep.RepType = X_XIQueryVersion;