[codex] Fix mouse tick resume after ruler drag#182
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression where mouse tick updates could remain suspended after dragging a borderless ruler window, because AppKit’s borderless-window drag loop can prevent the controller from receiving a normal mouseUp. The change ensures the “drag finished” path is explicitly invoked once the drag loop returns, and adds regression tests covering tick resumption (including the paired/other ruler).
Changes:
- Extract drag completion into
RulerController.finishMouseDrag(with:)and call it frommouseUp. - In
RulerWindow.mouseDown(with:), aftersuper.mouseDown(with:)returns, detect that the left mouse button is no longer pressed and explicitly finish the drag. - Add regression tests verifying mouse ticks resume after drag-loop completion and don’t resume during grouped-child move notifications while the mouse is still down.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| FreeRulerTests/RulerCoreTests.swift | Adds regression coverage for tick resumption after drag-loop completion and for grouped-move behavior during an active drag. |
| Free Ruler/RulerWindow.swift | Ensures the drag-completion path is triggered after AppKit’s borderless drag loop returns and the mouse button is up. |
| Free Ruler/RulerController.swift | Centralizes drag completion in finishMouseDrag(with:), adjusts move-resume gating to account for left-button-down state, and simplifies tick enabling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Fixes #181 by making ruler window drags explicitly finish the mouse tick suspension path when AppKit's borderless-window drag loop returns.
Root Cause
PR #176 suppresses mouse ticks while a ruler is being dragged and expects the normal mouse-up responder path to resume them. For borderless movable panels,
super.mouseDown(with:)can own the drag loop, so the controller may not receive a normalmouseUpafter the drag. That leaves the controller in its dragging state and keeps tick resume behavior stuck until another click.Changes
RulerController.finishMouseDrag(with:).RulerWindow.mouseDown(with:)call that completion path once AppKit's drag loop returns and the left mouse button is no longer pressed.Validation
xcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" -only-testing:FreeRulerTests/RulerCoreTests testxcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" test