Skip to content

Support exiting event loop (closing native window) without quitting program #1223

@surban

Description

@surban

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 ! and std::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. A Box<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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    eframeRelates to epi and eframeegui-winitporblems related to winitfeatureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions