Repository navigation
winit: repaint the whole window after restoring it from minimized - #13566
bigtree108-dmytro wants to merge 1 commit into
Conversation
Windows and X11 discard what a minimized window had on screen. The buffer age a software surface reports counts it as still being there, so the first frame after the restore painted only the dirty region and the rest of the window stayed blank. Only the items that had animated in the meantime appeared. Mark the whole window dirty when it stops being minimized, the same way as after mapping it, and share that between the two. This is the trigger reported in slint-ui#13537 by a second party. The grow across screens of different scale factors in the first post of that issue is a different path and still open. ChangeLog: Software rendering with winit: a window restored from minimized is painted again instead of staying blank until something changes.
|
👋 Welcome, and thanks for your pull request! If you haven't yet, take a look at CONTRIBUTING.md. Before we can merge it, tick the box at the end of the description to confirm that you agree to the licensing described in CONTRIBUTING.md#license. You only do this once. If you can't agree, tell us in a comment instead. We're a small team and reviews can take a while. If you don't hear back, nudge us in our public chat. |
|
Is this still needed now that we have updated #13568 ? |
|
Thanks for asking, and sorry, I had X11 wrong. It isn't needed anywhere, so I'm closing it. On Windows, #13568 covers the restore: Windows invalidates the whole client area when the window comes back, and the update rectangle carries that. On X11 I've now measured it with the software renderer on Xvfb and openbox, with and without a compositor. After a restore or a map, winit reports For the wider picture: rust-windowing/winit#4719 proposes that winit report the invalidated area with each redraw, and rust-windowing/softbuffer#375 fixes softbuffer on Windows marking the whole window painted after copying only the damage. |
Windows and X11 drop what a minimized window had on screen. The buffer age a software surface reports counts it as still being there, so the first frame after the restore paints the dirty region alone and the rest of the window stays blank.
Reproduced on Windows 11 with the gallery example and no code of mine involved:
Minimize the window, restore it, and it comes back black apart from the slider and the spinner. Those two are the items that kept animating while it was minimized, which is to say they are the dirty region. It happens on every cycle.
The renderer log shows what reaches the screen. While the window is minimized it keeps rendering and presenting, so the buffer stays marked as presented:
After the restore the age is still 1, so the partial renderer paints those same two rectangles into a window that holds nothing.
This is the same cause as #13500, so it takes the same shape as 24df530: mark the whole window dirty when the window stops being minimized. The marking from the mapping path moves into a helper the two share.
Measured over four minimize and restore cycles on a 1500x1000 window, comparing the restored window against the frame before the minimize, every third pixel:
What remains after the fix is the spinner, which genuinely animates.
This is the trigger reported in #13537 by @iamdarkle. The grow across screens of different scale factors in the first post of that issue is a different path, it survives this change, and I am still on it.