Repository navigation
native/macos: don't shift the mouse y by one pixel - #707
Open
nivaldomcj wants to merge 1 commit into
Open
nivaldomcj wants to merge 1 commit into
nivaldomcj wants to merge 1 commit into
Conversation
locationInWindow is continuous with the origin at the bottom-left, so flipping it to a top-left origin is height - y. The extra - 1 made every mouse position read one backing pixel too high. X11 and Windows report the position unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
transform_mouse_pointturns Cocoa's bottom-left mouse position into a top-left one withscreen_height - y * dpi_scale - 1.locationInWindowis a continuous position (100.25, say), not a row index, so the flip isscreen_height - y * dpi_scale, and the extra- 1makes every mouse position read one physical pixel too high. On a 1x display that's a whole point. X11 and Windows pass the event position through unchanged.I checked it by sending the view a synthetic mouse-moved event at content position (50.5, 100.25) in points and printing what
mouse_motion_eventreceived:high_dpiTested on macOS 27.2.1 (26B131), Apple M3 Max (arm64), Rust 1.100.0.
x is unchanged.
cargo build --all-targetspasses for aarch64-apple-darwin and x86_64-apple-darwin, andcargo check --all-targetsfor aarch64-apple-ios and x86_64-apple-ios.The
- 1predates f46c5dd ("Redesign globals"), and I couldn't find a reason for it in the history. If it's there on purpose, I'm happy to close this.