[RFC XI 2.1 - inputproto] Add touch classes and events, bump to 2.1

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 16 22:25:08 PST 2010


On Fri, Nov 12, 2010 at 05:35:01PM -0500, Chase Douglas wrote:
> Introduce multitouch support through a new TouchClass, as well as new
> TouchBegin, TouchEnd and TouchMotion events.  Bump to version 2.1.

> Signed-off-by: Daniel Stone <daniel at fooishbar.org>
> Signed-off-by: Chase Douglas <chaes.douglas at canonical.com>
> ---
>  XI2.h        |   20 ++++++++++++++++++--
>  XI2proto.h   |   25 +++++++++++++++++++++++++
>  configure.ac |    2 +-
>  3 files changed, 44 insertions(+), 3 deletions(-)
> 
> diff --git a/XI2.h b/XI2.h
> index 6ba1377..f3ee7f0 100644
> --- a/XI2.h
> +++ b/XI2.h
> @@ -32,10 +32,12 @@
>  #define Dont_Check                              0
>  #endif
>  #define XInput_2_0                              7
> +#define XInput_2_1                              8

coincidentally, that's a libXi-internal define that should be removed from
the protocol headers. I've got the patch ready for this, leave this one
as-is for now.

>  #define XI_2_Major                              2
>  #define XI_2_Minor                              0
> +#define XI_2_1_Minor                            1
>  
>  /* Property event flags */
>  #define XIPropertyDeleted                       0
> @@ -113,15 +115,23 @@
>  #define XISlaveKeyboard                         4
>  #define XIFloatingSlave                         5
>  
> -/* Device classes */
> +/* Device classes: classes that are not identical to Xi 1.x classes must be
> + * numbered starting from 8. */
>  #define XIKeyClass                              0
>  #define XIButtonClass                           1
>  #define XIValuatorClass                         2
> +#define XITouchClass                            8
> +#define XITouchValuatorClass                    9
>  
>  /* Device event flags (common) */
>  /* Device event flags (key events only) */
>  #define XIKeyRepeat                             (1 << 16)
>  /* Device event flags (pointer events only) */
> +#define XITouchPointer                          (1 << 24)
> +
> +/* Touch modes */
> +#define XIDirectTouch                           1
> +#define XIDependentTouch                        2
>  
>  /* XI2 event mask macros */
>  #define XISetMask(ptr, event)   (((unsigned char*)(ptr))[(event)>>3] |=  (1 << ((event) & 7)))
> @@ -151,7 +161,10 @@
>  #define XI_RawButtonPress                15
>  #define XI_RawButtonRelease              16
>  #define XI_RawMotion                     17
> -#define XI_LASTEVENT                     XI_RawMotion
> +#define XI_TouchBegin                    18
> +#define XI_TouchEnd                      19
> +#define XI_TouchMotion                   20
> +#define XI_LASTEVENT                     XI_TouchMotion
>  /* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
>   * as XI_LASTEVENT if the server is supposed to handle masks etc. for this
>   * type of event. */
> @@ -177,5 +190,8 @@
>  #define XI_RawButtonPressMask            (1 << XI_RawButtonPress)
>  #define XI_RawButtonReleaseMask          (1 << XI_RawButtonRelease)
>  #define XI_RawMotionMask                 (1 << XI_RawMotion)
> +#define XI_TouchBeginMask                (1 << XI_TouchBegin)
> +#define XI_TouchEndMask                  (1 << XI_TouchEnd)
> +#define XI_TouchMotionMask               (1 << XI_TouchMotion)
>  
>  #endif /* _XI2_H_ */
> diff --git a/XI2proto.h b/XI2proto.h
> index 84574a5..418c23d 100644
> --- a/XI2proto.h
> +++ b/XI2proto.h
> @@ -188,6 +188,31 @@ typedef struct {
>      uint16_t    pad2;
>  } xXIValuatorInfo;
>  
> +/**
> + * Denotes multitouch capability on a device.
> + */
> +typedef struct {
> +    uint16_t    type;           /**< Always TouchClass */
> +    uint16_t    length;         /**< Length in 4 byte units */
> +    uint16_t    sourceid;       /**< source device for this class */
> +    uint8_t     mode;           /**< DirectTouch or DependentTouch */
> +    uint8_t     num_touches;    /**< Maximum number of touches */
> +} xXITouchInfo;
> +
> +/**
> + * Denotes a multitouch valuator capability on a device.
> + * One XITouchValuatorInfo describes exactly one valuator (axis) on the device.
> + */
> +typedef struct {
> +    uint16_t    type;           /**< Always TouchValuatorClass  */
> +    uint16_t    length;         /**< Length in 4 byte units */
> +    uint16_t    sourceid;       /**< source device for this class */
> +    uint16_t    number;         /**< Valuator number            */
> +    Atom        label;          /**< Axis label                 */
> +    FP3232      min;            /**< Min value                  */
> +    FP3232      max;            /**< Max value                  */
> +    uint32_t    resolution;     /**< Resolutions in units/m     */
> +} xXITouchValuatorInfo;
>  
>  /**
>   * Used to select for events on a given window.
> diff --git a/configure.ac b/configure.ac
> index 7466dc3..7f3c1a2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1,5 +1,5 @@
>  AC_PREREQ([2.60])
> -AC_INIT([InputProto], [2.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
> +AC_INIT([InputProto], [2.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])

bump to version 2.0.99.1 is better for now, we can't possibly claim this is
stable yet :)

>  AM_INIT_AUTOMAKE([foreign dist-bzip2])
>  AM_MAINTAINER_MODE
>  
> -- 
> 1.7.1

I would _really_ like to see the XI2proto.txt patch for this too to see the
semantics of these changes.

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
for this patch, but that's without knowing wider implications based on the
semantics.

Cheers,
  Peter
 


More information about the xorg-devel mailing list