feat: Set whether to show decorations (#672)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
parent
241667b078
commit
19eed94499
|
|
@ -3,6 +3,7 @@ All notable changes to the `eframe` crate.
|
|||
|
||||
|
||||
## Unreleased
|
||||
* `Frame` now provides `set_decorations` to set whether to show window decorations.
|
||||
* Remove "http" feature (use https://github.com/emilk/ehttp instead!).
|
||||
* Increase native scroll speed.
|
||||
|
||||
|
|
|
|||
|
|
@ -337,7 +337,15 @@ pub fn run(mut app: Box<dyn epi::App>, native_options: epi::NativeOptions) {
|
|||
}
|
||||
|
||||
{
|
||||
let epi::backend::AppOutput { quit, window_size } = app_output;
|
||||
let epi::backend::AppOutput {
|
||||
quit,
|
||||
window_size,
|
||||
decorated,
|
||||
} = app_output;
|
||||
|
||||
if let Some(decorated) = decorated {
|
||||
display.gl_window().window().set_decorations(decorated);
|
||||
}
|
||||
|
||||
if let Some(window_size) = window_size {
|
||||
display.gl_window().window().set_inner_size(
|
||||
|
|
|
|||
|
|
@ -258,6 +258,7 @@ impl AppRunner {
|
|||
let epi::backend::AppOutput {
|
||||
quit: _, // Can't quit a web page
|
||||
window_size: _, // Can't resize a web page
|
||||
decorated: _, // Can't show decorations
|
||||
} = app_output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -251,6 +251,12 @@ impl<'a> Frame<'a> {
|
|||
self.0.output.window_size = Some(size);
|
||||
}
|
||||
|
||||
/// Set whether to show window decorations (i.e. a frame around you app).
|
||||
/// If false it will be difficult to move and resize the app.
|
||||
pub fn set_decorations(&mut self, decorated: bool) {
|
||||
self.0.output.decorated = Some(decorated);
|
||||
}
|
||||
|
||||
/// If you need to request a repaint from another thread, clone this and send it to that other thread.
|
||||
pub fn repaint_signal(&self) -> std::sync::Arc<dyn RepaintSignal> {
|
||||
self.0.repaint_signal.clone()
|
||||
|
|
@ -405,5 +411,8 @@ pub mod backend {
|
|||
|
||||
/// Set to some size to resize the outer window (e.g. glium window) to this size.
|
||||
pub window_size: Option<egui::Vec2>,
|
||||
|
||||
/// Set to some bool to change window decorations
|
||||
pub decorated: Option<bool>,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue