static void tp_tap_notify(struct tp_dispatch *tp, uint64_t time, int nfingers, enum libinput_button_state state) { int32_t button; int32_t button_map[2][3] = { { BTN_LEFT, BTN_RIGHT, BTN_MIDDLE }, { BTN_LEFT, BTN_MIDDLE, BTN_RIGHT }, }; assert(tp->tap.map < ARRAY_LENGTH(button_map)); if (nfingers > 3) return; button = button_map[tp->tap.map][nfingers - 1]; if (state == LIBINPUT_BUTTON_STATE_PRESSED) tp->tap.buttons_pressed |= (1 << nfingers); else tp->tap.buttons_pressed &= ~(1 << nfingers); evdev_pointer_notify_button(tp->device, time, button, state); }
static void tp_tap_notify(struct tp_dispatch *tp, uint64_t time, int nfingers, enum libinput_button_state state) { int32_t button; switch (nfingers) { case 1: button = BTN_LEFT; break; case 2: button = BTN_RIGHT; break; case 3: button = BTN_MIDDLE; break; default: return; } if (state == LIBINPUT_BUTTON_STATE_PRESSED) tp->tap.buttons_pressed |= (1 << nfingers); else tp->tap.buttons_pressed &= ~(1 << nfingers); evdev_pointer_notify_button(tp->device, time, button, state); }
static void middlebutton_post_event(struct evdev_device *device, uint64_t now, int button, enum libinput_button_state state) { evdev_pointer_notify_button(device, now, button, state); }