Expand description
What pairs each window with its viewport, for egui-pop’s own runner and for a host running the event loop itself.
egui-pop’s runner (create-native) calls these itself. A host that
builds the winit event loop and drives eframe through
eframe::create_native and run_app_on_demand (feature host-loop)
calls them from its own ApplicationHandler, so super::window
answers for every window there too, detached panels’ windows
included:
// In the application's creator, first:
egui_pop::api::runner::host::created(cc);
impl ApplicationHandler<eframe::UserEvent> for HostLoop<'_> {
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
egui_pop::api::runner::host::resumed(event_loop);
self.eframe.resumed(event_loop);
}
fn window_event(&mut self, el: &ActiveEventLoop, id: WindowId, event: WindowEvent) {
egui_pop::api::runner::host::window_event(id, &event);
if matches!(event, WindowEvent::RedrawRequested) {
let eframe = &mut self.eframe;
egui_pop::api::runner::host::redraw(id, || eframe.window_event(el, id, event));
} else {
self.eframe.window_event(el, id, event);
}
}
// ... the other callbacks to eframe as before.
}
// After run_app_on_demand returns:
egui_pop::api::runner::host::detach();redraw notes which window eframe paints: the pass that begins in
it is that window’s viewport (a deferred viewport, the main window).
An immediate viewport is painted in a pass nested in its parent’s,
and its own window’s redraw runs no pass: the two are paired in the
order seen (see pairs). The handles come from the window’s winit id
(egui_pop_winit), used only once the main window’s id was seen to be
its native window (super::ids_verified).
Functions§
- attach
- Pairs the windows painted for
ctx‘s passes: hooks on its passes’ begin and end, once per context. - created
- In the application’s creator (
eframe::AppCreator), before anything else: the main window (its handles and winit id) and the context whose passes pair the other windows (attach). - detach
- After the loop returned: everything forgotten, for a next run.
- redraw
- Around eframe’s handling of
window’sRedrawRequested: the pass that begins in it is that window’s viewport; no pass at all, an immediate viewport’s window (eframe repaints its parent instead). - resumed
- When the event loop resumes, before eframe’s
resumed: the display the windows’ ids are read against (set_display). - set_
display - The display the windows’ ids are read against, when
resumedcannot give it (a test). - set_
main_ window - The main window, when
createdcannot give it (a host making its own creation context, a test): its winit id and its handles. - window_
event - Each window event, before eframe gets it: a destroyed window’s handles go.