[PATCH inputproto multitouch] Create separate structure for XI 2.2 XIAllowEvents request

Peter Hutterer peter.hutterer at who-t.net
Fri Sep 16 10:00:07 PDT 2011


On Wed, Sep 14, 2011 at 10:20:24PM -0700, Chase Douglas wrote:
> The GetReq Xlib macro uses string contatenation of request names to
> assign structures and get the appropriate size block from the Xlib
> buffer. This means we can't use GetReq with a different struct name than
> the original XI 2.0 name.
> 
> The only sane way around this seems to be to create a separate struct to
> hold the new members of the extended request. Then, GetReqExtra can be
> used to get a request set up correctly with extra room on the end for
> the extended parameters.

I'd rather keep libXi hacks in the library, not in the protocol.

see http://lists.x.org/archives/xorg-devel/2011-June/022841.html for an
example of where I did this for the XIGrabDevice request. This is a
different situation since the actual data isn't after variable data but
I'm hoping that there's a solution for this case too.

Cheers,
  Peter
 
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
>  XI2proto.h |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/XI2proto.h b/XI2proto.h
> index 2460cf5..37304b9 100644
> --- a/XI2proto.h
> +++ b/XI2proto.h
> @@ -647,10 +647,19 @@ typedef struct {
>      uint16_t    deviceid;
>      uint8_t     mode;
>      uint8_t     pad;
> -    uint32_t    touch_id;               /**< Since XI 2.2 */
> -    Window      grab_window;            /**< Since XI 2.2 */
>  } xXIAllowEventsReq;
> -#define sz_xXIAllowEventsReq                   20 /**< Was 12 before XI 2.2 */
> +#define sz_xXIAllowEventsReq                   12
> +
> +
> +/**
> + * Allow or replay events on the specified grabbed device (XI 2.2 and on).
> + */
> +typedef struct {
> +    xXIAllowEventsReq req_2_0;
> +    uint32_t    touch_id;
> +    Window      grab_window;
> +} xXIAllowEventsReq_2_2;
> +#define sz_xXIAllowEvents_2_2Req               20
>  
>  
>  /**
> -- 
> 1.7.4.1
> 


More information about the xorg-devel mailing list