From 3de191e6b0aba72bac29141da6844ea3092d7c85 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 9 Oct 2012 18:44:29 +0100 Subject: [PATCH] evdev-touchpad: Twiddle finger_state correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original code always set the finger_state to the appropriate bitmask irrespective of whether the event was a press or a release. It would also blat all members of the bitmask rather than ORing in the new bit for the event. Cc:Jonas Ã…dahl Signed-off-by: Rob Bradford --- src/evdev-touchpad.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c index e453f9d2..4da37a51 100644 --- a/src/evdev-touchpad.c +++ b/src/evdev-touchpad.c @@ -457,19 +457,19 @@ process_key(struct touchpad_dispatch *touchpad, touchpad->reset = 1; break; case BTN_TOOL_FINGER: - touchpad->finger_state = - ~TOUCHPAD_FINGERS_ONE | e->value ? - TOUCHPAD_FINGERS_ONE : 0; + touchpad->finger_state &= ~TOUCHPAD_FINGERS_ONE; + if (e->value) + touchpad->finger_state |= TOUCHPAD_FINGERS_ONE; break; case BTN_TOOL_DOUBLETAP: - touchpad->finger_state = - ~TOUCHPAD_FINGERS_TWO | e->value ? - TOUCHPAD_FINGERS_TWO : 0; + touchpad->finger_state &= ~TOUCHPAD_FINGERS_TWO; + if (e->value) + touchpad->finger_state |= TOUCHPAD_FINGERS_TWO; break; case BTN_TOOL_TRIPLETAP: - touchpad->finger_state = - ~TOUCHPAD_FINGERS_THREE | e->value ? - TOUCHPAD_FINGERS_THREE : 0; + touchpad->finger_state &= ~TOUCHPAD_FINGERS_THREE; + if (e->value) + touchpad->finger_state |= TOUCHPAD_FINGERS_THREE; break; } }