summaryrefslogtreecommitdiff
path: root/Xi/getvers.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-04-26 17:38:55 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-04-26 17:47:15 +0930
commitb304b0a65cc57127cdea103f2c5114e4ea79af41 (patch)
tree54464e7dccf3bc9994af12eeaffb842de416bf52 /Xi/getvers.c
parente251c9e75afdc5e32f2bc9801712272358934266 (diff)
Xi: add versioning support.
Remember the version the client sent to us, so we can adjust our replies accordingly. This requires the client to use the {major|minor}Version fields in the GetExtensionVersion request. However, they were padding before, so we must assume they are garbage if nbytes is non-zero. If nbytes is zero, the client is probably a new client and we can handle it correctly.
Diffstat (limited to 'Xi/getvers.c')
-rw-r--r--Xi/getvers.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Xi/getvers.c b/Xi/getvers.c
index 1e17eea5a..43a1a4d26 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -59,6 +59,7 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
+#include "exevents.h"
#include "exglobals.h"
#include "getvers.h"
@@ -93,6 +94,7 @@ int
ProcXGetExtensionVersion(ClientPtr client)
{
xGetExtensionVersionReply rep;
+ XIClientPtr pXIClient;
REQUEST(xGetExtensionVersionReq);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
@@ -101,6 +103,21 @@ ProcXGetExtensionVersion(ClientPtr client)
stuff->nbytes + 3) >> 2)
return BadLength;
+ pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+
+ /* GetExtensionVersionReq before XI 2 didn't supply the client's
+ * major/minor. So we don't actually have a clue what they support.
+ * {major|minor}Version was added as part of XI, so if they are set, we
+ * know we can trust it. In this case the client must set nbytes to 0
+ * though, otherwise we have to assume that the version are padding
+ * garbage.
+ */
+ if (!stuff->nbytes) /* Client using XQueryInputVersion(). */
+ {
+ pXIClient->major_version = stuff->majorVersion;
+ pXIClient->minor_version = stuff->minorVersion;
+ } /* else version unknown, leave it at 0.0 */
+
rep.repType = X_Reply;
rep.RepType = X_GetExtensionVersion;
rep.length = 0;