-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support exiting event loop (closing native window) without quitting program #1223
Comments
Related issue: #427 This is a limitation from You can use another backend (e.g. |
According to |
I've tried
So I reverted it in 3e1db88 |
Reopened, because this is something a lot of people want. We need to either change how |
Are there any workarounds for this? Was attempting to use egui_glow but I'm unable to remove the window without quitting the entire application. Trying to get out of the loop just causes a frozen window to stay there until the application is closed. |
This will finally be fixed in #1889 🥳 |
@emilk Great! Will this apply to egui_glow/glutin as well? |
There is nothing stopping you from using The PR is for |
In my case when trying this, the glutin window stays around after getting out of the run_return, similar to this issue (not my repo): rust-windowing/winit#2467 This is with trying egui 0.18 on Linux. Something else I noticed was that if I create two windows back to back (meaning create a window, close it, then open another one, all in the same process), the second window gets the final events, like LoopDestroyed, causing the second window to immediately close. It's possible I'm not doing something correct in my own code (https://github.com/luxtorpeda-dev/luxtorpeda/blob/a9cafca4ab96bcedd318ecd9fec583daa3a4af81/src/ui.rs#L170) in the loop, so I'm curious what the example looks like as well for comparison. Once the example is there, I'll re-test that and then see if I can create a re-producible demo with that. |
Is your feature request related to a problem? Please describe.
I am using egui in a command line application. The app displays a window for the user to provide some input. After the window is closed egui should exit the event loop and return from eframe::run_native, so that the app can continue running.
However this is currently impossible because the return type of
eframe::run_native
is!
andstd::process::exit
is called when the window is closed.Describe the solution you'd like
Change
eframe::run_native
to return to the caller once all windows have been closed and the event loop is done.Optionally provide a way to return a value to the caller via
epi::frame::quit
. ABox<dyn Any>
would suffice.Describe alternatives you've considered
Since the event loop must be run on the main thread and
std::process::exit
is called, I see no alternative.The text was updated successfully, but these errors were encountered: