From aa028b726966fab117c64afd5d5efa861c2d4666 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 24 Apr 2015 12:23:45 +1000 Subject: [PATCH] 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 --- src/evdev-mt-touchpad-buttons.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index 2869be3c..be6dc7ca 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;