Skip to content
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

provide manual timeout to egui in reactive mode to force refresh even if there's no new input #1691

Closed
coderedart opened this issue May 28, 2022 · 1 comment · Fixed by #1694
Labels
eframe Relates to epi and eframe feature New feature or request

Comments

@coderedart
Copy link
Contributor

Is your feature request related to a problem? Please describe.
egui's reactive mode is really great for applications, but the UI not updating AT ALL is a pain point for many newbies. at present, they are usually told to call request_repaint from another thread. not really user friendly imo.

Describe the solution you'd like
just let users set a optional timeout, and when there's no input for the duration of the timeout, egui does the request repaint thing itself.

Describe alternatives you've considered
I don't see any alternatives.

Additional context
all big three windowing libraries: winit, GLFW and SDL2, have support for wait_event timeout function, where the event loop will yield control back to us when it fails to get any events for the specified timeout. so, it should be pretty clean to implement.

@coderedart coderedart added the feature New feature or request label May 28, 2022
@emilk
Copy link
Owner

emilk commented May 28, 2022

eframe:s web backend already repaints every second by default: https://github.com/emilk/egui/blob/master/eframe/src/web/backend.rs#L413

I agree this should be controllable and also implemented on native.

The simplest would probably be to have a settable frequency of "update at least this often".

The more powerful (but also more complicated) thing to add is to have egui::Context::repaint_in(Duration) to schedule a repaint after a certain amount of time.

Is it something you'd like to work on?

@emilk emilk added the eframe Relates to epi and eframe label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eframe Relates to epi and eframe feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants