Skip to content

Fix accumulated drift when dragging window title bars - #8775

Open
yay wants to merge 3 commits into
emilk:mainfrom
yay:codex/fix-title-bar-drag-drift
Open

yay wants to merge 3 commits into
emilk:mainfrom
yay:codex/fix-title-bar-drag-drift

Conversation

@yay

@yay yay commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Notice the slow cursor drift:

Screen.Recording.2026-10-26.at.9.09.52.AM.mov

Dragging a window by its title bar accumulates rounding error: each frame adds the pointer delta to an already rounded position. Repeated half-pixel back-and-forth movements can move the window even when the pointer returns to the same position.

Retain the initial window pivot and add the total drag displacement, then apply the existing constraints and pixel rounding. Preserve the anchor while the drag is held, including when PointerGone temporarily removes coordinates; clear it when the gesture ends. The small Area change also prevents drag-anywhere from jumping to its starting point when displacement is unavailable.

#7709 fixed this class of drift in Area using a fixed drag origin. The separate title-bar path introduced by #8183 used incremental deltas again. The regression tests protect that guarantee across title-bar, default, and drag-anywhere modes, five pixel scales, and layout retries. They also cover repeated gestures, returning from constraints, pointer exit/re-entry, and release outside the viewport. The fractional-motion and constraint-return tests fail without the fix.

This PR also fixes #4441.

  • I have followed the instructions in the PR template

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Preview available at https://egui-pr-preview.github.io/pr/8775-codexfix-title-bar-drag-drift
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@yay
yay marked this pull request as ready for review October 26, 2026 10:07
@yay
yay marked this pull request as draft October 26, 2026 10:37
@yay
yay force-pushed the codex/fix-title-bar-drag-drift branch from 3a3e5c8 to c0ebfb1 Compare October 26, 2026 10:43
@yay
yay marked this pull request as ready for review October 26, 2026 10:52

This branch has not been deployed

No deployments
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.

Dragging windows allows cursor to become detached from original location

1 participant