Browse Source

eframe: add always_on_top option (native)

pull/359/head
Emil Ernerfeldt 4 years ago
parent
commit
a7a36bd313
  1. 1
      eframe/CHANGELOG.md
  2. 5
      egui_glium/src/backend.rs
  3. 25
      epi/src/lib.rs

1
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

5
egui_glium/src/backend.rs

@ -82,11 +82,12 @@ fn create_display(
event_loop: &glutin::event_loop::EventLoop<RequestRepaintEvent>,
) -> 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);

25
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 <https://github.com/rust-windowing/winit/pull/1524>
pub drag_and_drop_support: bool,
/// The application icon, e.g. in the Windows task bar etc.
pub icon_data: Option<IconData>,
@ -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 <https://github.com/rust-windowing/winit/pull/1524>
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,
}
}
}

Loading…
Cancel
Save