[PATCH 09/10] Save physical button state for emulated touches too
Peter Hutterer
peter.hutterer at who-t.net
Tue Apr 17 23:41:56 PDT 2012
On Tue, Apr 17, 2012 at 04:33:28PM -0700, Chase Douglas wrote:
> The physical button state is reported by XIQueryPointer for clients
this should read "logical button state" and I believe TouchClassRec::state
already has exactly this information, right?
Cheers,
Peter
> supporting XI 2.1 and earlier.
>
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
> Xi/exevents.c | 14 ++++++++++++--
> include/inputstr.h | 3 ++-
> 2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/Xi/exevents.c b/Xi/exevents.c
> index 90b7c4d..724b228 100644
> --- a/Xi/exevents.c
> +++ b/Xi/exevents.c
> @@ -951,7 +951,12 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
> BUG_WARN(!b || !v);
> BUG_WARN(!t);
>
> - if (!b || !t || !b->map[key])
> + if (!b || !t)
> + return DONT_PROCESS;
> +
> + SetBit(t->down, key);
> +
> + if (!b->map[key])
> return DONT_PROCESS;
>
> if (!(event->flags & TOUCH_POINTER_EMULATED) ||
> @@ -966,7 +971,12 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
> BUG_WARN(!b || !v);
> BUG_WARN(!t);
>
> - if (!b || !t || t->buttonsDown <= 0 || !b->map[key])
> + if (!b || !t)
> + return DONT_PROCESS;
> +
> + ClearBit(t->down, key);
> +
> + if (t->buttonsDown <= 0 || !b->map[key])
> return DONT_PROCESS;
>
> if (!(event->flags & TOUCH_POINTER_EMULATED))
> diff --git a/include/inputstr.h b/include/inputstr.h
> index 5a38924..31c1e78 100644
> --- a/include/inputstr.h
> +++ b/include/inputstr.h
> @@ -342,7 +342,8 @@ typedef struct _TouchClassRec {
> CARD8 mode; /* ::XIDirectTouch, XIDependentTouch */
> /* for pointer-emulation */
> CARD8 buttonsDown; /* number of buttons down */
> - unsigned short state; /* logical button state */
> + CARD8 down[DOWN_LENGTH]; /* physical emulated button state */
> + unsigned short state; /* logical emulated button state */
> Mask motionMask;
> } TouchClassRec;
>
> --
> 1.7.9.1
More information about the xorg-devel
mailing list