[PATCH] Xi: Honor pointer-emulating touch when setting the button mask in XIQueryDevice

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 5 21:59:44 PST 2014


On Fri, Jan 03, 2014 at 05:41:45PM +0100, Carlos Garnacho wrote:
> If a touch is currently active and emulating pointer events, XIQueryDevice must
> set the button 1 in the mask so pointer emulation is complete, as clients using
> XI2 would get inconsistent button states wrt events if querying the device. This
> is already handled correctly on the core protocol requests.

the behaviour for XIQueryPointer is to include the button state for
clients < XI 2.2, but don't include it for clients that know about touch (and can
thus handle touch). I think we should emulate the same behaviour here to be
consistent (though I can't find the documentation for this anymore). This
would of course mean that XI2.2+ clients can't tell if there's a
pointer-emulating touch currently active...

Cheers,
   Peter

PS: xiquerypointer.c needs the loop below instead of a just buttonsDown > 0.
Feel free to add that patch to your list ;)

 
> Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
> ---
>  Xi/xiquerydevice.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
> index 4e544f0..762968a 100644
> --- a/Xi/xiquerydevice.c
> +++ b/Xi/xiquerydevice.c
> @@ -261,11 +261,23 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo * info, Bool reportState)
>      bits = (unsigned char *) &info[1];
>      memset(bits, 0, mask_len * 4);
>  
> -    if (reportState)
> +    if (reportState) {
>          for (i = 0; i < dev->button->numButtons; i++)
>              if (BitIsOn(dev->button->down, i))
>                  SetBit(bits, i);
>  
> +        /* Cater for touch pointer-emulation */
> +        if (dev->touch) {
> +            for (i = 0; i < dev->touch->num_touches; i++) {
> +                TouchPointInfoPtr ti = dev->touch->touches + i;
> +                if (ti->active && ti->emulate_pointer) {
> +                    SetBit(bits, 1);
> +                    break;
> +                }
> +            }
> +        }
> +    }
> +
>      bits += mask_len * 4;
>      memcpy(bits, dev->button->labels, dev->button->numButtons * sizeof(Atom));
>  
> -- 
> 1.8.5.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list