touchpad: Handle two-finger click as right click for button pads
authorKristian Høgsberg <krh@bitplanet.net>
Mon, 1 Jul 2013 16:48:55 +0000 (12:48 -0400)
committerJonas Ådahl <jadahl@gmail.com>
Sun, 10 Nov 2013 16:51:32 +0000 (17:51 +0100)
src/evdev-touchpad.c

index a21ae0b..53300ce 100644 (file)
@@ -571,6 +571,8 @@ process_key(struct touchpad_dispatch *touchpad,
            struct input_event *e,
            uint32_t time)
 {
+       uint32_t code;
+
        switch (e->code) {
        case BTN_TOUCH:
                if (!touchpad->has_pressure) {
@@ -588,8 +590,12 @@ process_key(struct touchpad_dispatch *touchpad,
        case BTN_FORWARD:
        case BTN_BACK:
        case BTN_TASK:
-               notify_button(device->seat,
-                             time, e->code,
+               if (!touchpad->fsm.enable && e->code == BTN_LEFT &&
+                   touchpad->finger_state == TOUCHPAD_FINGERS_TWO)
+                       code = BTN_RIGHT;
+               else
+                       code = e->code;
+               notify_button(device->seat, time, code,
                              e->value ? WL_POINTER_BUTTON_STATE_PRESSED :
                                         WL_POINTER_BUTTON_STATE_RELEASED);
                break;