touchpad: don't re-use button variable
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 24 Apr 2015 02:23:45 +0000 (12:23 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 24 Apr 2015 02:52:11 +0000 (12:52 +1000)
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>
src/evdev-mt-touchpad-buttons.c

index 2869be3ce0b424f6b47d3622f70599fd114d9521..be6dc7ca41b8695f43243c369ddeabde96d79b68 100644 (file)
@@ -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;