fix: cursor jumps to center of main display on multi-monitor macOS - #206
Open
BH3GEI wants to merge 1 commit into
Open
fix: cursor jumps to center of main display on multi-monitor macOS#206BH3GEI wants to merge 1 commit into
BH3GEI wants to merge 1 commit into
Conversation
When switching back to the primary (macOS) screen, the cursor would jump to the center of the main display instead of appearing at the correct edge position. This was caused by a race condition in PrimaryClient::enter(): warpCursor() was called before enter(), so the warp-generated mouse event was processed while m_isOnScreen was still false, causing onMouseMove() to re-center the cursor. Fix: call enter() before warpCursor() so m_isOnScreen is true when the warp event arrives.
Member
|
Thanks for the PR, I will review. Is this relevant to upstream Deskflow? |
Contributor
|
It would as we are using the same logic here imho this should move to Deskflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a multi-monitor macOS setup (e.g. 3 screens), when switching back from a secondary machine to the primary (server) screen, the cursor sometimes jumps to the center of the main display instead of appearing at the correct position on the edge screen.
Root cause: In
PrimaryClient::enter(),warpCursor(xAbs, yAbs)was called beforem_screen->enter(mask). The warp generates a mouse-move event that is processed byOSXScreen::onMouseMove()whilem_isOnScreenis stillfalse, causing the cursor to be re-warped tom_xCenter/m_yCenter(center of the main display).Fix: Swap the call order — call
enter()first (which setsm_isOnScreen = true), thenwarpCursor(). This ensures the warp-generated mouse event is handled as a normal on-screen motion rather than triggering the off-screen re-centering logic.Test plan