Beispiel #1
0
static void
touchpad_button_handle_event(struct touchpad *tp, struct touch *t,
			     enum button_event event, void *userdata)
{
	argcheck_int_range(event, BUTTON_EVENT_IN_R, BUTTON_EVENT_TIMEOUT);


#if 0
	touchpad_log(tp, TOUCHPAD_LOG_DEBUG, "%d button state: from %s, event %s to:\n",
			t->number,
			button_state_to_str(t->button_state),
			button_event_to_str(event));
#endif

	switch(t->button_state) {
		case BUTTON_STATE_NONE:
			touchpad_button_none_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_AREA:
			touchpad_button_area_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_LEFT:
			touchpad_button_left_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_LEFT_NEW:
			touchpad_button_left_new_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_RIGHT:
			touchpad_button_right_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_RIGHT_NEW:
			touchpad_button_right_new_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_LEFT_TO_AREA:
			touchpad_button_left_to_area_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_RIGHT_TO_AREA:
			touchpad_button_right_to_area_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_LEFT_TO_RIGHT:
			touchpad_button_left_to_right_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_RIGHT_TO_LEFT:
			touchpad_button_right_to_left_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_PRESSED_RIGHT:
			touchpad_button_pressed_right_handle_event(tp, t, event, userdata);
			break;
		case BUTTON_STATE_PRESSED_LEFT:
			touchpad_button_pressed_left_handle_event(tp, t, event, userdata);
			break;
	}

#if 0
	touchpad_log(tp, TOUCHPAD_LOG_DEBUG, "	...%s\n", button_state_to_str(t->button_state));
#endif
}
static void
tp_button_handle_event(struct tp_dispatch *tp,
		       struct tp_touch *t,
		       enum button_event event,
		       uint64_t time)
{
	struct libinput *libinput = tp_libinput_context(tp);
	enum button_state current = t->button.state;

	switch(t->button.state) {
	case BUTTON_STATE_NONE:
		tp_button_none_handle_event(tp, t, event);
		break;
	case BUTTON_STATE_AREA:
		tp_button_area_handle_event(tp, t, event);
		break;
	case BUTTON_STATE_BOTTOM:
		tp_button_bottom_handle_event(tp, t, event);
		break;
	case BUTTON_STATE_TOP:
		tp_button_top_handle_event(tp, t, event);
		break;
	case BUTTON_STATE_TOP_NEW:
		tp_button_top_new_handle_event(tp, t, event);
		break;
	case BUTTON_STATE_TOP_TO_IGNORE:
		tp_button_top_to_ignore_handle_event(tp, t, event);
		break;
	case BUTTON_STATE_IGNORE:
		tp_button_ignore_handle_event(tp, t, event);
		break;
	}

	if (current != t->button.state)
		log_debug(libinput,
			  "button state: from %s, event %s to %s\n",
			  button_state_to_str(current),
			  button_event_to_str(event),
			  button_state_to_str(t->button.state));
}