Skip to content

[codex] Fix mouse tick resume after ruler drag#182

Merged
pascalpp merged 2 commits into
mainfrom
codex/181-mouse-tick-resume
Jun 11, 2026
Merged

[codex] Fix mouse tick resume after ruler drag#182
pascalpp merged 2 commits into
mainfrom
codex/181-mouse-tick-resume

Conversation

@pascalpp

Copy link
Copy Markdown
Owner

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 normal mouseUp after the drag. That leaves the controller in its dragging state and keeps tick resume behavior stuck until another click.

Changes

  • Move ruler drag completion into RulerController.finishMouseDrag(with:).
  • Have RulerWindow.mouseDown(with:) call that completion path once AppKit's drag loop returns and the left mouse button is no longer pressed.
  • Add regression coverage that verifies both ruler ticks resume after the window-drag completion path.

Validation

  • xcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" -only-testing:FreeRulerTests/RulerCoreTests test
  • xcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" test

@pascalpp pascalpp marked this pull request as ready for review June 11, 2026 05:12
Copilot AI review requested due to automatic review settings June 11, 2026 05:12

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 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 from mouseUp.
  • In RulerWindow.mouseDown(with:), after super.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.

@pascalpp pascalpp merged commit 574b279 into main Jun 11, 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.

Regression in mouse tick resume after dragging

2 participants