Exemplo n.º 1
0
static void
notify_button_released(struct touchpad_dispatch *touchpad, uint32_t time)
{
	pointer_notify_button(
		&touchpad->device->base,
		time,
		DEFAULT_TOUCHPAD_SINGLE_TAP_BUTTON,
		LIBINPUT_POINTER_BUTTON_STATE_RELEASED);
}
Exemplo n.º 2
0
static inline void
evdev_process_key(struct evdev_device *device, struct input_event *e, int time)
{
	/* ignore kernel key repeat */
	if (e->value == 2)
		return;

	if (e->code == BTN_TOUCH) {
		if (!device->is_mt)
			evdev_process_touch_button(device, time, e->value);
		return;
	}

	evdev_flush_pending_event(device, time);

	switch (e->code) {
	case BTN_LEFT:
	case BTN_RIGHT:
	case BTN_MIDDLE:
	case BTN_SIDE:
	case BTN_EXTRA:
	case BTN_FORWARD:
	case BTN_BACK:
	case BTN_TASK:
		pointer_notify_button(
			&device->base,
			time,
			e->code,
			e->value ? LIBINPUT_POINTER_BUTTON_STATE_PRESSED :
				   LIBINPUT_POINTER_BUTTON_STATE_RELEASED);
		break;

	default:
		keyboard_notify_key(
			&device->base,
			time,
			e->code,
			e->value ? LIBINPUT_KEYBOARD_KEY_STATE_PRESSED :
				   LIBINPUT_KEYBOARD_KEY_STATE_RELEASED);
		break;
	}
}
Exemplo n.º 3
0
static inline void
process_key(struct touchpad_dispatch *touchpad,
	    struct evdev_device *device,
	    struct input_event *e,
	    uint32_t time)
{
	uint32_t code;

	switch (e->code) {
	case BTN_TOUCH:
		if (!touchpad->has_pressure) {
			if (e->value && !(touchpad->state & TOUCHPAD_STATE_TOUCH))
				on_touch(touchpad);
			else if (!e->value)
				on_release(touchpad);
		}
		break;
	case BTN_LEFT:
	case BTN_RIGHT:
	case BTN_MIDDLE:
	case BTN_SIDE:
	case BTN_EXTRA:
	case BTN_FORWARD:
	case BTN_BACK:
	case BTN_TASK:
		if (!touchpad->fsm.enable && e->code == BTN_LEFT &&
		    touchpad->finger_state == TOUCHPAD_FINGERS_TWO)
			code = BTN_RIGHT;
		else
			code = e->code;
		pointer_notify_button(
			&touchpad->device->base,
			time,
			code,
			e->value ? LIBINPUT_POINTER_BUTTON_STATE_PRESSED :
				   LIBINPUT_POINTER_BUTTON_STATE_RELEASED);
		break;
	case BTN_TOOL_PEN:
	case BTN_TOOL_RUBBER:
	case BTN_TOOL_BRUSH:
	case BTN_TOOL_PENCIL:
	case BTN_TOOL_AIRBRUSH:
	case BTN_TOOL_MOUSE:
	case BTN_TOOL_LENS:
		touchpad->reset = 1;
		break;
	case BTN_TOOL_FINGER:
		if (e->value)
			touchpad->finger_state |= TOUCHPAD_FINGERS_ONE;
		else
			touchpad->finger_state &= ~TOUCHPAD_FINGERS_ONE;
		break;
	case BTN_TOOL_DOUBLETAP:
		if (e->value)
			touchpad->finger_state |= TOUCHPAD_FINGERS_TWO;
		else
			touchpad->finger_state &= ~TOUCHPAD_FINGERS_TWO;
		break;
	case BTN_TOOL_TRIPLETAP:
		if (e->value)
			touchpad->finger_state |= TOUCHPAD_FINGERS_THREE;
		else
			touchpad->finger_state &= ~TOUCHPAD_FINGERS_THREE;
		break;
	}
}