[PATCH] Support new XIGetSupportedVersion request

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 31 16:03:45 PST 2013


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Keith, the gtk guys need this request, or at least the functionality
provided. It's going to be part of XI 2.3. Will you merge this for 1.14?

Cheers,
   Peter

 Xi/Makefile.am             |   2 +
 Xi/extinit.c               |   7 ++-
 Xi/xigetsupportedversion.c | 105 +++++++++++++++++++++++++++++++++++++++++++++
 Xi/xigetsupportedversion.h |  40 +++++++++++++++++
 4 files changed, 152 insertions(+), 2 deletions(-)
 create mode 100644 Xi/xigetsupportedversion.c
 create mode 100644 Xi/xigetsupportedversion.h

diff --git a/Xi/Makefile.am b/Xi/Makefile.am
index af85bd0..1ce96f8 100644
--- a/Xi/Makefile.am
+++ b/Xi/Makefile.am
@@ -86,6 +86,8 @@ libXi_la_SOURCES =	\
 	xichangehierarchy.h \
 	xigetclientpointer.c \
 	xigetclientpointer.h \
+	xigetsupportedversion.c \
+	xigetsupportedversion.h \
 	xigrabdev.c \
 	xigrabdev.h \
 	xipassivegrab.h \
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 619d0e4..82585f3 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -123,6 +123,7 @@ SOFTWARE.
 #include "xisetclientpointer.h"
 #include "xiwarppointer.h"
 #include "xibarriers.h"
+#include "xigetsupportedversion.h"
 
 /* Masks for XI events have to be aligned with core event (partially anyway).
  * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
@@ -253,7 +254,8 @@ static int (*ProcIVector[]) (ClientPtr) = {
         ProcXIDeleteProperty,   /* 58 */
         ProcXIGetProperty,      /* 59 */
         ProcXIGetSelectedEvents, /* 60 */
-        ProcXIBarrierReleasePointer /* 61 */
+        ProcXIBarrierReleasePointer, /* 61 */
+        ProcXIGetSupportedVersion /* 62 */
 };
 
 /* For swapped clients */
@@ -319,7 +321,8 @@ static int (*SProcIVector[]) (ClientPtr) = {
         SProcXIDeleteProperty,  /* 58 */
         SProcXIGetProperty,     /* 59 */
         SProcXIGetSelectedEvents,       /* 60 */
-        SProcXIBarrierReleasePointer /* 61 */
+        SProcXIBarrierReleasePointer, /* 61 */
+        SProcXIGetSupportedVersion /* 62 */
 };
 
 /*****************************************************************
diff --git a/Xi/xigetsupportedversion.c b/Xi/xigetsupportedversion.c
new file mode 100644
index 0000000..10495d7
--- /dev/null
+++ b/Xi/xigetsupportedversion.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Peter Hutterer
+ *
+ */
+
+/**
+ * @file xigetsupportedversion.c
+ * Protocol handling for the XIGetSupportedVersion request/reply.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h"
+
+#include <X11/Xmd.h>
+#include <X11/X.h>
+#include <X11/extensions/XI2proto.h>
+
+#include "exglobals.h"
+#include "exevents.h"
+#include "xigetsupportedversion.h"
+#include "misc.h"
+
+extern XExtensionVersion XIVersion;     /* defined in getvers.c */
+
+/**
+ * Return the supported XI version.
+ */
+int
+ProcXIGetSupportedVersion(ClientPtr client)
+{
+    xXIGetSupportedVersionReply rep;
+    XIClientPtr pXIClient;
+    int cmajor, cminor;
+
+    REQUEST(xXIGetSupportedVersionReq);
+    REQUEST_SIZE_MATCH(xXIGetSupportedVersionReq);
+
+    stuff->length = stuff->length; /* shut up, gcc */
+
+    pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+    cmajor = pXIClient->major_version;
+    cminor = pXIClient->minor_version;
+
+    rep = (xXIGetSupportedVersionReply) {
+        .repType = X_Reply,
+        .RepType = X_XIGetSupportedVersion,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .server_major_version = XIVersion.major_version,
+        .server_minor_version = XIVersion.minor_version,
+        .client_major_version = cmajor,
+        .client_minor_version = cminor,
+    };
+
+    WriteReplyToClient(client, sizeof(xXIGetSupportedVersionReply), &rep);
+
+    return Success;
+}
+
+/* Swapping routines */
+
+int
+SProcXIGetSupportedVersion(ClientPtr client)
+{
+    REQUEST(xXIGetSupportedVersionReq);
+    swaps(&stuff->length);
+    REQUEST_AT_LEAST_SIZE(xXIGetSupportedVersionReq);
+    return (ProcXIGetSupportedVersion(client));
+}
+
+void
+SRepXIGetSupportedVersion(ClientPtr client, int size, xXIGetSupportedVersionReply * rep)
+{
+    swaps(&rep->sequenceNumber);
+    swapl(&rep->length);
+    swaps(&rep->server_major_version);
+    swaps(&rep->server_minor_version);
+    swaps(&rep->client_major_version);
+    swaps(&rep->client_minor_version);
+    WriteToClient(client, size, rep);
+}
diff --git a/Xi/xigetsupportedversion.h b/Xi/xigetsupportedversion.h
new file mode 100644
index 0000000..0326316
--- /dev/null
+++ b/Xi/xigetsupportedversion.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Peter Hutterer
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/extensions/XI2proto.h>
+
+#ifndef GETSUPPORTEDVERSION_H
+#define GETSUPPORTEDVERSION_H 1
+
+int SProcXIGetSupportedVersion(ClientPtr client);
+int ProcXIGetSupportedVersion(ClientPtr client);
+void SRepXIGetSupportedVersion(ClientPtr client, int size, xXIGetSupportedVersionReply * rep);
+
+#endif                          /* GETSUPPORTEDVERSION_H */
-- 
1.8.1



More information about the xorg-devel mailing list