diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 22cc61745..52b7e7182 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -52,7 +52,9 @@ pub struct EventResponse { // ---------------------------------------------------------------------------- -/// Handles the integration between egui and winit. +/// Handles the integration between egui and a winit Window. +/// +/// Instantiate one of these per viewport/window. pub struct State { start_time: web_time::Instant, egui_input: egui::RawInput, @@ -733,12 +735,13 @@ impl State { cursor_icon, open_url, copied_text, - events: _, // handled above + events: _, // handled elsewhere mutable_text_under_cursor: _, // only used in eframe web text_cursor_pos, #[cfg(feature = "accesskit")] accesskit_update, } = platform_output; + self.current_pixels_per_point = egui_ctx.input_for(viewport_id, |i| i.pixels_per_point); // someone can have changed it to scale the UI self.set_cursor_icon(window, cursor_icon); diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index affb0dd92..93d101908 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -143,8 +143,10 @@ struct ViewportState { /// State related to repaint scheduling. repaint: ViewportRepaintInfo, + // ---------------------- // The output of a frame: graphics: GraphicLayers, + // Most of the things in `PlatformOutput` are not actually viewport dependent. output: PlatformOutput, commands: Vec, } diff --git a/crates/egui/src/data/output.rs b/crates/egui/src/data/output.rs index 360de3a11..2e94b5f99 100644 --- a/crates/egui/src/data/output.rs +++ b/crates/egui/src/data/output.rs @@ -98,6 +98,9 @@ pub struct PlatformOutput { /// Iff `Some`, the user is editing text. pub text_cursor_pos: Option, + /// The difference in the widget tree since last frame. + /// + /// NOTE: this needs to be per-viewport. #[cfg(feature = "accesskit")] pub accesskit_update: Option, }