Skip to content

egui-winit: Don't repaint when the window is moved - #8947

Open
thainduy wants to merge 2 commits into
emilk:mainfrom
thainduy:egui-winit-no-repaint-on-moved
Open

thainduy wants to merge 2 commits into
emilk:mainfrom
thainduy:egui-winit-no-repaint-on-moved

Conversation

@thainduy

@thainduy thainduy commented Nov 25, 2026 •

Copy link
Copy Markdown

WindowEvent::Moved no longer requests a repaint. Moving a window needs no new frame: the compositor shows the last frame at the new position. Today every Moved (one per step of a title-bar drag on Windows, X11 and macOS; Wayland sends none) draws and presents a full frame.

On one machine (Windows 11, RTX 4070 Ti SUPER, DX12, 144 Hz), dragging the window drew 144 frames per second before and 0 after, and the window trailed the cursor less (mean 2.2 px → 0.6 px). Repro and numbers are in the issue.

Unchanged: Resized, ScaleFactorChanged, RedrawRequested, Focused and Occluded still repaint, so DPI changes, top/left resizes on macOS and exposed content still get a frame. Window position saved on exit reads outer_position() directly.

Visible effect: ViewportInfo::outer_rect and monitor_size now update on the next frame (the next input) instead of during the drag, so a UI that shows the window position, or a child viewport placed relative to it, stays put until then. Apps that need it can call request_repaint.

Tested on Windows only; not on macOS or Linux.

🤖 Generated with Claude Code

thainduy and others added 2 commits November 25, 2026 22:09
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Preview is being built...

Preview will be available at https://egui-pr-preview.github.io/pr/8947-egui-winit-no-repaint-on-moved

View snapshot changes at kitdiff

@thainduy
thainduy marked this pull request as ready for review November 25, 2026 15:18

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.

egui-winit: a full frame is drawn for every WindowEvent::Moved (window drag draws a frame per step)

1 participant