auto-hide cursor on idle and start (window) #732
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!732
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/732/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@anatoliikuc on GitHub · 2026-09-20 14:18 UTC · original
anatoliikuc:fix/cursor-auto-hide-282→main· +80 −6 · 3 files · 2 commits · closed without mergingHides the mouse cursor over the game window when the game starts, and brings it back the moment you move the mouse. If it sits still for a couple seconds it hides itself again. Should help with games that draw their own cursor (e.g. Blue Prince), where the OS cursor just gets in the way.
Fixes #282
@coderabbitai[bot] on GitHub · 2026-09-20 14:24 UTC · original · edited 2026-09-20 14:28 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
a7cfa2d4-ee0e-462b-9cfe-c6e2314d2f5c📥 Commits
Reviewing files that changed from the base of the PR and between
8867e0061candb6ecd8dc56.📒 Files selected for processing (1)
src/graphics/presentation/window/window.cpp🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
Walkthrough
HostInputWaitEventnow accepts an optional timeout. Negative values remain indefinite. Nonnegative values use timed waiting and returnfalsewhen no event arrives. Cursor restoration and auto-hide checks now use SDL monotonic time instead of the pausable game timer.Priority: ⬇️ Low
Change: Feature · Severity of issue fixed: Low
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
#282.window.cpphides the cursor at window startup, shows it on mouse movement, and hides it after mouse inactivity.SDL_GetTicks64()keeps the idl…#282. TheHostInputWaitEventtimeout changes support periodic cursor-idle checks. The monotonic timing change supports correct auto-hide behavior during pauses. No unrelate…Comment
@coderabbitai helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-09-20 14:24 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
039fc920-f5b9-4906-8dbd-f0e6d34fd5b7📥 Commits
Reviewing files that changed from the base of the PR and between
e930657bf6and8867e0061c.📒 Files selected for processing (3)
src/graphics/presentation/window/hostInput.cppsrc/graphics/presentation/window/hostInput.hsrc/graphics/presentation/window/window.cppIncluded review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@coderabbitai[bot] on GitHub · 2026-09-20 14:24 UTC · original · edited 2026-09-20 14:28 UTC
On
src/graphics/presentation/window/window.cppline 334 (outdated):🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5996
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 35704
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5758
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5888
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 3498
Use a non-pausing clock for cursor idle time.
Run()pausestimerwhile the game is paused, butHostInputWaitEvent()still performs timed waits and dispatches mouse motion.ProcessEvent()passes the pausedtimer.GetTimeS()value toCursorShow()andUpdateCursorAutoHide(). The cursor can therefore remain visible during the pause after mouse movement. Use a monotonic clock for both operations.Proposed fix
✅ Addressed in commit
b6ecd8d@ -812,3 +866,4 @@ProcessEvent(timer.GetTimeS());UpdateCursorAutoHide(CursorTimeS());}}@davidrohusch on GitHub · 2026-09-20 16:51 UTC · original
The whole mouse visibility function sounds more like an event to process.
Making the main loop more complex when it can be avoided is something I would preferably not do.
I subjectively think it would be more fit to extend
ProcessEvent()Any mouse motion could just invoke a
SDL_AddTimer(CURSOR_IDLE_HIDE_SECONDS * 1000, CursorHide() )+ CursorShow()@ -812,3 +866,4 @@ProcessEvent(timer.GetTimeS());UpdateCursorAutoHide(CursorTimeS());}}@davidrohusch on GitHub · 2026-09-20 16:59 UTC · original
Oh okay, nevermind. AddTimer is not desirable as it would spawn another thread, SDL prefers the graphic calls to be done within main thread. This would not work.
@Nmzik on GitHub · 2026-10-03 14:22 UTC · original
@anatoliikuc credited. Merged
Pull request closed