1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

ViewportOutput: only include parent id, as own if is the key of map

This commit is contained in:
Emil Ernerfeldt
2023-11-16 08:35:51 +01:00
parent fb21feecf9
commit 2cb2434e69
3 changed files with 12 additions and 11 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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);