Improve macOS drag preview window smoothness and stabilize size/offset during tab drag#1063
Merged
wieslawsoltes merged 10 commits intowieslawsoltes:masterfrom Feb 26, 2026
Merged
Conversation
This was referenced Mar 6, 2026
Closed
This was referenced Mar 16, 2026
Closed
This was referenced Mar 16, 2026
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
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.