Fix cursor overlay invisible on secondary monitors#48
Open
Catafal wants to merge 1 commit intofarzaa:mainfrom
Open
Fix cursor overlay invisible on secondary monitors#48Catafal wants to merge 1 commit intofarzaa:mainfrom
Catafal wants to merge 1 commit intofarzaa:mainfrom
Conversation
NSView.frame uses window-local coordinates, not global screen coordinates.
For secondary monitors with non-zero origins (e.g. {1920,0}), setting
hostingView.frame = screen.frame displaced the SwiftUI content 1920pt
outside the window bounds, making the overlay invisible.
The window itself is correctly positioned via NSPanel.setFrame(screen.frame)
in OverlayWindow.init. Only the content view frame needs fixing.
Fixes farzaa#24
Co-Authored-By: Claude Sonnet 4.6 <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.
Feature
Fix multi-monitor cursor overlay rendering (resolves #24)
Summary
NSHostingView.frameuses window-local coordinates (always origin 0,0), but was being assignedscreen.framewhich has a non-zero origin for secondary monitors (e.g.{x:1920, y:0})Changes
leanring-buddy/OverlayWindow.swift— one line inOverlayWindowManager.showOverlay():The
NSPanelwindow itself is already positioned correctly atscreen.frame.originviaOverlayWindow.init— only the content view frame needed fixing.Why only the primary monitor worked before
Primary monitor has
screen.frame.origin = (0,0), soscreen.frameaccidentally produced the correct window-local rect. Every secondary monitor has a non-zero origin and was broken.Testing
[POINT:x,y:label:screen2], THEN cursor animates to correct position on secondary display ✓Review Notes
All downstream coordinate math (
convertScreenPointToSwiftUICoordinates,isCursorOnThisScreen,startNavigatingToElement) was already correct and required no changes. Verified by tracing the full coordinate pipeline across 3 independent passes.Closes #24