fix(macos): warp cursor to center on leave to fix first-move jump

When macOS is the primary screen, hotkey switching to a secondary screen can leave the local cursor baseline away from the hidden-cursor center. The first physical mouse movement is then interpreted as a large secondary-screen delta.

Align macOS primary leave behavior with the Windows and X11 implementations by logging and warping the cursor to the primary-screen center before marking the screen off screen. OSXScreen::warpCursor also updates m_xCursor and m_yCursor, so the next motion delta starts from the expected center baseline.

Impact is limited to macOS primary/server leave handling; macOS secondary/client leave behavior and non-macOS builds are unchanged.
This commit is contained in:
Momoyama 2026-05-25 03:33:25 +08:00 committed by Nick Bolton
parent e07cfcc995
commit e8a474ba7d

View file

@ -798,6 +798,8 @@ void OSXScreen::leave()
if (m_isPrimary) {
avoidHesitatingCursor();
LOG_VERBOSE("centering cursor on leave: %+d, %+d", m_xCenter, m_yCenter);
warpCursor(m_xCenter, m_yCenter);
}
// now off screen