summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-04-24 12:23:45 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-04-24 12:52:11 +1000
commitaa028b726966fab117c64afd5d5efa861c2d4666 (patch)
tree7bc3b0712061b5a4cee09fb04d9499a0a38fae8c
parentd4e6692d03bddf71f2a7b371790b5198dc962a98 (diff)
touchpad: don't re-use button variable
Split into button and area, the latter of which is the bitmask of which area we're in. No functional changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev-mt-touchpad-buttons.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 2869be3..be6dc7c 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -833,44 +833,45 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
if (current) {
struct tp_touch *t;
+ uint32_t area = 0;
tp_for_each_touch(tp, t) {
switch (t->button.curr) {
case BUTTON_EVENT_IN_AREA:
- button |= AREA;
+ area |= AREA;
break;
case BUTTON_EVENT_IN_TOP_L:
is_top = 1;
/* fallthrough */
case BUTTON_EVENT_IN_BOTTOM_L:
- button |= LEFT;
+ area |= LEFT;
break;
case BUTTON_EVENT_IN_TOP_M:
is_top = 1;
- button |= MIDDLE;
+ area |= MIDDLE;
break;
case BUTTON_EVENT_IN_TOP_R:
is_top = 1;
/* fallthrough */
case BUTTON_EVENT_IN_BOTTOM_R:
- button |= RIGHT;
+ area |= RIGHT;
break;
default:
break;
}
}
- if (button == 0) {
+ if (area == 0) {
/* No touches, wait for a touch before processing */
tp->buttons.click_pending = true;
return 0;
}
- if ((button & MIDDLE) || ((button & LEFT) && (button & RIGHT)))
+ if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT)))
button = evdev_to_left_handed(tp->device, BTN_MIDDLE);
- else if (button & RIGHT)
+ else if (area & RIGHT)
button = evdev_to_left_handed(tp->device, BTN_RIGHT);
- else if (button & LEFT)
+ else if (area & LEFT)
button = evdev_to_left_handed(tp->device, BTN_LEFT);
else /* main area is always BTN_LEFT */
button = BTN_LEFT;