Skip to content

fix(app): drag the splash by hand to avoid the hitch on release - #251

Merged
coldhighsun merged 2 commits into
mainfrom
fix/splash-drag-release-hitch
Oct 12, 2026
Merged

coldhighsun merged 2 commits into
mainfrom
fix/splash-drag-release-hitch

Conversation

@coldhighsun

Copy link
Copy Markdown
Owner

Summary

  • Dragging the startup splash and releasing the mouse made it stutter. The splash used Window.DragMove, whose Win32 modal move loop is the suspected cause.
  • The splash is now dragged with mouse capture. SplashDragTracker (pure, device pixels) computes the position, and the window is moved with one SetWindowPos per mouse event.
  • A drag in progress is re-anchored from the real window bounds when the window changes DPI. A failed capture or bounds read does not leave the mouse captured, and only the window's own LostMouseCapture ends the drag.
  • Shared user32 declarations (POINT/RECT, GetCursorPos, GetWindowRect, SetWindowPos, SWP_* flags) move into Infrastructure/WindowNativeMethods; WindowMaximizeHelper now uses its structs. CLAUDE.md is updated for both.

Not verified

  • The cause of the hitch is a hypothesis; it has not been measured, so the fix needs a manual check on a real run.
  • The new SplashDragTrackerTests were not compiled or run (NuGet restore of the test project failed locally). The app project builds with --no-restore.
  • Dragging across monitors with different DPI and main-window maximize (touched by the WindowMaximizeHelper refactor) were not exercised.

Test plan

  • dotnet test tests/ManagedDrive.Tests --filter "FullyQualifiedName~SplashDragTracker"
  • Start with several auto-mount disks, drag the splash and release: no stutter, animations keep running
  • Drag the splash to a monitor with a different DPI: it stays under the cursor
  • Maximize and restore the main window

Move the POINT/RECT structs used by WindowMaximizeHelper into a shared internal WindowNativeMethods class and add GetCursorPos, GetWindowRect, SetWindowPos and named SWP_* flags for other window code.
Window.DragMove runs the Win32 modal move loop, and the splash stuttered when the mouse button was released. Drag it with mouse capture instead: SplashDragTracker (pure, device pixels) computes the position and the window is moved with a single SetWindowPos per mouse event. A drag is re-anchored from the real window bounds when the window changes DPI, and a failed capture or bounds read does not leave the capture held.
@coldhighsun
coldhighsun merged commit c5a0585 into main Oct 12, 2026
5 checks passed
@coldhighsun
coldhighsun deleted the fix/splash-drag-release-hitch branch October 12, 2026 01:42
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 21.27660% with 37 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ManagedDrive.App/Views/SplashWindow.xaml.cs 0.00% 37 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant