Skip to content

Make the Surface Laptop Studio 2 touchpad nicer to use - #240

Open
jamers99 wants to merge 4 commits into
linux-surface:masterfrom
jamers99:master
Open

jamers99 wants to merge 4 commits into
linux-surface:masterfrom
jamers99:master

Conversation

@jamers99

@jamers99 jamers99 commented Dec 1, 2026

Copy link
Copy Markdown

Problem

On the Surface Laptop Studio 2 touchpad, lifting fingers can cause:

  • Taps: the end of a two-finger scroll sometimes turns into a left click.
  • Flicks: slowing down a scroll and then lifting often flicks the page.

I spent quite a bit of time tuning it getting Claude to fix it up, and TBH I didn't look at the code a lot. But I've been using it quite a bit locally and it's much nicer.

Cause

  • Taps: after a lift, a contact can come back for 1–2 frames, and libinput reads that as a tap. A lifting contact can also drop below SizeMin, get lifted as invalid, and be reported again as a new touch a frame later.
  • Flicks: as a finger lifts, its signal fades and its center moves 10–40 units, which shows up as a jump. On top of that, PositionThresholdMin (about 20 units per frame on this pad) drops slow movement, so apps never see the slowdown before the lift.

Changes

  • MinContactFrames ([Touchscreen], [Touchpad]): only report a contact after it has been seen this many frames in a row. A lifted contact has to wait again.
  • LiftThreshold ([Contacts]): while a contact's signal is dropping and below this fraction of its peak, it can slow down but not speed up or change direction. Uses the gaussian fit amplitude, now stored on each contact.
  • SLS2 preset: MinContactFrames = 3, LiftThreshold = 0.9, PositionThresholdMin = 0.01.

Both options are off by default. They could probably be on for all touchpads: MinContactFrames = 3 delays new touches by about 24 ms (a real tap is 50 ms or more), and LiftThreshold adds no delay. The defaults can be changed here if that's preferred.

Not included

  • Validator::check_contact treats unstable contacts as valid, which skips track_validity. Fixing that would cover the second tap case for everyone, but changes default behaviour.
  • BTN_TOOL_* could count only the slots actually sent to uinput.

Testing

On a Surface Laptop Studio 2 (045E:0C46):

  • Before: 9 of 30 recorded scrolls jumped just before lifting.
  • Replaying recorded data through LiftThreshold: contacts that sped up right before lifting went from 60 to 5 out of 123, and direction changes from 21 to 2.
  • In normal use the taps and flicks are gone, and fast flicks still work.

jamers99 and others added 4 commits November 30, 2026 23:07
When fingers lift off the touchpad, a ghost contact sometimes shows up
for one or two frames. libinput sees a very short touch and turns it
into a tap, so the end of a two-finger scroll sometimes clicks.

The same thing happens when a lifting contact shrinks below SizeMin.
It's lifted because it's invalid, then it's valid again in the next
frame and gets reported as a new touch.

With MinContactFrames, the daemon waits until a contact has been seen
for that many frames in a row before reporting it. A contact that was
lifted has to wait again. BTN_TOOL_* only counts reported contacts.
It's off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAFqWPtgujTmWED4uYFC1c
As a finger lifts off, its signal fades over a few frames and its center
moves. This shows up as a jump right before the lift. After a slow
scroll, apps with kinetic scrolling see that jump and flick the page.

Store the amplitude of the fitted gaussian on each contact. While a
contact's amplitude is dropping and below LiftThreshold times its peak,
it can slow down, but not speed up or change direction. It's off by
default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAFqWPtgujTmWED4uYFC1c
Turn on MinContactFrames and LiftThreshold for the SLS2 touchpad, and
lower PositionThresholdMin so slow movement isn't dropped. With the old
value, a scroll that slowed down before the fingers lifted never
reported the slowdown, so apps flicked based on the earlier speed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAFqWPtgujTmWED4uYFC1c
Make the Surface Laptop Studio 2 touchpad nicer to use
@jamers99

jamers99 commented Dec 4, 2026

Copy link
Copy Markdown
Author

@qzed is this something that could be merged in? Anything I should be doing to get it in?

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.

1 participant