fix(hook): normalize Windows cursor position to DIP scale - #1246
Open
fly530 wants to merge 1 commit into
Open
Conversation
GetCursorPos reports physical pixels, but the overlay matches it against GPUI's own display bounds, which are logical (DIP) pixels on Windows. At 100% scaling the two happen to coincide, but at any other scale factor the mismatch pushes the Actions Ring off the cursor. cursor_position() now resolves the cursor's monitor via MonitorFromPoint and divides by its GetDpiForMonitor scale factor before returning, matching the resolution-independent points macOS and Linux already report. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018w4EfPAZ6Xus9sGMS3V87K
Greptile SummaryThis PR converts Windows cursor coordinates from physical pixels to display-independent coordinates using the effective DPI of the cursor’s monitor.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified. The changed Windows path validates cursor and DPI API results, preserves a safe 96-DPI fallback, and returns coordinates in the logical space documented for existing overlay consumers.
|
| Filename | Overview |
|---|---|
| crates/openlogi-hook/src/windows.rs | Normalizes Windows cursor coordinates using the containing monitor’s effective DPI, with validation and a 96-DPI fallback; no concrete changed-code failure was established. |
| crates/openlogi-hook/src/lib.rs | Clarifies that cursor positions use the logical coordinate space expected by GPUI consumers. |
| crates/openlogi-hook/Cargo.toml | Enables the windows-sys GDI and HiDPI features required by the new monitor DPI calls. |
Reviews (1): Last reviewed commit: "fix(hook): normalize Windows cursor posi..." | Re-trigger Greptile
davidbudnick
approved these changes
Sep 3, 2026
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
Actions Ring overlay drifted away from the cursor on Windows displays scaled above 100% (e.g. 150%), while it stayed centered at 100%.
Changes
openlogi-hook:cursor_position()on Windows resolves the cursor's monitor viaMonitorFromPointand divides the rawGetCursorPosphysical-pixel result by that monitor'sGetDpiForMonitorscale factor, returning DIP coordinates that match GPUI's own (already logical) display bounds — the same resolution-independent space macOS/Linux already report.Testing
cargo check -p openlogi-hookcargo clippy -p openlogi-hook --all-targets -- -D warningscargo test -p openlogi-hook(20 passed)cargo fmt --all -- --checkopenlogi-desktop/openlogi-agent/openlogi-overlayin release and confirmed the Actions Ring stays centered on the cursor at 150% Windows display scaling.