Skip to content

Fix macOS mouselook freeze on window switch + hot-path optimizations#179

Open
deliro wants to merge 2 commits into
djsmithdev:masterfrom
deliro:fix/macos-mouselook-freeze
Open

Fix macOS mouselook freeze on window switch + hot-path optimizations#179
deliro wants to merge 2 commits into
djsmithdev:masterfrom
deliro:fix/macos-mouselook-freeze

Conversation

@deliro

@deliro deliro commented Jun 22, 2026

Copy link
Copy Markdown

Fix — macOS stuck cursor after switching windows

A MouselookStop() issued while the window is backgrounded (e.g. bags/LFG auto-unlock Mouse Look during an alt-tab) leaves the OS mouse capture stuck: on return the cursor/camera are frozen while IsMouselooking() no longer reflects reality. There is no focus event to hook.

  • Auto-recovery (CM.ResyncMouselookOnFocusRegain): when frames halt while backgrounded (fullscreen), the gap between OnUpdate frames signals the regain → force a clean mouselook re-grab.
  • Manual recovery (Combat Mode - Reset Mouse Look keybind): when the window keeps rendering while backgrounded (windowed background FPS), the freeze can't be detected from OnUpdate, so a keybind re-grabs + releases capture on demand.

Optimizations (throttled OnUpdate hot path)

  • Custom condition: cache the loadstring compile instead of recompiling every tick — the default empty string was being compiled ~7×/sec for every user.
  • IsUnlockFrameVisible: check GetUIPanel first to short-circuit the ~170-frame visibility scan in the common case; ipairs instead of pairs.

🤖 Generated with Claude Code

@deliro deliro force-pushed the fix/macos-mouselook-freeze branch 3 times, most recently from 289da79 to 110b91a Compare June 22, 2026 22:30
@deliro deliro force-pushed the fix/macos-mouselook-freeze branch from 110b91a to 8e92ad4 Compare June 22, 2026 22:34
@sampconrad

Copy link
Copy Markdown
Collaborator

Thanks for the work on this, @deliro! I had no idea about the macOS issue.

I'm not currently subscribed to the game, so I can't really test the proposed changes. The next time Blizzard breaks something that requires me to update the addon, I'll merge this and include it in the next release.

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