Conversation
This changes eframe to allow for proper clean of up open windows by dropping open windows when the "CloseRequested" event is received. And then running the event loop until the winit "Destroy" event is received. This aligns with recommendations from winit rust-windowing/winit#4135
This code is never reached as "GlowWinitRunning" is dropped earlier on as part of the exiting process in response to the winit "CloseRequested" event. The winit "Destroyed" event only ever occurs after "CloseRequested". The exception to this is if a window was not properly closed before the event loop was excited previously.
|
Preview available at https://egui-pr-preview.github.io/pr/7565-badclose |
|
Thanks for workin on this! This looks very promising. Please run |
|
It works as best I can tell viewports.mp4The other example that I was able to run on my computer behaved the same as when they were run on the main branch (excluding "serial_windows", which works as expected on Wayland with this PR). |
|
I researched into the why the viewport ID check was added and it to resolve this issue with this commit. if viewport_id == Some(ViewportId::ROOT) {
return EventResult::Exit;
} else {
return EventResult::Wait;
}
I believe that this is not a regression, as the viewport does close and reopen on Wayland without any issues. However, the example did not run at all on X11, either on the main branch or my branch. |
|
I wonder if this also solves |
|
I believe that this issue will be solved, on Linux at least, as the behavior described in that issue matches exactly what I have fixed. |
|
I tested it on macOS, and this works great:
|
|
Thank you so much, @tye-exe! |
This PR changes eframe to comply with the proper methodology of ending winit. This fixes the winit window remaining open on Wayland (Linux) by allowing winit to properly clean up the window.
Details
On a winit "CloseRequested" event eframe drops open windows, which then triggers a "Destroyed" event and allows for winit to clean up resources. In response to the "Destroyed" event, the event loop is exited and control flow returned to user code.
This follows the advice recomended in this winit issue in response to a similar problem.
I have tested the new change using:
Current implementation
After changes
Misc Info
I attempted to run
./scripts/check.sh, but it fails on the I have branched from on some code that I have not modified.