summaryrefslogtreecommitdiffstats
path: root/glutin
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-07-18 18:37:41 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-08-18 14:09:20 +0200
commit277b848ad8df1e8d038e33707548a45d63a601db (patch)
tree1da6c7a5135fb5f5c40a237224daae3721b2f685 /glutin
parent07cbed106467097543ff33d3b34e0e1ca6f695ae (diff)
downloadiced-277b848ad8df1e8d038e33707548a45d63a601db.tar.gz
iced-277b848ad8df1e8d038e33707548a45d63a601db.tar.bz2
iced-277b848ad8df1e8d038e33707548a45d63a601db.zip
Remove `window::Mode` and introduce `Settings::visible`
Additionally, only show the window once one frame has been rendered to avoid blank flashes on Windows.
Diffstat (limited to 'glutin')
-rw-r--r--glutin/src/application.rs25
1 files changed, 19 insertions, 6 deletions
diff --git a/glutin/src/application.rs b/glutin/src/application.rs
index 24f315fb..054cf839 100644
--- a/glutin/src/application.rs
+++ b/glutin/src/application.rs
@@ -54,13 +54,17 @@ where
runtime.enter(|| A::new(flags))
};
+ let should_be_visible = settings.window.visible;
+
let context = {
- let builder = settings.window.into_builder(
- &application.title(),
- application.mode(),
- event_loop.primary_monitor(),
- settings.id,
- );
+ let builder = settings
+ .window
+ .into_builder(
+ &application.title(),
+ event_loop.primary_monitor(),
+ settings.id,
+ )
+ .with_visible(false);
log::info!("Window builder: {:#?}", builder);
@@ -135,6 +139,7 @@ where
receiver,
context,
init_command,
+ should_be_visible,
settings.exit_on_close_request,
));
@@ -187,6 +192,7 @@ async fn run_instance<A, E, C>(
mut receiver: mpsc::UnboundedReceiver<glutin::event::Event<'_, A::Message>>,
mut context: glutin::ContextWrapper<glutin::PossiblyCurrent, Window>,
init_command: Command<A::Message>,
+ should_be_visible: bool,
exit_on_close_request: bool,
) where
A: Application + 'static,
@@ -200,6 +206,7 @@ async fn run_instance<A, E, C>(
let mut clipboard = Clipboard::connect(context.window());
let mut cache = user_interface::Cache::default();
let mut state = application::State::new(&application, context.window());
+ let mut visible = false;
let mut viewport_version = state.viewport_version();
application::run_command(
@@ -399,6 +406,12 @@ async fn run_instance<A, E, C>(
debug.render_finished();
+ if !visible && should_be_visible {
+ context.window().set_visible(true);
+
+ visible = true;
+ }
+
// TODO: Handle animations!
// Maybe we can use `ControlFlow::WaitUntil` for this.
}