1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Refactor lazy activation

This commit is contained in:
Matt Campbell
2022-11-30 08:09:41 -06:00
parent 3109ee9825
commit 18ccf1fd10
4 changed files with 27 additions and 30 deletions

View File

@@ -132,21 +132,11 @@ impl State {
&mut self,
window: &winit::window::Window,
event_loop_proxy: winit::event_loop::EventLoopProxy<T>,
egui_ctx: egui::Context,
initial_tree_update_factory: impl 'static + FnOnce() -> accesskit::TreeUpdate + Send,
) {
self.accesskit = Some(accesskit_winit::Adapter::new(
window,
move || {
// This function is called when an accessibility client
// (e.g. screen reader) makes its first request. If we got here,
// we know that an accessibility tree is actually wanted.
// Tell egui that AccessKit is active, and return a placeholder
// tree for now. `egui::Context::accesskit_activated`
// will request a repaint, and that will provide the first
// real accessibility tree.
egui_ctx.accesskit_activated();
egui::accesskit_placeholder_tree_update()
},
initial_tree_update_factory,
event_loop_proxy,
));
}