diff --git a/eframe/CHANGELOG.md b/eframe/CHANGELOG.md index d13edfec7..9850d4a27 100644 --- a/eframe/CHANGELOG.md +++ b/eframe/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to the `eframe` crate. ## Unreleased * Moved options out of `trait App` into new `NativeOptions`. +* Add option for `always_on_top`. ## 0.11.0 - 2021-04-05 diff --git a/egui_glium/src/backend.rs b/egui_glium/src/backend.rs index fd8fa5cd0..83b284e29 100644 --- a/egui_glium/src/backend.rs +++ b/egui_glium/src/backend.rs @@ -82,11 +82,12 @@ fn create_display( event_loop: &glutin::event_loop::EventLoop, ) -> glium::Display { let mut window_builder = glutin::window::WindowBuilder::new() + .with_always_on_top(native_options.always_on_top) .with_decorations(native_options.decorated) .with_resizable(native_options.resizable) .with_title(app.name()) - .with_window_icon(window_icon) - .with_transparent(native_options.transparent); + .with_transparent(native_options.transparent) + .with_window_icon(window_icon); window_builder = window_builder_drag_and_drop(window_builder, native_options.drag_and_drop_support); diff --git a/epi/src/lib.rs b/epi/src/lib.rs index 6ec8f3108..912028c71 100644 --- a/epi/src/lib.rs +++ b/epi/src/lib.rs @@ -132,6 +132,18 @@ pub trait App { /// Options controlling the behavior of a native window #[derive(Clone)] pub struct NativeOptions { + /// Sets whether or not the window will always be on top of other windows. + pub always_on_top: bool, + + /// On desktop: add window decorations (i.e. a frame around your app)? + /// If false it will be difficult to move and resize the app. + pub decorated: bool, + + /// On Windows: enable drag and drop support. + /// Set to false to avoid issues with crates such as cpal which + /// uses that use multi-threaded COM API + pub drag_and_drop_support: bool, + /// The application icon, e.g. in the Windows task bar etc. pub icon_data: Option, @@ -141,29 +153,22 @@ pub struct NativeOptions { /// Should the app window be resizable? pub resizable: bool, - /// On desktop: add window decorations (i.e. a frame around your app)? - /// If false it will be difficult to move and resize the app. - pub decorated: bool, - /// On desktop: make the window transparent. /// You control the transparency with [`App::clear_color()`]. /// You should avoid having a [`egui::CentralPanel`], or make sure its frame is also transparent. pub transparent: bool, - - /// On Windows: enable drag and drop support. - /// Set to false to avoid issues with crates such as cpal which uses that use multi-threaded COM API - pub drag_and_drop_support: bool, } impl Default for NativeOptions { fn default() -> Self { Self { + always_on_top: false, + decorated: true, + drag_and_drop_support: true, icon_data: None, initial_window_size: None, resizable: true, - decorated: true, transparent: false, - drag_and_drop_support: true, } } }