diff --git a/crates/eframe/src/epi.rs b/crates/eframe/src/epi.rs index b1d74914..e2eb2c71 100644 --- a/crates/eframe/src/epi.rs +++ b/crates/eframe/src/epi.rs @@ -836,9 +836,6 @@ pub struct WindowInfo { /// Current monitor size in egui points (logical pixels) pub monitor_size: Option, - - /// Are we in maximize mode? - pub maximized: bool, } /// Information about the URL. diff --git a/crates/eframe/src/native/epi_integration.rs b/crates/eframe/src/native/epi_integration.rs index f76956d0..88d4c17c 100644 --- a/crates/eframe/src/native/epi_integration.rs +++ b/crates/eframe/src/native/epi_integration.rs @@ -41,7 +41,6 @@ pub fn read_window_info(window: &winit::window::Window, pixels_per_point: f32) - y: size.height, }, monitor_size, - maximized: window.is_maximized(), } } diff --git a/examples/custom_window_frame/src/main.rs b/examples/custom_window_frame/src/main.rs index 39bff821..53d25ad3 100644 --- a/examples/custom_window_frame/src/main.rs +++ b/examples/custom_window_frame/src/main.rs @@ -21,7 +21,9 @@ fn main() { } #[derive(Default)] -struct MyApp {} +struct MyApp { + maximized: bool, +} impl eframe::App for MyApp { fn clear_color(&self, _visuals: &egui::Visuals) -> egui::Rgba { @@ -29,7 +31,7 @@ impl eframe::App for MyApp { } fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) { - custom_window_frame(ctx, frame, "egui with custom frame", |ui| { + custom_window_frame(self, ctx, frame, "egui with custom frame", |ui| { ui.label("This is just the contents of the window"); ui.horizontal(|ui| { ui.label("egui theme:"); @@ -40,6 +42,7 @@ impl eframe::App for MyApp { } fn custom_window_frame( + app: &mut MyApp, ctx: &egui::Context, frame: &mut eframe::Frame, title: &str, @@ -115,17 +118,19 @@ fn custom_window_frame( frame.set_minimized(true); } - let is_maximized = frame.info().window_info.maximized; let maximized_response = ui.put( Rect::from_min_size( rect.left_top() + vec2((height - 4.0) * 2.0, 0.0), Vec2::splat(height), ), - Button::new(RichText::new(if is_maximized { "🗗" } else { "🗖" }).size(height - 4.0)) - .frame(false), + Button::new( + RichText::new(if app.maximized { "🗗" } else { "🗖" }).size(height - 4.0), + ) + .frame(false), ); if maximized_response.clicked() { - frame.set_maximized(!is_maximized); + app.maximized = !app.maximized; + frame.set_maximized(app.maximized); } // Add the contents: