<div dir="ltr">For more details, since our use case right now doesn't actually care about the client's requested version, omitting the version the client requested is fine for me. If it's needed in the future, we can look at the use case then to see if it needs the XI_QueryVersionCalled event.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 23, 2013 at 10:22 PM, Jasper St. Pierre <span dir="ltr"><<a href="mailto:jstpierre@mecheye.net" target="_blank">jstpierre@mecheye.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This sounds like a good idea to me.<br></div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">
On Wed, Jan 23, 2013 at 8:38 PM, Peter Hutterer <span dir="ltr"><<a href="mailto:peter.hutterer@who-t.net" target="_blank">peter.hutterer@who-t.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">XIQueryVersion sends the client-supported version to the server. The server<br>
then uses that version to adjust the behaviour of XI2 for this client.<br>
Current examples include:<br>
* XIQueryPointer will not set the button mask for touch events if the client<br>
is XI 2.2-aware<br>
* RawEvents are sent to XI 2.1 clients if a grab is active<br>
* XIAllowEvents will accept different values from XI 2.2 clients<br>
<br>
This behaviour is an issue for libraries supporting XI2. A library that<br>
calls XIQueryVersion before the client will lock in behaviour that the<br>
client may not request. A library that calls XIQueryVersion after the client<br>
may trigger BadValue errors if the libraries requested version differs from<br>
the client's requested version.<br>
<br>
This request adds a side-effect free version of XIQueryVersion. It returns<br>
the server version and the already-requested client version (if any). A<br>
library may use this request to query the server for the XI2 version<br>
withouth locking in any behaviour for the client.<br>
<br>
Signed-off-by: Peter Hutterer <<a href="mailto:peter.hutterer@who-t.net" target="_blank">peter.hutterer@who-t.net</a>><br>
---<br>
I was tempted to call this XIQueryServerVersion but IMO that is too close to<br>
XIQueryVersion.<br>
<br>
Returning the client version is to determine what the client actually<br>
expects in behavior. Not 100% sure if needed, but if it is needed this opens<br>
another question: do we need a XIQueryVersionCalled event? If the library<br>
calls XIGetSupportedVersion before the client calls XIQueryVersion, it<br>
won't have the information. Unless it keeps calling it until it gets a<br>
number back, which doesn't seem useful either.<br>
<br>
XI2proto.h | 30 +++++++++++++++++++++++++++++-<br>
specs/XI2proto.txt | 34 ++++++++++++++++++++++++++++++++++<br>
2 files changed, 63 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/XI2proto.h b/XI2proto.h<br>
index 4cdaa0d..e99c9d6 100644<br>
--- a/XI2proto.h<br>
+++ b/XI2proto.h<br>
@@ -94,9 +94,10 @@<br>
#define X_XIGetProperty 59<br>
#define X_XIGetSelectedEvents 60<br>
#define X_XIBarrierReleasePointer 61<br>
+#define X_XIGetSupportedVersion 62<br>
<br>
/** Number of XI requests */<br>
-#define XI2REQUESTS (X_XIBarrierReleasePointer - X_XIQueryPointer + 1)<br>
+#define XI2REQUESTS (X_XIGetSupportedVersion - X_XIQueryPointer + 1)<br>
/** Number of XI2 events */<br>
#define XI2EVENTS (XI_LASTEVENT + 1)<br>
<br>
@@ -833,6 +834,33 @@ typedef struct {<br>
} xXIBarrierReleasePointerReq;<br>
#define sz_xXIBarrierReleasePointerReq 8<br>
<br>
+/**<br>
+ * Retrieve the server-supported X Input extension version.<br>
+ */<br>
+<br>
+typedef struct {<br>
+ uint8_t reqType; /**< Input extension major code */<br>
+ uint8_t ReqType; /**< Always ::X_XIGetSupportedVersion */<br>
+ uint16_t length; /**< Length in 4 byte units */<br>
+} xXIGetSupportedVersionReq;<br>
+#define sz_xXIGetSupportedVersionReq 4<br>
+<br>
+typedef struct {<br>
+ uint8_t repType; /**< ::X_Reply */<br>
+ uint8_t RepType; /**< Always ::X_XIGetSupportedVersion */<br>
+ uint16_t sequenceNumber;<br>
+ uint32_t length;<br>
+ uint16_t server_major_version;<br>
+ uint16_t server_minor_version;<br>
+ uint16_t client_major_version;<br>
+ uint16_t client_minor_version;<br>
+ uint32_t pad1<br>
+ uint32_t pad3;<br>
+ uint32_t pad4;<br>
+ uint32_t pad5;<br>
+} xXIGetSupportedVersionReply;<br>
+#define sz_xXIGetSupportedVersionReply 32<br>
+<br>
/*************************************************************************************<br>
* *<br>
* EVENTS *<br>
diff --git a/specs/XI2proto.txt b/specs/XI2proto.txt<br>
index d30fcca..b5d9afd 100644<br>
--- a/specs/XI2proto.txt<br>
+++ b/specs/XI2proto.txt<br>
@@ -62,6 +62,7 @@ Changes in version 2.3<br>
----------------------<br>
<br>
- Pointer barrier events added<br>
+- XIGetSupportedVersion request added<br>
<br>
// ❧❧❧❧❧❧❧❧❧❧❧<br>
<br>
@@ -2035,6 +2036,39 @@ assigned and the client must re-issue the XIBarrierReleasePointer request.<br>
If the device is not a master pointer device, a BadDevice error results.<br>
If the barrier does not name a valid barrier, a BadValue error results.<br>
<br>
+XIGetSupportedVersion<br>
+^^^^^^^^^^^^^^<br>
+ ┌───<br>
+ XIGetSupportedVersion<br>
+ ▶<br>
+ server_major_version: CARD16<br>
+ server_minor_version: CARD16<br>
+ client_major_version: CARD16<br>
+ client_minor_version: CARD16<br>
+ └───<br>
+<br>
+This request queries the server for its supported XI2 version, and the<br>
+version this client has already registered for. It is side-effect free.<br>
+<br>
+ server_major_version<br>
+ Major XI2 version supported by the server.<br>
+ server_minor_version<br>
+ Minor XI2 version supported by the server.<br>
+ client_major_version<br>
+ Major XI2 version this client has registered for.<br>
+ client_minor_version<br>
+ Minor XI2 version this client has registered for.<br>
+<br>
+XIGetSupportedVersion returns the current supported server major/minor<br>
+version. It does not register this client for XI2 support and clients must<br>
+call XIQueryVersion with the version they support before issuing other XI2<br>
+requests.<br>
+<br>
+XIGetSupportedVersion returns the major/minor version requested by this<br>
+client in a previous XIQueryVersion request. If the client has not<br>
+previously called XIQueryVersion, client_major_version and<br>
+client_minor_version is 0.<br>
+<br>
<br>
[[events]]<br>
Events<br>
<span><font color="#888888">--<br>
1.8.1<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br> Jasper<br>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br> Jasper<br>
</div>