Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterychuang/530d52ce0f9a079fc97f7a6964b92359 to your computer and use it in GitHub Desktop.
Save peterychuang/530d52ce0f9a079fc97f7a6964b92359 to your computer and use it in GitHub Desktop.
0002-Reduce-edge-exclusion-zone-for-Apple-touchpads.patc
From ff46248d082b7851ef74db385d115dd7d07bbb0b Mon Sep 17 00:00:00 2001
From: "Peter Y. Chuang" <peteryuchuang@gmail.com>
Date: Mon, 14 Aug 2017 08:53:42 +0200
Subject: [PATCH libinput 2/2] Reduce edge exclusion zone for Apple touchpads
---
src/evdev-mt-touchpad.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 80e74efd..ce6ac659 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -2456,18 +2456,30 @@ tp_init_palmdetect_edge(struct tp_dispatch *tp,
if (width < 70.0)
return;
- /* palm edges are 8% of the width on each side */
- mm.x = width * 0.08;
+ /* palm edges are 8% of the width on each side.
+ In case of Apple's touchpads, which has touch-size-based
+ palm detection, the edge is hard-coded at 3 mm. */
+ if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD)
+ mm.x = 3;
+ else
+ mm.x = width * 0.08;
edges = evdev_device_mm_to_units(device, &mm);
tp->palm.left_edge = edges.x;
- mm.x = width * 0.92;
+ if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD)
+ mm.x = width -3;
+ else
+ mm.x = width * 0.92;
edges = evdev_device_mm_to_units(device, &mm);
tp->palm.right_edge = edges.x;
if (!tp->buttons.has_topbuttons) {
- /* top edge is 5% of the height */
- mm.y = height * 0.05;
+ /* top edge is 5% of the height, except in the case of
+ Apple touchpads. */
+ if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD)
+ mm.y = 3;
+ else
+ mm.y = height * 0.05;
edges = evdev_device_mm_to_units(device, &mm);
tp->palm.upper_edge = edges.y;
}
--
2.14.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment