summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-04 12:55:59 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-04 15:11:07 +1000
commit6ea76c550486bd17eb31f43757030fb44bdf1eab (patch)
tree9c01d90884852556496ad9ee7c5e956ad25e96d6
parentd979f443946011158b6a183582728a6899c33b85 (diff)
Xi: reply with the XI2 version that is supported by both client and server.
XIQueryVersion must return the client's version if the client's version is lower than or equal to the server's version, or the server's version otherwise. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--Xi/queryversion.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Xi/queryversion.c b/Xi/queryversion.c
index 3e0644be1..f96c6f019 100644
--- a/Xi/queryversion.c
+++ b/Xi/queryversion.c
@@ -43,6 +43,7 @@
#include "exglobals.h"
#include "exevents.h"
#include "queryversion.h"
+#include "misc.h"
extern XExtensionVersion XIVersion; /* defined in getvers.c */
/**
@@ -56,22 +57,26 @@ ProcXIQueryVersion(ClientPtr client)
{
xXIQueryVersionReply rep;
XIClientPtr pXIClient;
+ int major, minor;
REQUEST(xXIQueryVersionReq);
REQUEST_SIZE_MATCH(xXIQueryVersionReq);
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
- pXIClient->major_version = stuff->major_version;
- pXIClient->minor_version = stuff->minor_version;
+ major = min(XIVersion.major_version, stuff->major_version);
+ minor = min(XIVersion.minor_version, stuff->minor_version);
+
+ pXIClient->major_version = major;
+ pXIClient->minor_version = minor;
memset(&rep, 0, sizeof(xXIQueryVersionReply));
rep.repType = X_Reply;
rep.RepType = X_XIQueryVersion;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.major_version = XIVersion.major_version;
- rep.minor_version = XIVersion.minor_version;
+ rep.major_version = major;
+ rep.minor_version = minor;
WriteReplyToClient(client, sizeof(xXIQueryVersionReply), &rep);