96 lines
3.2 KiB
Diff
96 lines
3.2 KiB
Diff
From 7fe0a040794bf09c71e08ff3fbdae0a2a94039bd Mon Sep 17 00:00:00 2001
|
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Date: Wed, 24 Jun 2015 11:41:47 +1000
|
|
Subject: [PATCH libinput 4/4] touchpad: disable trackpoint palm detection on
|
|
small touchpads
|
|
|
|
Tested on three laptops here, Lenovo T61, X220 and an HP EliteBook (?), all
|
|
with small touchpads. It's hard to have a hand position where the palm touches
|
|
the touchpad while using the trackpoint. So we might as well save us the
|
|
effort of monitoring events and enabling/disabling it on demand.
|
|
|
|
As a side-effect this fixes 1233844, but that's more a coincidence.
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1233844
|
|
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
|
|
---
|
|
src/evdev-mt-touchpad.c | 20 ++++++++++++++------
|
|
src/evdev-mt-touchpad.h | 1 +
|
|
2 files changed, 15 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
|
|
index fa7d06b..163226e 100644
|
|
--- a/src/evdev-mt-touchpad.c
|
|
+++ b/src/evdev-mt-touchpad.c
|
|
@@ -520,6 +520,9 @@ tp_palm_detect_trackpoint(struct tp_dispatch *tp,
|
|
struct tp_touch *t,
|
|
uint64_t time)
|
|
{
|
|
+ if (!tp->palm.monitor_trackpoint)
|
|
+ return 0;
|
|
+
|
|
if (t->palm.state == PALM_NONE &&
|
|
t->state == TOUCH_BEGIN &&
|
|
tp->palm.trackpoint_active) {
|
|
@@ -844,7 +847,8 @@ tp_remove_sendevents(struct tp_dispatch *tp)
|
|
libinput_timer_cancel(&tp->palm.trackpoint_timer);
|
|
libinput_timer_cancel(&tp->dwt.keyboard_timer);
|
|
|
|
- if (tp->buttons.trackpoint)
|
|
+ if (tp->buttons.trackpoint &&
|
|
+ tp->palm.monitor_trackpoint)
|
|
libinput_device_remove_event_listener(
|
|
&tp->palm.trackpoint_listener);
|
|
|
|
@@ -1109,9 +1113,10 @@ tp_interface_device_added(struct evdev_device *device,
|
|
/* Don't send any pending releases to the new trackpoint */
|
|
tp->buttons.active_is_topbutton = false;
|
|
tp->buttons.trackpoint = added_device;
|
|
- libinput_device_add_event_listener(&added_device->base,
|
|
- &tp->palm.trackpoint_listener,
|
|
- tp_trackpoint_event, tp);
|
|
+ if (tp->palm.monitor_trackpoint)
|
|
+ libinput_device_add_event_listener(&added_device->base,
|
|
+ &tp->palm.trackpoint_listener,
|
|
+ tp_trackpoint_event, tp);
|
|
}
|
|
|
|
if (added_device->tags & EVDEV_TAG_KEYBOARD &&
|
|
@@ -1150,8 +1155,9 @@ tp_interface_device_removed(struct evdev_device *device,
|
|
tp->buttons.active = 0;
|
|
tp->buttons.active_is_topbutton = false;
|
|
}
|
|
- libinput_device_remove_event_listener(
|
|
- &tp->palm.trackpoint_listener);
|
|
+ if (tp->palm.monitor_trackpoint)
|
|
+ libinput_device_remove_event_listener(
|
|
+ &tp->palm.trackpoint_listener);
|
|
tp->buttons.trackpoint = NULL;
|
|
}
|
|
|
|
@@ -1457,6 +1463,8 @@ tp_init_palmdetect(struct tp_dispatch *tp,
|
|
tp->palm.left_edge = device->abs.absinfo_x->minimum + width * 0.05;
|
|
tp->palm.vert_center = device->abs.absinfo_y->minimum + height/2;
|
|
|
|
+ tp->palm.monitor_trackpoint = true;
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
|
|
index dcf6319..6462dda 100644
|
|
--- a/src/evdev-mt-touchpad.h
|
|
+++ b/src/evdev-mt-touchpad.h
|
|
@@ -281,6 +281,7 @@ struct tp_dispatch {
|
|
struct libinput_event_listener trackpoint_listener;
|
|
struct libinput_timer trackpoint_timer;
|
|
uint64_t trackpoint_last_event_time;
|
|
+ bool monitor_trackpoint;
|
|
} palm;
|
|
|
|
struct {
|
|
--
|
|
2.4.3
|
|
|