Skip to content

fix(stream/input): lock the pointer with the OS pointer's travel - #85

Merged
enricobuehler merged 1 commit into
mainfrom
fix/plain-pointer-lock
Nov 19, 2026
Merged

enricobuehler merged 1 commit into
mainfrom
fix/plain-pointer-lock

Conversation

@enricobuehler

Copy link
Copy Markdown
Member

Capture mode locks the pointer plainly again, as it did up to 0.3.2. Raw counts stay in the engine behind rawMouse, off by default.

Problem

Since 0.3.3 the page asks for unadjustedMovement, which drops the client OS's pointer speed and acceleration. A player on a Mac with Chrome reports a captured mouse too slow to click with, on Linux and Windows hosts, and still on 0.5.0.

  • The fractional carry in 0.5.0 could not help there. Chromium on macOS reads the raw field as a whole number, so there is nothing to carry. It matters in Safari, which reads a fraction.
  • The capture itself is exact. On one Mac (wired mouse, 12,543 events) the raw field was whole on every event and the whole-number read kept 100%.
  • The speed is what differs. The same Mac's pointer travels 1.98 points per count on average; another project measured 3.3 to 3.8 on theirs. A plain lock sends that travel, a raw lock sends the counts.
  • A Linux host moves the pointer one pixel per unit for a browser, with no speed setting in the path. A native client's counts reach a host mouse and take the host's pointer settings; the page does not send that mark yet.
  • Raw is not available everywhere either: Firefox has it on macOS only, and Safari on a Mac or with a mouse on iPadOS. Those fell back to the plain lock already.

Change

  • InputPipe.lock() asks for a plain lock unless rawMouse is set. With it, the old path: unadjustedMovement, and a plain lock on NotSupportedError.
  • TunableOptions.rawMouse (default false) reaches the pipe through configure, like invertScroll.

Not in this PR

A settings row. The label is a message in the monorepo and a player setting needs the maintainer's yes, so the web app has no switch for rawMouse yet.

Toward a Windows host with Enhance pointer precision on, a plain lock stacks two accelerations, as it did up to 0.3.2.

Checks

  • npm run check and npm test for @punktfunk/stream (140 pass) and punktfunk-web (19 pass), Node 24.
  • Not run on glass.

A raw pointer lock drops the client OS's pointer speed and acceleration.
On a Mac the same hand travel then moves the host pointer a fraction as
far, and the page has no control that makes it up: a captured mouse has
crawled for some players since 0.3.3.

The lock is plain again, as it was up to 0.3.2. The engine's `rawMouse`
keeps the mouse's own counts for a page that asks.
@enricobuehler
enricobuehler marked this pull request as ready for review November 19, 2026 15:53
@enricobuehler
enricobuehler merged commit f65243a into main Nov 19, 2026
8 checks passed
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