diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index d99ef7e40a7..cbec97de546 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -1165,7 +1165,7 @@ mod glow_integration { for ( viewport_id, ViewportOutput { - ids, + parent, builder, viewport_ui_cb, commands, @@ -1173,6 +1173,8 @@ mod glow_integration { }, ) in viewport_output { + let ids = ViewportIdPair::from_self_and_parent(viewport_id, parent); + initialize_or_update_viewport( &mut self.viewports, ids, @@ -2673,7 +2675,7 @@ mod wgpu_integration { for ( viewport_id, ViewportOutput { - ids, + parent, builder, viewport_ui_cb, commands, @@ -2681,6 +2683,8 @@ mod wgpu_integration { }, ) in viewport_output { + let ids = ViewportIdPair::from_self_and_parent(viewport_id, parent); + initialize_or_update_viewport( viewports, ids, diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index 299b90d858f..43b7b879bb6 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -1608,7 +1608,7 @@ impl ContextImpl { ( id, ViewportOutput { - ids: ViewportIdPair::from_self_and_parent(id, parent), + parent, builder: viewport.builder.clone(), viewport_ui_cb: viewport.viewport_ui_cb.clone(), commands, diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index 2403a795c26..35de10059e3 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -665,9 +665,10 @@ pub enum ViewportCommand { /// Describes a viewport, i.e. a native window. #[derive(Clone)] pub struct ViewportOutput { - /// Id of us and our parent. - pub ids: ViewportIdPair, + /// Id of our parent viewport. + pub parent: ViewportId, + /// The window attrbiutes such as title, position, size, etc. pub builder: ViewportBuilder, /// The user-code that shows the GUI, used for deferred viewports. @@ -688,21 +689,17 @@ pub struct ViewportOutput { } impl ViewportOutput { - pub fn id(&self) -> ViewportId { - self.ids.this - } - /// Add on new output. pub fn append(&mut self, newer: Self) { let Self { - ids, + parent, builder, viewport_ui_cb, mut commands, repaint_delay, } = newer; - self.ids = ids; + self.parent = parent; self.builder.patch(&builder); self.viewport_ui_cb = viewport_ui_cb; self.commands.append(&mut commands);