[PATCH v2 03/28] Input: Add flags to RawDeviceEvent

Peter Hutterer peter.hutterer at who-t.net
Wed Jun 22 20:41:58 PDT 2011


On Thu, Jun 09, 2011 at 06:17:11PM +0100, Daniel Stone wrote:
> Add a flags member which will be copied wholesale into the resultant
> xXIRawEvent.

sorry to flip-flop on this, but seing this patch and reading the XI2 proto
definition of XIRawEvents makes me think that solving raw events properly is going
to be trickier than just the flag setting. Technically the raw data is a
button press but the transformed values are of a different number, etc. etc.

If raw events should continue to be the driver-native data it may be better
to just skip them altogether and not emulate them at all. What do you think?

Cheers,
  Peter
> 
> Signed-off-by: Daniel Stone <daniel at fooishbar.org>
> ---
>  dix/eventconvert.c               |    1 +
>  include/eventstr.h               |    1 +
>  test/xi2/protocol-eventconvert.c |    1 +
>  3 files changed, 3 insertions(+), 0 deletions(-)
> 
> v2: New patch.
> 
> diff --git a/dix/eventconvert.c b/dix/eventconvert.c
> index 6ddcf9e..fa8ba9e 100644
> --- a/dix/eventconvert.c
> +++ b/dix/eventconvert.c
> @@ -667,6 +667,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
>      raw->detail         = ev->detail.button;
>      raw->deviceid       = ev->deviceid;
>      raw->valuators_len  = vallen;
> +    raw->flags          = ev->flags;
>  
>      ptr = (char*)&raw[1];
>      axisval = (FP3232*)(ptr + raw->valuators_len * 4);
> diff --git a/include/eventstr.h b/include/eventstr.h
> index 0885883..ecaeddc 100644
> --- a/include/eventstr.h
> +++ b/include/eventstr.h
> @@ -204,6 +204,7 @@ struct _RawDeviceEvent
>          int32_t  data_raw[MAX_VALUATORS];     /**< Valuator data as posted */
>          int32_t  data_raw_frac[MAX_VALUATORS];/**< Fractional part for data_raw */
>      } valuators;
> +    uint32_t flags;       /**< Flags to be copied into the generated event */
>  };
>  
>  #ifdef XQUARTZ
> diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
> index 6e61d74..5eb4531 100644
> --- a/test/xi2/protocol-eventconvert.c
> +++ b/test/xi2/protocol-eventconvert.c
> @@ -53,6 +53,7 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
>          swapl(&out->time, n);
>          swapl(&out->detail, n);
>          swaps(&out->valuators_len, n);
> +        swapl(&out->flags, n);
>      }
>  
>  
> -- 
> 1.7.5.3


More information about the xorg-devel mailing list