Friday, September 2, 2011

What's new in XI 2.1 - versioning

This post is the start of a mini-series describing the new features added to the X Input Extension version 2.1, or short XI 2.1.

Also, I need to point out that XI 2.1 is not yet released, some minor changes may still be added. Nonetheless, this series should help you understand the new additions and if you see any issues - by all means let me know so we can amend before it is set in stone.

In this post, I'll talk about versioning.

First, for all those looking for big headlines: multitouch in X has been postponed to XI 2.2. XI 2.1 is a small incremental change with two bugfixes and one new feature. These are uncontroversial and more importantly, they are ready now. So XI 2.1 is released as a small change, with bigger changes coming for XI 2.2. We currently still plan to get XI 2.2 into server 1.12 so this is really just a numbers game and ticking off work that is complete.

The small list of changes for XI 2.1:

  • New raw events behaviour

  • Smooth scrolling

  • XI2 defines


I'll describe each of those in a separate post.

Announcing support for XI 2.1


Any client that supports XI2 must already announce so with XIQueryVersion(3). To unlock XI 2.1 behaviour, a client must announce support for XI 2.1 or later.


int major = 2;
int minor = 1;
int rc;

rc = XIQueryVersion(display, &major, &minor);
if (rc == Success)
printf("Server supports XI %d.%d\n", major, minor);
else if (rc == BadRequest)
printf("Server does not support XI2.\n");
else
printf("Internal error\n");


The server is compatible with XI 2.0 and XI 2.1. Thus, a client that does not announce XI 2.1 support will get XI 2.0 behaviour.


Using XI2 version defines


Because I fell into this trap myself, a word of warning about a potential bug. If you are currently using the XI_2_Major and XI_2_Minor defines for versioning, recompiling against new inputproto headers will automatically bump your client up to the latest version, including possible unexpected behaviours. Don't do this, XI2 is versioned through numbers, not defines. Have a look at this xinput commit to get a better idea.

2 comments:

djkurtz said...

It looks like XI 2.1 is not (yet) in the 1.11 branch (as of 1.11.902). Will XI2.1 get included in a later 1.11 release (1.11.3?), or will it only live on master, and just get skipped in official releases if the plan is to release 1.12 with XI 2.2?

Peter Hutterer said...

It won't be on the 1.11 branch. Adding XI2.1 support to the server ended up breaking the ABI a few times over and back-porting that is not something I've got the time for.