1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Clarify comment

This commit is contained in:
Emil Ernerfeldt
2023-11-13 20:00:04 +01:00
parent 0ad99706a6
commit 6e7a735b40
2 changed files with 6 additions and 4 deletions

View File

@@ -495,7 +495,7 @@ impl EpiIntegration {
/// Run user code - this can create immediate viewports, so hold no locks over this! /// Run user code - this can create immediate viewports, so hold no locks over this!
/// ///
/// If `viewport_ui_cb` is None, we are in the root viewport and will call [`App::update`]. /// If `viewport_ui_cb` is None, we are in the root viewport and will call [`crate::App::update`].
pub fn update( pub fn update(
&mut self, &mut self,
app: &mut dyn epi::App, app: &mut dyn epi::App,

View File

@@ -507,13 +507,14 @@ mod glow_integration {
crate::profile_scope!("frame"); crate::profile_scope!("frame");
{ {
// This will only happen if the viewport is sync
// That means that the viewport cannot be rendered by itself and needs his parent to be rendered
let glutin = self.glutin.borrow(); let glutin = self.glutin.borrow();
let viewport = &glutin.viewports[&viewport_id]; let viewport = &glutin.viewports[&viewport_id];
if viewport.viewport_ui_cb.is_none() && viewport_id != ViewportId::ROOT { let is_immediate = viewport.viewport_ui_cb.is_none();
if is_immediate && viewport_id != ViewportId::ROOT {
if let Some(parent_viewport) = glutin.viewports.get(&viewport.id_pair.parent) { if let Some(parent_viewport) = glutin.viewports.get(&viewport.id_pair.parent) {
if let Some(window) = parent_viewport.window.as_ref() { if let Some(window) = parent_viewport.window.as_ref() {
// This will only happen if this is an immediate viewport.
// That means that the viewport cannot be rendered by itself and needs his parent to be rendered.
return EventResult::RepaintNext(window.id()); return EventResult::RepaintNext(window.id());
} }
} }
@@ -701,6 +702,7 @@ mod glow_integration {
id_pair: ViewportIdPair, id_pair: ViewportIdPair,
/// The user-callback that shows the ui. /// The user-callback that shows the ui.
/// None for immediate viewports.
viewport_ui_cb: Option<Arc<ViewportUiCallback>>, viewport_ui_cb: Option<Arc<ViewportUiCallback>>,
egui_winit: Option<egui_winit::State>, egui_winit: Option<egui_winit::State>,