Skip to content

Color picker fixes#190

Merged
pascalpp merged 9 commits into
mainfrom
pascal/186-color-well-fixes
Jun 12, 2026
Merged

Color picker fixes#190
pascalpp merged 9 commits into
mainfrom
pascal/186-color-well-fixes

Conversation

@pascalpp

Copy link
Copy Markdown
Owner

Summary

This fixes the ruler color picker lifecycle so the shared AppKit color panel is treated as a transient preferences companion instead of being restored on the next app launch.

Changes include:

  • configure the shared color panel as opaque and non-restorable
  • close/deactivate the color panel when preferences closes and during app termination
  • add UI coverage for hidden opacity controls, preferences-close behavior, and quit/relaunch behavior
  • update App Store screenshot assets after the preview layout/focus-ring adjustments

Validation

  • xcodebuild -project 'Free Ruler.xcodeproj' -scheme 'Free Ruler' clean build-for-testing
  • xcodebuild -project 'Free Ruler.xcodeproj' -scheme 'Free Ruler' test-without-building -only-testing:FreeRulerUITests/FreeRulerUITests/testClosingPreferencesClosesRulerColorPanel
  • xcodebuild -project 'Free Ruler.xcodeproj' -scheme 'Free Ruler' test-without-building -only-testing:FreeRulerUITests/FreeRulerUITests/testRulerColorPanelDoesNotReopenAfterRelaunch
  • xcodebuild -project 'Free Ruler.xcodeproj' -scheme 'Free Ruler' test-without-building -only-testing:FreeRulerUITests/FreeRulerUITests/testRulerColorPanelHidesOpacityControl

pascalpp added 2 commits June 12, 2026 09:29
Ensure the ruler color panel is closed and forced to opaque when preferences or the app quits, and add UI tests to verify behavior. Key changes:

- AppDelegate: added applicationShouldTerminate to close the color panel on quit and kept the close call in applicationWillTerminate.
- PreferencesController: refactored color panel configuration to use NSColorPanel.shared, set isRestorable = false, use NSColor.ignoresAlpha instead of Objective-C runtime hacks, and added configureOpaqueColorPickingAfterPanelUpdates which reapplies configuration on short delayed intervals to handle panel updates. RulerColorWell now orders the color panel front with orderFront and triggers the repeated reconfiguration. closeRulerColorPanel was made non-private and now calls colorPanel.close(). Also deactivate the ruler color well when the preferences window closes.
- Tests: added UI tests to assert the color panel hides opacity controls, that closing Preferences closes the ruler color panel, and that the panel does not reopen after relaunch. Helper accessors and wait utilities (waitForNonVisibility, waitForVisibleExistence, openRulerColorPanel) were added to the test suite.

These changes fix unreliable alpha control visibility and ensure the color panel doesn't persist unexpectedly across app lifecycle events.
@pascalpp pascalpp changed the title [codex] Close ruler color panel on preferences close and quit Color picker fixes Jun 12, 2026
@pascalpp pascalpp marked this pull request as ready for review June 12, 2026 13:42
Copilot AI review requested due to automatic review settings June 12, 2026 13:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the AppKit shared NSColorPanel behavior used by the ruler color picker so it behaves like a transient companion to Preferences (non-restorable, no alpha controls), and ensures it’s closed when Preferences closes and during app termination. It also adds UI test coverage for these lifecycle expectations and updates the App Store screenshot preview layout/focus behavior.

Changes:

  • Configure the shared NSColorPanel for opaque picking (no alpha, non-restorable) and close/deactivate it on Preferences close and app termination.
  • Add UI tests to cover hidden opacity controls, Preferences-close behavior, and quit/relaunch behavior for the color panel.
  • Update App Store screenshot preview layout calculations and tweak focus behavior to avoid unwanted focus styling in snapshots.

Reviewed changes

Copilot reviewed 4 out of 8 changed files in this pull request and generated 1 comment.

File Description
FreeRulerUITests/FreeRulerUITests.swift Adds UI tests and helpers to validate NSColorPanel opacity UI and lifecycle behavior across prefs close and relaunch.
Free Ruler/PreferencesController.swift Updates shared color panel configuration and lifecycle handling; ensures the panel is treated as transient and opaque.
Free Ruler/AppStoreScreenshotPreview.swift Adjusts screenshot layout math and snapshot window responder handling for updated preview visuals.
Free Ruler/AppDelegate.swift Closes the shared color panel during quit/termination to prevent unintended restoration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Free Ruler/PreferencesController.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 3 comments.

Comment thread Free Ruler/PreferencesController.swift
Comment thread FreeRulerUITests/FreeRulerUITests.swift Outdated
Comment thread FreeRulerUITests/FreeRulerUITests.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 1 comment.

Comment thread Free Ruler/PreferencesController.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 2 comments.

Comment thread FreeRulerUITests/FreeRulerUITests.swift
Comment thread FreeRulerUITests/FreeRulerUITests.swift

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 1 comment.

Comment thread FreeRulerUITests/FreeRulerUITests.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 2 comments.

Comment thread FreeRulerUITests/FreeRulerUITests.swift
Comment thread FreeRulerUITests/FreeRulerUITests.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 2 comments.

Comment thread FreeRulerUITests/FreeRulerUITests.swift Outdated
Comment thread Free Ruler/PreferencesController.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated no new comments.

@pascalpp pascalpp merged commit 646b84d into main Jun 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants