[PATCH v2] Don't check for soft buttons if a button is already down

Chase Douglas chase.douglas at canonical.com
Thu May 10 09:17:25 PDT 2012


On 05/09/2012 06:00 PM, Peter Hutterer wrote:
> Moving into a different soft button's area during drag-n-drop would trigger
> a click of that button.
> 
> We only have the current button state and we mess with it, so the conditions
> for a possible clickpad soft-button event are:
> - hw->left is down now
> - none of left|right|middle were down before. since we change hw->left to
>   hw->right/left we need to check all three
> 
> If hw->left is down but one of the other buttons was already down, copy that
> button state and continue.
> 
> http://bugzilla.redhat.com/819348
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Changes to v1:
> - check for all three buttons since we may have changed the hw-state for the
>   right/middle button
> - if left is down and was already down, copy the previous hardware state to
>   maintain the right button state
> 
>  src/synaptics.c |   25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 4f2bf78..6b95850 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -2538,14 +2538,23 @@ update_hw_button_state(const InputInfoPtr pInfo, struct SynapticsHwState *hw,
>  
>      /* If this is a clickpad and the user clicks in a soft button area, press
>       * the soft button instead. */
> -    if (para->clickpad && hw->left && !hw->right && !hw->middle) {
> -        if (is_inside_rightbutton_area(para, hw->x, hw->y)) {
> -            hw->left = 0;
> -            hw->right = 1;
> -        }
> -        else if (is_inside_middlebutton_area(para, hw->x, hw->y)) {
> -            hw->left = 0;
> -            hw->middle = 1;
> +    if (para->clickpad) {
> +        /* hw->left is down, but no other buttons were already down */
> +        if (!old->left && !old->right && !old->middle &&
> +            hw->left && !hw->right && !hw->middle) {
> +                if (is_inside_rightbutton_area(para, hw->x, hw->y)) {
> +                    hw->left = 0;
> +                    hw->right = 1;
> +                }
> +                else if (is_inside_middlebutton_area(para, hw->x, hw->y)) {
> +                    hw->left = 0;
> +                    hw->middle = 1;
> +                }
> +        }
> +        else if (hw->left) {
> +            hw->left = old->left;
> +            hw->right = old->right;
> +            hw->middle = old->middle;
>          }
>      }
>  

This looks right to me now.

Reviewed-by: Chase Douglas <chase.douglas at canonical.com>


More information about the xorg-devel mailing list