[PATCH weston] evdev-touchpad: Disable tap FSM by default on touchpads with button pads

Jonas Ådahl jadahl at gmail.com
Fri Mar 22 00:41:42 PDT 2013


Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---

Hi,

Haven't tested this on a clickpad, but it should disable the tapping
feature for clickpads and other touchpads that advertise the existance
of a buttonpad.

Jonas

 src/evdev-touchpad.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c
index a35708c..cb9620d 100644
--- a/src/evdev-touchpad.c
+++ b/src/evdev-touchpad.c
@@ -123,6 +123,8 @@ struct touchpad_dispatch {
 	int reset;
 
 	struct {
+		bool enable;
+
 		struct wl_array events;
 		enum fsm_state state;
 		struct wl_event_source *timer_source;
@@ -306,6 +308,9 @@ process_fsm_events(struct touchpad_dispatch *touchpad, uint32_t time)
 	enum fsm_event *pevent;
 	enum fsm_event event;
 
+	if (!touchpad->fsm.enable)
+		return;
+
 	if (touchpad->fsm.events.size == 0)
 		return;
 
@@ -397,6 +402,9 @@ push_fsm_event(struct touchpad_dispatch *touchpad,
 {
 	enum fsm_event *pevent;
 
+	if (!touchpad->fsm.enable)
+		return;
+
 	pevent = wl_array_add(&touchpad->fsm.events, sizeof event);
 	if (pevent)
 		*pevent = event;
@@ -675,9 +683,12 @@ touchpad_init(struct touchpad_dispatch *touchpad,
 	struct weston_motion_filter *accel;
 	struct wl_event_loop *loop;
 
+	unsigned long prop_bits[INPUT_PROP_MAX];
 	struct input_absinfo absinfo;
 	unsigned long abs_bits[NBITS(ABS_MAX)];
 
+	bool has_buttonpad;
+
 	double width;
 	double height;
 	double diagonal;
@@ -688,6 +699,9 @@ touchpad_init(struct touchpad_dispatch *touchpad,
 	/* Detect model */
 	touchpad->model = get_touchpad_model(device);
 
+	ioctl(device->fd, EVIOCGPROP(sizeof(prop_bits)), prop_bits);
+	has_buttonpad = TEST_BIT(prop_bits, INPUT_PROP_BUTTONPAD);
+
 	/* Configure pressure */
 	ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits);
 	if (TEST_BIT(abs_bits, ABS_PRESSURE)) {
@@ -744,6 +758,9 @@ touchpad_init(struct touchpad_dispatch *touchpad,
 		return -1;
 	}
 
+	/* Configure */
+	touchpad->fsm.enable = !has_buttonpad;
+
 	return 0;
 }
 
-- 
1.7.10.4



More information about the wayland-devel mailing list