Fix windows overlapping across monitors#364
Conversation
…ames to monitor bounds Prevents tiled window frames from bleeding across monitor boundaries by clamping rendered frames to the owning monitor's frame rect after layout calculation. Hidden windows (already in hiddenPool) are excluded from clamping since their positioning is handled separately. Fixes BarutSRB#349 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughWindow layout calculation in ChangesWindow Bounds Clamping
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/OmniWM/Core/Layout/Niri/NiriLayoutEngine`+Animation.swift:
- Around line 470-476: The current for-in loop over framePool mutates framePool
(removing/updating entries) which is unsafe; instead, iterate framePool without
mutating it by collecting changes first: create a removal list (e.g.,
removeTokens) and an updates dictionary (e.g., updatedFrames), loop over
framePool where hiddenPool[token] == nil computing clamped, append token to
removeTokens if clamped.isNull, or record updatedFrames[token] = clamped if
clamped != frame, then after the loop apply removals
(framePool.removeValue(forKey:)) and updates (framePool[token] = clamped) to
framePool. Ensure you reference the same symbols: framePool, hiddenPool,
monitorBounds, token, frame, clamped, and perform all mutations only after the
iteration completes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d55519b1-da37-4bad-ac22-bdbfadf09a3a
📒 Files selected for processing (1)
Sources/OmniWM/Core/Layout/Niri/NiriLayoutEngine+Animation.swift
…l dictionary during iteration Use two-pass approach: collect removals and updates first, then apply them after iteration completes. Swift dictionaries don't support safe mutation during for-in traversal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
CodeRabbit's inline feedback on the unsafe dictionary mutation during iteration has been addressed in commit c489737 with the two-phase collect-then-apply approach. The follow-up review confirms no remaining actionable issues. LGTM — ready for maintainer review. |
Summary
calculateCombinedLayoutUsingPools()hiddenPool) are excluded from clamping since their positioning is handled separately byHiddenWindowPlacementResolverDetails
The Niri layout engine's
calculateLayoutInto()produces window frames based on container positions and scroll offsets without enforcing monitor boundary constraints. When a visible container partially extends beyond the monitor's frame rect, individual window frames within it can bleed into neighboring monitor space.The fix adds a post-layout clamping pass that intersects each visible window's frame with
monitor.frame, removing frames that fall entirely outside the monitor bounds.Test plan
centeredColumnsDoNotEmit*WorkspaceFramesAcross*MonitorBoundarytests continue to passFixes #349
🤖 Generated with Claude Code
Summary by CodeRabbit