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

Context::request_repaint will wake up the UI thread #1366

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

emilk
Copy link
Owner

@emilk emilk commented Mar 15, 2022

This adds a callback (set by Context::set_request_repaint_callback) which integration can use to wake up the UI thread.

eframe (egui_web and egui_glow) will use this, replacing epi::Frame::request_repaint.

Existing code calling epi::Frame::request_repaint should be changed to instead call egui::Context::request_repaint.

This is the first callback added to the egui API, which otherwise is completely driven by data.

The purpose of this is to remove the confusion between the two request_repaint methods (by removing one). Furthermore, it makes epi::Frame a lot simpler, allowing future simplifications to it (perhaps no longer having it be Send+Sync+Clone).

Closes #1187

This adds a callback (set by `Context::set_request_repaint_callback`)
which integration can use to wake up the UI thread.

eframe (egui_web and egui_glow) will use this, replacing
`epi::Frame::request_repaint`.

Existing code calling `epi::Frame::request_repaint` should be changed
to instead call `egui::Context::request_repaint`.

This is the first callback added to the egui API, which otherwise is
completely driven by data.

The purpose of this is to remove the confusion between the two
`request_repaint` methods (by removing one). Furthermore, it makes
`epi::Frame` a lot simpler, allowing future simplifications to it
(perhaps no longer having it be `Send+Sync+Clone`).
@emilk emilk force-pushed the ctx-request-repaint branch from 75cb032 to 03521de Compare March 15, 2022 16:10
@emilk emilk merged commit c768d1d into master Mar 15, 2022
@emilk emilk deleted the ctx-request-repaint branch March 15, 2022 16:21
emilk added a commit that referenced this pull request Mar 25, 2022
The purpose of this is to expose `frame.storage()` and `frame.storage_mut()` so users can save/load app state from the `App::update` function, without having to add another parameter to that function.

Changes:
* Added `Frame::storage()` and `Frame::storage_mut()`
* `App::update` now takes a `&mut Frame` rather than just `&Frame`
* `Frame` is no longer `Clone` or `Sync` (doesn't have to be since #1366)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant