Skip to content

Hardware input: per-game pointer lock for mouse-look from launch - #625

Open
alantangok wants to merge 1 commit into
willfaust:mainfrom
alantangok:feat/pointer-lock-on-start
Open

alantangok wants to merge 1 commit into
willfaust:mainfrom
alantangok:feat/pointer-lock-on-start

Conversation

@alantangok

Copy link
Copy Markdown
Contributor

First-person games need the pointer locked so the view keeps turning at the screen edges. Today the automatic lock waits for the game to hide its cursor, and the Relative toggle is global.

This adds a per-game switch: MADEIRA_POINTER_LOCK_ON_START=1 in a game's own config starts that game in relative mouse-look with automatic pointer lock, without needing a hidden-cursor report. It reuses the existing Relative-mode path (cursorShownForRoute and updateAutoLock), so focus loss, manual unlock (Ctrl+Alt+P) and the existing lock guards still apply. Default off; other games are unchanged.

  • HardwareInput.swift: lockOnStart, read per launch like MADEIRA_POINTER_HIDDEN_ABSOLUTE
  • docs/KEYBOARD_MOUSE.md: bullet and switch table row
  • ConfigCatalog.generated.swift: the generator's row for the new key
  • tests/host/check-pointer-capture.py: captures with the toggle off, stays captured while the game shows a cursor, releases on focus loss; unchanged behaviour without the switch

Checks: check-pointer-capture.py and check-hardware-input.py pass. Not tested on a device yet. I'll try it with Counter-Strike 1.6 (OpenGL) on an iPad Air 5 and report back.

First-person games on iPad need the pointer locked so the view keeps
turning at the screen edges. Automatic lock waits for the game to hide
its cursor, and the Relative toggle applies to every game. A game's own
MADEIRA_POINTER_LOCK_ON_START=1 now starts that game in relative
mouse-look with automatic pointer lock, without a hidden-cursor report.
Focus loss and manual unlock still release it. Default off.

Signed-off-by: alantangok <alantangok@gmail.com>
@alantangok

Copy link
Copy Markdown
Contributor Author

Tested on an iPad Air 5 (iPadOS 27.2) with a Magic Keyboard trackpad and Counter-Strike 1.6 in OpenGL (Zink), with env.MADEIRA_POINTER_LOCK_ON_START = 1 in the game's config.

  • The log shows pointer lock ON (relative pointer mode) path=gcmouse as soon as the mouse moves over the game view. The game was still showing its own cursor at that point.
  • The view now turns past the screen edges (full 360°).
  • One note: in an earlier run iPadOS did not grant the lock (requested=1 actual=0). An XCTest UI-automation runner was active on the device at the time. With it stopped, the lock was granted. That's a test-setup issue, not part of this change.

Marking ready for review.

@alantangok
alantangok marked this pull request as ready for review November 17, 2026 09:59
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