diff --git a/egui/src/app.rs b/egui/src/app.rs index 4a4017e3..9d3c4cc0 100644 --- a/egui/src/app.rs +++ b/egui/src/app.rs @@ -38,6 +38,11 @@ pub trait App { /// Optional. fn setup(&mut self, _ctx: &crate::CtxRef) {} + /// Returns true if this app window should be resizable. + fn is_resizable(&self) -> bool { + true + } + /// Called each time the UI needs repainting, which may be many times per second. /// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`. fn ui(&mut self, ctx: &crate::CtxRef, integration_context: &mut IntegrationContext<'_>); diff --git a/egui_glium/CHANGELOG.md b/egui_glium/CHANGELOG.md index 6d95c482..94943b18 100644 --- a/egui_glium/CHANGELOG.md +++ b/egui_glium/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added * `egui_glium` will auto-save your app state every 30 seconds. +* `egui_glium` can now set windows as fixed size (e.g. the user can't resize the window). See `egui::App::is_resizable()`. ### Changed diff --git a/egui_glium/src/backend.rs b/egui_glium/src/backend.rs index ed864d81..d722e246 100644 --- a/egui_glium/src/backend.rs +++ b/egui_glium/src/backend.rs @@ -42,11 +42,12 @@ impl egui::app::RepaintSignal for GliumRepaintSignal { fn create_display( title: &str, window_settings: Option, + is_resizable: bool, event_loop: &glutin::event_loop::EventLoop, ) -> glium::Display { let mut window_builder = glutin::window::WindowBuilder::new() .with_decorations(true) - .with_resizable(true) + .with_resizable(is_resizable) .with_title(title) .with_transparent(false); @@ -102,7 +103,7 @@ pub fn run(mut app: Box) -> ! { .as_mut() .and_then(|storage| egui::app::get_value(storage.as_ref(), WINDOW_KEY)); let event_loop = glutin::event_loop::EventLoop::with_user_event(); - let display = create_display(app.name(), window_settings, &event_loop); + let display = create_display(app.name(), window_settings, app.is_resizable(), &event_loop); let repaint_signal = std::sync::Arc::new(GliumRepaintSignal(event_loop.create_proxy()));