On Tue, Apr 5, 2011 at 3:00 PM, Jason Gerecke <killert...@gmail.com> wrote:
> Commit e9e7397cd1f1bc37f27992114cebd39f4ad93e12 changed xsetwacom
> so that it no longer used XSetDeviceButtonMapping to handle "simple"
> button mapping (parse_actions was modified to handle the translation
> in the prior commit).
>
> This patch modifies gestures so they work like buttons et.al. The
> sendAButton function now sends an action if it exists, falling back
> to the hardcoded defaults otherwise.
>
> NOTE: The zoom gesture uses CTRL+<button 4/5> to zoom in and out.
> If buttons 4 or 5 are remapped to press keyboard keys, the net
> effect is the same as if CTRL were being held. This should be obvious
> to users who understand how zooming works in most applications,
> but is mentioned here for full disclosure.
>
> Signed-off-by: Jason Gerecke <killert...@gmail.com>
> ---
>  src/wcmCommon.c      |    2 +-
>  src/wcmTouchFilter.c |   23 ++++++++++++++++++++---
>  src/xf86Wacom.h      |    3 +++
>  3 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
> index a1eb742..0d3e8d8 100644
> --- a/src/wcmCommon.c
> +++ b/src/wcmCommon.c
> @@ -199,7 +199,7 @@ static int countPresses(int keybtn, unsigned int* keys, 
> int size)
>        return count;
>  }
>
> -static void sendAction(InputInfoPtr pInfo, int press,
> +void sendAction(InputInfoPtr pInfo, int press,
>                       unsigned int *keys, int nkeys,
>                       int first_val, int num_val, int *valuators)
>  {
> diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
> index 4afede2..d8cb260 100644
> --- a/src/wcmTouchFilter.c
> +++ b/src/wcmTouchFilter.c
> @@ -95,6 +95,7 @@ static void wcmSendButtonClick(WacomDevicePtr priv, int 
> button, int state)
>        int x = 0;
>        int y = 0;
>        int mode = is_absolute(priv->pInfo);
> +       int valuators[priv->naxes];
>
>        if (mode)
>        {
> @@ -102,10 +103,26 @@ static void wcmSendButtonClick(WacomDevicePtr priv, int 
> button, int state)
>                y = priv->oldY;
>        }
>
> -       /* send button event in state */
> -       xf86PostButtonEvent(priv->pInfo->dev, mode,button,
> -               state,0,priv->naxes,x,y,0,0,0,0);
> +       valuators[0] = x;
> +       valuators[1] = y;
> +       valuators[2] = 0;
> +       valuators[3] = 0;
> +       valuators[4] = 0;
> +       valuators[5] = 0;
>
> +       if (!priv->keys[button][0])
> +       {
> +               /* No button action configured, send button */
> +               xf86PostButtonEventP(priv->pInfo->dev, mode,
> +                                    button, (state != 0),
> +                                    0, priv->naxes, valuators);

I believe this can result in post the X/Y values twice.  For relative
devices, such as Bamboo's, this could be cursor jumps.

I think you can either put 0 where you have priv->naxes or change the
parameter right before it to 2 to skip over X/Y.

Are there any chance this function gets called to click button 0?  If
so, it could have issues with tablet PC's.  They do a button 0 click
in wcmUSB; which bypasses this function.  You'll see some odd code in
wcmTouchFilter that undoes that wcmUSB button 0 so gestures work....
but I don't think it does it by calling this function?


> +       }
> +       else
> +       {
> +               sendAction(priv->pInfo, (state != 0), priv->keys[button],
> +                          ARRAY_SIZE(priv->keys[button]),
> +                          0, priv->naxes, valuators);
> +       }
>        /* We have changed the button state (from down to up) for the device
>         * so we need to update the record */
>        if (button == 1)
> diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h
> index e5149b3..08ae858 100644
> --- a/src/xf86Wacom.h
> +++ b/src/xf86Wacom.h
> @@ -153,6 +153,9 @@ extern void wcmChangeScreen(InputInfoPtr pInfo, int 
> value);
>  extern int wcmTilt2R(int x, int y, double offset);
>  extern void wcmGestureFilter(WacomDevicePtr priv, int channel);
>  extern void wcmEmitKeycode(DeviceIntPtr keydev, int keycode, int state);
> +extern void sendAction(InputInfoPtr pInfo, int press,
> +                      unsigned int *keys, int nkeys,
> +                      int first_val, int num_val, int *valuators);
>  extern void wcmSoftOutEvent(InputInfoPtr pInfo);
>
>  extern void wcmRotateTablet(InputInfoPtr pInfo, int value);
> --
> 1.7.4.1
>
>
> ------------------------------------------------------------------------------
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> _______________________________________________
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to