Reintroduce screen-edge clamping for popup window#1364
Open
gabrielMalonso wants to merge 1 commit into
Open
Conversation
The clamping logic from PR p0deje#709 was lost during the popup system rewrite in July 2024. This restores and improves it, ensuring the popup window stays fully within the visible screen area. Changes: - Add clamp() to PopupPosition that constrains origin to screen bounds - Apply clamping to all 5 positioning modes (cursor, center, window, statusItem, lastPosition) - Replace partial right-edge guard in statusItem with full 4-edge clamp - Use visibleFrame instead of frame for statusItem (excludes Dock) - Detect correct screen for window mode in multi-monitor setups - Add left-edge check missing from original PR p0deje#709 - Add unit tests for clamp function Fixes the issue where opening Maccy near screen edges (especially the bottom) causes the popup to extend beyond the visible area. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
The clamping logic introduced in #709 was lost during the popup system rewrite in July 2024 (commits
43f1ccfandcf6edca). This PR restores and improves it.clamp()function toPopupPositionthat constrains the popup origin to the screen'svisibleFrame, applied to all 5 positioning modesposas top-left.windowmode detects the correct screen in multi-monitor setups.statusItemnow usesvisibleFrameinstead offrame(respects Dock placement).statusItemwith full 4-edge clampingclamp()functionTest plan
PopupPositionTests— 9 tests covering all edges, corners, multi-monitor, boundary conditions, and oversized popups).statusItemnear right edge of menu bar — no overflow🤖 Generated with Claude Code