Skip to content

fix(mac): hide cursor during keyboard and controller gameplay - #584

Closed
dmuiX wants to merge 1 commit into
seedds:mainfrom
dmuiX:feat/mac-cursor-autohide
Closed

dmuiX wants to merge 1 commit into
seedds:mainfrom
dmuiX:feat/mac-cursor-autohide

Conversation

@dmuiX

@dmuiX dmuiX commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What and why

Hide the Mac pointer during keyboard/controller gameplay using AppKit's native setHiddenUntilMouseMoves: rather than a timer, cursor hide/unhide counter or new setting.

gameplay keyboard press / controller button or stick > 0.15
  -> game window key + app active + pointer inside content
     -> hide until the mouse moves
focus lost -> restore pointer

The cursor currently stays over the picture while playing. The change is confined to dm/host/front_mac.m; title-bar input, mouse/touch and other apps are excluded. Unknown keyboard keys, releases and neutral/small stick values do not initiate hiding. Moving the mouse restores visibility through AppKit.

Independent of #573: this branch targets current main (beea17c) directly and contains none of the Pikachu profile/BLE changes. A local app containing both changes was packaged separately; its save checksum was unchanged. No additional app replacement is part of this PR.

Checked

  • Red/green regression: test_mac_cursor.py compiles the real push/keyboard/cursor implementation with Foundation and windowless AppKit doubles. Upstream fails the recognized-key assertion; the candidate passes. Cases: headless/no window, non-key window, inactive app, pointer outside content, valid gameplay presses, releases, unknown keys, WASD and suspended input. It does not create or activate a UI window.
  • All five jobs from .github/workflows/tests.yml were executed locally on the cursor-only branch: host/CPU graphics tests, ASan/UBSan/TSan, all 83 tool-test files, Mac-host builds for Wonder/Hades/Digimon plus all gfx target builds and iOS source compile, and the synthetic unsigned iOS app build. All completed successfully. Local environment: M1 Pro, macOS 27.2, Xcode 27.1, Python 3.15.2 (GitHub uses 3.14).
  • The first plain host run failed the unchanged audio suspend/resume event-count assertion while the user had a game open. After the game closed the complete host suite passed. The audio implementation/test is untouched; contention is plausible but was not proven as the cause. Initial failure and successful rerun logs remain local.
  • regress.py impact origin/main..HEAD: 3 manifest-covered games affected, Hades broad, 94 profiles unknown. The Mac frontend is shared, so this is not a per-game behavior claim. Game frame/screenshot regressions are not an effective test for native cursor visibility, especially in headless mode; no full cross-game runtime regression is claimed.
  • Native cursor rendering, restoration on actual mouse movement, controller hardware and fullscreen transitions still require interactive verification. This PR is draft until that is checked. The code compiles in the Mac host; the test doubles establish dispatch/guard behavior, not physical AppKit cursor output.
  • No game files, saves, keys or dumps are included. Shader tools and chain are unchanged.

Docs

  • Mac pointer behavior documented in docs/playing.md.
  • Symptom/cause/fix/checks in docs/reference/services.md; docs_symptoms.py regenerated the index.
  • No game data or keys in this change.
  • No shader-chain tool changed; no chain regeneration is needed.

Use AppKit cursor hiding only for the active game content and restore it on focus loss. Add a windowless native regression test for keyboard dispatch, focus and content bounds; controller hardware and cursor rendering remain interactive checks.
@dmuiX
dmuiX marked this pull request as ready for review October 28, 2026 23:22
@hladik-dan hladik-dan mentioned this pull request Oct 29, 2026
seedds added a commit that referenced this pull request Nov 1, 2026
…ves (#584, fixes #675)

A key the game takes, a controller button or a stick past 15% (GameController
and raw HID pads) asks AppKit to hide the pointer, setHiddenUntilMouseMoves,
while the game window is key, the app is active and the pointer is over the
content view. Moving the mouse shows it again; losing focus shows it too.
No timer and no setting: this supersedes #755 and #839.

Co-authored-by: Daniel Ullrich <[email protected]>
@seedds

seedds commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thank you! Landed in c1df4dd (you are credited as co-author). Changes on the way in: rebased onto current main, and the hide now also covers raw HID gamepads (#669) through one shared pad_set helper for both controller readers. test_mac_cursor.py was dropped: it compiles a text slice of front_mac.m against AppKit doubles, which breaks on unrelated edits and cannot check the on-screen behaviour. The reference entry is now "Mac pointer stays over the game" in docs/reference/services.md, marked general.

@seedds seedds closed this Nov 1, 2026
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…ves (seedds#584, fixes seedds#675)

A key the game takes, a controller button or a stick past 15% (GameController
and raw HID pads) asks AppKit to hide the pointer, setHiddenUntilMouseMoves,
while the game window is key, the app is active and the pointer is over the
content view. Moving the mouse shows it again; losing focus shows it too.
No timer and no setting: this supersedes seedds#755 and seedds#839.

Co-authored-by: Daniel Ullrich <[email protected]>
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