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 <[email protected]>
---
 src/evdev-mt-touchpad.c | 12 +++++++++---
 src/evdev-mt-touchpad.h |  1 +
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 538c2d7..5b53862 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) {
@@ -1109,9 +1112,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 &&
@@ -1455,6 +1459,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 f3c2bf7..2466dab 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -283,6 +283,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

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to