Skip to content

touch: preserve button state across contact lifts - #225

Open
fQwQf wants to merge 1 commit into
linux-surface:masterfrom
fQwQf:sl7-touchpad-buttons
Open

fQwQf wants to merge 1 commit into
linux-surface:masterfrom
fQwQf:sl7-touchpad-buttons

Conversation

@fQwQf

@fQwQf fQwQf commented Sep 29, 2026 •

Copy link
Copy Markdown

Lifting a tracked touchpad contact emits BTN_LEFT=0 even when button reports still indicate a press, interrupting a click-and-drag operation.

Leave button transitions to button reports, and explicitly release the button when disabling a touchpad.

Related: #208.

Validation:

  • ARM64 Meson build and formatting checks.
  • ASan/UBSan regression tests reproduce the premature release on upstream and pass with this change, covering held clicks, release reports, disable cleanup and touchscreen isolation.
  • Everyday dragging on a Snapdragon Surface Laptop 7 running the downstream haptic-report decoder.

@fQwQf
fQwQf force-pushed the sl7-touchpad-buttons branch from 5f607f7 to 2d3b675 Compare September 29, 2026 02:45
@fQwQf fQwQf changed the title touchpad: preserve button state during drags and decode haptic clicks touch: preserve button state across contact lifts Sep 29, 2026
Button reports and contact tracking have independent lifetimes. Lifting
the selected contact currently emits BTN_LEFT=0 even if button reports
still indicate a press, interrupting click-and-drag operations.

Leave button transitions to button reports, and explicitly release the
button when disabling a touchpad to avoid retaining a held click.
This also applies to haptic touchpads whose clicks are pressure-driven.
@fQwQf
fQwQf force-pushed the sl7-touchpad-buttons branch from 2d3b675 to 991f4d1 Compare September 29, 2026 02:50
@fQwQf
fQwQf marked this pull request as ready for review September 29, 2026 02:52
@pathetic

pathetic commented Oct 5, 2026

Copy link
Copy Markdown

Tested this on a Surface Laptop Studio 2 (045E:0C46), Arch Linux, linux-surface 6.19.8, Hyprland. I built it as a package on top of v3.1.0.

It fixes #208 for me. Before the patch, holding the click in the bottom corner and dragging with a second finger was unreliable. An evdev capture of the iptsd virtual touchpad showed why. Whenever a contact lifted while the button was still physically held, iptsd emitted BTN_LEFT 0 and then BTN_LEFT 1 in the same frame:

66.057 finger up   slot0
66.057 BTN_LEFT 0
66.057 BTN_LEFT 1

libinput passes this through as a real release followed by a press about 8 ms later. Apps see the drag or selection end and a new one start. With this PR, the button state stays held across contact lifts, and click-drag works as expected.

Thanks for the fix!

Fixes #208

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants