-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix missed RedrawRequested and WindowCloseRequested events with UpdateMode::Reactive (part 2) #18549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
4e09f2b
to
9218c8a
Compare
9218c8a
to
0bcd3a9
Compare
The test included in this PR uses |
There's another similar issue where The fix for the window delay issue is essentially the same as what's presented here - read the |
Is there any way we could get this in for Thanks! |
I need testing and reviews from at least two other contributors, ideally on a wide range of platforms. I share your desire to get this sort of bug fix in, but windowing code is really fragile and hard to test. |
This fixes RequestRedraw events that can be missed in `about_to_wait()` which was reading from the cursor before `run_app_update()` is called. This adds a subsequent read to update the redraw_requested flag if any `RequestRedraw` were sent. Was reported in bevyengine#16817
They are now read after the world update.
Pressing the window close button when in a reactive UpdateMode isn't handled until the reactive wait timeout is triggered or the user triggers some other device event. This change adds an explict check for the WindowCloseRequested event to trigger another app update to process it.
4f19374
to
4c116a9
Compare
Can you provide some brief info about how to test this? Just the |
There's two things to test with
|
Is there any other info needed for testing? |
Hi! Thanks for checking back in. I haven't had time to look into this but it's in my inbox. I've also added it to |
Objective
This PR continues the work started by @boondocklabs in #17991 in order to fix missed
RedrawRequested
events that are sent during app update. Additionally, this PR now also fixes a similar issue whereWindowCloseRequested
events were also missed during app update. In both cases, the event would not be handled until the next app update.This bug applies when the app is running with
UpdateMode::Reactive
. These missed events won't be handled until the next event loop timeout or triggered by a new window or device event (such as moving the mouse).Use-Cases
When using
UpdateMode::Reactive
:RedrawRequested
event from anobserve
system should trigger a redraw immediately. The app should not stall until the next window event or event loop timeout.Solution
RedrawRequested
events are already read and checked in the winit event loop runner. Move this read after the app update executes.WindowCloseRequested
were not previously read or checked. Read and check if an event has fired after the app update executes.Prior Art
The
UpdateMode
itself is (re)read after the app update with a note about re-extracting it since the app update may have changed the value and we should act accordingly. We're essentially applying this same logic (i.e. check after the app update) forRedrawRequested
andWindowCloseRequested
.Original PR Notes from @boondocklabs