Skip to content

Improve macOS drag preview window smoothness and stabilize size/offset during tab drag#1063

Merged
wieslawsoltes merged 10 commits intowieslawsoltes:masterfrom
danwalmsley:fixes/jittery-drag-macos
Feb 26, 2026
Merged

Improve macOS drag preview window smoothness and stabilize size/offset during tab drag#1063
wieslawsoltes merged 10 commits intowieslawsoltes:masterfrom
danwalmsley:fixes/jittery-drag-macos

Conversation

@danwalmsley
Copy link
Copy Markdown
Contributor

Summary
This PR improves the drag preview behavior used when dragging document tabs out into a floating window, with a focus on macOS where the preview window was jittery and could resize/shift unexpectedly.

What changed
Coalesce drag preview window position updates on macOS using Dispatcher.UIThread.Post(..., DispatcherPriority.Render) instead of updating position on every pointer event.
Add stale callback/session guards so older scheduled move callbacks are ignored after newer ones are queued.
Skip no-op move posts when the target position/status is unchanged (or already pending unchanged).
Preserve preview pointer offset near monitor edges by removing the custom “fit inside working area” clamp.
Freeze drag preview window size once dragging is active (SizeToContent = Manual) to avoid resize jumps.
Maintain the frozen preview size across monitor/DPI changes by storing frozen dimensions in physical pixels and recalculating DIP sizes when RenderScaling changes.
Reduce unnecessary managed-overlay preview remeasure work by only remeasuring when preview status actually changes.
Why
On macOS, moving a transparent top-level preview window is more prone to jitter than on Windows. These changes reduce scheduler churn and visual corrections, and prevent preview resizing/offset changes during cross-window/cross-monitor drags.

Scope
DragPreviewHelper.cs (main implementation changes)
Validation
Built successfully with:
Dock.Avalonia.csproj -c Debug
Notes
This significantly improves smoothness, but a small amount of residual macOS jitter may remain due to native transparent window movement/compositor behavior. A future architectural step (overlay-based ghost within the app window) would likely improve this further.

@wieslawsoltes wieslawsoltes merged commit 8a2777b into wieslawsoltes:master Feb 26, 2026
9 checks passed
wieslawsoltes added a commit that referenced this pull request Feb 26, 2026
…macos"

This reverts commit 8a2777b, reversing
changes made to 7d5f58b.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants