Skip to content

fix: prevent crash on sidebar hover - #755

Closed
apollo880 wants to merge 1 commit into
manaflow-ai:mainfrom
apollo880:fix-750-sidebar-hover-crash
Closed

apollo880 wants to merge 1 commit into
manaflow-ai:mainfrom
apollo880:fix-750-sidebar-hover-crash

Conversation

@apollo880

@apollo880 apollo880 commented Mar 2, 2026 •

Copy link
Copy Markdown

Fixes #750

Summary

Implemented a targeted fix to prevent crashes when hovering the sidebar/titlebar top control cluster.

Root-cause hypothesis

WindowDragHandleView participated in hit-testing during passive hover/cursor events (mouseMoved, cursorUpdate, etc.). That code path performs complex top-hit/sibling hit-tests intended for drag capture, and it was being exercised on mere pointer motion over titlebar controls.

Changes

  • In WindowDragHandleView.DraggableView.hitTest(_:), added a gate to return nil for passive event types.
  • Kept existing drag-handle capture logic for click/drag events.

Co-authored-by: Codex noreply@openai.com
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced window titlebar responsiveness by optimizing event handling for mouse interactions, including movement and hover states.

Return nil in hitTest for passive event types to prevent WindowDragHandleView from participating in hit-testing during passive hover/cursor events.
@vercel

vercel Bot commented Mar 2, 2026

Copy link
Copy Markdown

@apollo880 is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d9587c and 2fbaf93.

📒 Files selected for processing (1)
  • Sources/WindowDragHandleView.swift

📝 Walkthrough

Walkthrough

Adds a guard condition to WindowDragHandleView's hit-testing logic that skips processing for passive/hover-related events such as mouseMoved, cursorUpdate, mouseEntered, mouseExited, and flagsChanged. A helper function shouldParticipateInHitTesting(for:) determines whether to proceed with hit-testing based on event type.

Changes

Cohort / File(s) Summary
Event Hit-Testing Guard
Sources/WindowDragHandleView.swift
Adds early-return guard in hitTest to skip passive/hover events (mouseMoved, cursorUpdate, mouseEntered, mouseExited, flagsChanged, appKitDefined, systemDefined, applicationDefined, periodic); introduces helper method shouldParticipateInHitTesting(for:) to evaluate event eligibility for hit-testing participation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A mouse moved across the sidebar's edge,
But now it glides without a pledge—
No hit-tests fired, no crashes feared,
The draggable view's bug is cleared!
Passive events know their place,
And stability wins the race. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: prevent crash on sidebar hover' directly addresses the primary change - fixing crashes when hovering the sidebar/titlebar by preventing passive events from participating in hit-testing.
Linked Issues check ✅ Passed The PR successfully implements the required fix for issue #750 by preventing crashes on sidebar hover through targeted hit-testing logic for passive event types.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the sidebar hover crash issue; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR implements a targeted fix to prevent crashes during sidebar/titlebar hover interactions. The root cause was that WindowDragHandleView.DraggableView.hitTest(_:) was executing complex drag-handle capture logic even for passive events like mouse movements and cursor updates.

Key changes:

  • Added shouldParticipateInHitTesting(for:) method to filter out passive event types
  • Modified hitTest(_:) to return nil early for passive events (mouseMoved, cursorUpdate, mouseEntered, mouseExited, etc.)
  • Preserved existing drag-handle capture behavior for click/drag interactions
  • Added debug logging for the new code path

The fix is minimal, well-reasoned, and directly addresses the crash without affecting drag functionality.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The fix is minimal (23 lines), well-targeted, and follows established AppKit patterns. It adds a simple guard condition that prevents crash-inducing code paths during passive events while preserving all drag functionality. The implementation uses standard NSEvent type checking and includes appropriate debug logging.
  • No files require special attention

Important Files Changed

Filename Overview
Sources/WindowDragHandleView.swift Added early return in hitTest(_:) for passive events (hover, cursor updates) to prevent unnecessary complex hit-testing logic that was causing crashes

Last reviewed commit: 2fbaf93

@teamleaderleo

Copy link
Copy Markdown
Collaborator

Thanks for this! The sidebar hover crash fix landed on main in #736, so main covers it now. Closing.

@github-project-automation github-project-automation Bot moved this from Todo to Done in cmux backlog Sep 26, 2026
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.

cmux shutdowns when move mouse pointer at sidebar top button group

2 participants