fix(v3/darwin): add effectiveZoomButtonState to resolve NSWindowZoomButton conflict#5457
fix(v3/darwin): add effectiveZoomButtonState to resolve NSWindowZoomButton conflict#5457taliesin-ai wants to merge 1 commit into
Conversation
…nState+FullscreenButtonState conflict Both MaximiseButtonState and FullscreenButtonState target NSWindowZoomButton on macOS. Without reconciliation, whichever setter runs last wins — breaking the intended precedence when both options are set. This commit adds effectiveZoomButtonState(a, b ButtonState) ButtonState which returns the more restrictive value (Hidden > Disabled > Enabled). Both setMaximiseButtonState and setFullscreenButtonState now call it before writing to NSWindowZoomButton, making the two setters order-independent at runtime. The startup path in run() is simplified: the FullscreenButtonState guard (if options.FullscreenButtonState != ButtonEnabled) is removed since the setters now handle reconciliation internally. TestEffectiveZoomButtonState added (13 subtests covering all ButtonState combinations plus commutativity). Addresses the three unresolved Copilot review threads on PR wailsapp#5319. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR fixes macOS window button state handling by introducing an ChangesmacOS Zoom Button State Reconciliation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
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)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" 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 |
|
@copilot resolve the merge conflicts in this pull request |
|
Superseded by #5467 (merged 2026-05-16), which landed the same |
Problem
MaximiseButtonStateandFullscreenButtonStateboth targetNSWindowZoomButtonon macOS. The current implementation has a last-writer-wins bug: whichever setter runs last overwrites the other, and the startup guard (if options.FullscreenButtonState != ButtonEnabled) means a runtimeSetMaximiseButtonStatecall can silently undo an earlierFullscreenButtonState: ButtonHiddensetting.This was flagged by the Copilot reviewer in PR #5319 (three unresolved threads).
Fix
Add
effectiveZoomButtonState(a, b ButtonState) ButtonState— returnsmax(a, b)using the integer orderingEnabled(0) < Disabled(1) < Hidden(2). BothsetMaximiseButtonStateandsetFullscreenButtonStatenow call it before writing toNSWindowZoomButton, making the two setters order-independent at both startup and runtime.The startup guard
if options.FullscreenButtonState != ButtonEnabledis removed; reconciliation now happens inside each setter.Verification
go vet ./v3/pkg/application/...— cleanTestEffectiveZoomButtonState— 13/13 PASS (all ButtonState combos + commutativity)Closes #5319
Closes #5455
Summary by CodeRabbit
Bug Fixes
Tests