diff --git a/crates/eframe/src/web/app_runner.rs b/crates/eframe/src/web/app_runner.rs index 29fd9122f..1fb169488 100644 --- a/crates/eframe/src/web/app_runner.rs +++ b/crates/eframe/src/web/app_runner.rs @@ -185,9 +185,14 @@ impl AppRunner { platform_output, textures_delta, shapes, - .. + viewports, + viewport_commands: _, // TODO(emilk): handle some of the commands, like setting the title and icon } = full_output; + if viewports.len() > 1 { + log::warn!("Multiple viewports not yet supported on the web"); + } + self.handle_platform_output(platform_output); self.textures_delta.append(textures_delta); let clipped_primitives = self.egui_ctx.tessellate(shapes); diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index ad5a494f5..88ff258ea 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -668,13 +668,19 @@ pub(crate) struct ViewportState { /// Describes a viewport, i.e. a native window. #[derive(Clone)] pub struct ViewportOutput { - pub builder: ViewportBuilder, - /// Id of us and our parent. pub id_pair: ViewportIdPair, + pub builder: ViewportBuilder, + /// The user-code that shows the GUI, used for deferred viewports. /// /// `None` for immediate viewports and the ROOT viewport. pub viewport_ui_cb: Option>, } + +impl ViewportOutput { + pub fn id(&self) -> ViewportId { + self.id_pair.this + } +}