Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

Fix flickering when resizing the window #36

Closed
wants to merge 1 commit into from

Conversation

Diggsey
Copy link

@Diggsey Diggsey commented Nov 21, 2017

The back-buffer must be updated before processing the next window event, or else the window flickers whilst resizing.

@christolliday
Copy link
Owner

Hey thanks for the PR!

I'm guessing you're seeing the flickering on Windows? I just tested it on Windows and saw the window flickering there, and this does fix it.

On X11 there is no flickering which is why I haven't seen this issue. Unfortunately this change also causes an issue on X11 where the layout updating lags way behind redrawing, not sure why this only happens on X11 to be honest, but it looks much worse than the flickering I've seen on Windows.

I'm going to close this because of the X11 issue, and because the work I think needs to be done is more substantial, I just opened #38 to outline what I think is needed, let me know if you have any input on that issue.

@Diggsey
Copy link
Author

Diggsey commented Nov 26, 2017

@christolliday I can see the issue on X11 you are referring to, but for me it happens both with and without this change. I believe it's caused by the use of events_loop.run_forever, which will block until some event is received: in this case, it's possible to resize the window, and then the layout doesn't update until the mouse is moved (causing an event).

@christolliday
Copy link
Owner

christolliday commented Nov 27, 2017

That is weird.. Yeah run_forever will block waiting for an event, except the resize event should trigger the layout update events which should all be handled before drawing and before putting the event loop to sleep again.

For me it doesn't completely stop until a mouse event is received, it's only delayed by a lot, and only with this change. Not sure why it would stop entirely on your end, I'm guessing it's another winit bug but I could be wrong.

@Diggsey
Copy link
Author

Diggsey commented Nov 27, 2017

Yeah, I'm hoping to get this PR merged: rust-windowing/winit#237 which will simplify the event loop a lot, or at least will when the new API is exposed via a second PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants