[PATCH synaptics 08/12] Factor out updating the hardware state.

Jamey Sharp jamey at minilop.net
Fri May 7 16:43:05 PDT 2010


Reviewed-by: Jamey Sharp <jamey at minilop.net>

On Thu, May 6, 2010 at 9:42 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> No functional changes.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/synaptics.c |   55 ++++++++++++++++++++++++++++++++-----------------------
>  1 files changed, 32 insertions(+), 23 deletions(-)
>
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 9a286b5..650fbc2 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -2127,6 +2127,37 @@ adjust_state_from_scrollbuttons(const LocalDevicePtr local, struct SynapticsHwSt
>  }
>
>  static inline void
> +update_hw_button_state(const LocalDevicePtr local, struct SynapticsHwState *hw, int *delay)
> +{
> +    SynapticsPrivate *priv = (SynapticsPrivate *) (local->private);
> +    SynapticsParameters *para = &priv->synpara;
> +
> +    /* Treat the first two multi buttons as up/down for now. */
> +    hw->up |= hw->multi[0];
> +    hw->down |= hw->multi[1];
> +
> +    if (!para->guestmouse_off) {
> +       hw->left |= hw->guest_left;
> +       hw->middle |= hw->guest_mid;
> +       hw->right |= hw->guest_right;
> +    }
> +
> +    /* 3rd button emulation */
> +    hw->middle |= HandleMidButtonEmulation(priv, hw, delay);
> +
> +    /* Fingers emulate other buttons */
> +    if(hw->left && hw->numFingers >= 1){
> +        HandleClickWithFingers(para, hw);
> +    }
> +
> +    /* Two finger emulation */
> +    if (hw->numFingers == 1 && hw->z >= para->emulate_twofinger_z &&
> +        hw->fingerWidth >= para->emulate_twofinger_w) {
> +       hw->numFingers = 2;
> +    }
> +}
> +
> +static inline void
>  post_button_click(const LocalDevicePtr local, const int button)
>  {
>     xf86PostButtonEvent(local->dev, FALSE, button, TRUE, 0, 0);
> @@ -2177,29 +2208,7 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw)
>     if (para->touchpad_off == 1)
>        return delay;
>
> -    /* Treat the first two multi buttons as up/down for now. */
> -    hw->up |= hw->multi[0];
> -    hw->down |= hw->multi[1];
> -
> -    if (!para->guestmouse_off) {
> -       hw->left |= hw->guest_left;
> -       hw->middle |= hw->guest_mid;
> -       hw->right |= hw->guest_right;
> -    }
> -
> -    /* 3rd button emulation */
> -    hw->middle |= HandleMidButtonEmulation(priv, hw, &delay);
> -
> -    /* Fingers emulate other buttons */
> -    if(hw->left && hw->numFingers >= 1){
> -        HandleClickWithFingers(para, hw);
> -    }
> -
> -    /* Two finger emulation */
> -    if (hw->numFingers == 1 && hw->z >= para->emulate_twofinger_z &&
> -        hw->fingerWidth >= para->emulate_twofinger_w) {
> -       hw->numFingers = 2;
> -    }
> +    update_hw_button_state(local, hw, &delay);
>
>     double_click = adjust_state_from_scrollbuttons(local, hw);
>
> --
> 1.6.6.1
>
> _______________________________________________
> 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