Remove window::Mode and introduce Settings::visible

Additionally, only show the window once one frame has been rendered to avoid blank flashes on Windows.
This commit is contained in:
Héctor Ramón Jiménez 2022-07-18 18:37:41 +02:00
parent 07cbed1064
commit 277b848ad8
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
11 changed files with 52 additions and 121 deletions

View file

@ -1,6 +1,6 @@
use crate::application::{self, StyleSheet as _};
use crate::conversion;
use crate::{Application, Color, Debug, Mode, Point, Size, Viewport};
use crate::{Application, Color, Debug, Point, Size, Viewport};
use std::marker::PhantomData;
use winit::event::{Touch, WindowEvent};
@ -13,7 +13,6 @@ where
<A::Renderer as crate::Renderer>::Theme: application::StyleSheet,
{
title: String,
mode: Mode,
scale_factor: f64,
viewport: Viewport,
viewport_version: usize,
@ -31,7 +30,6 @@ where
/// Creates a new [`State`] for the provided [`Application`] and window.
pub fn new(application: &A, window: &Window) -> Self {
let title = application.title();
let mode = application.mode();
let scale_factor = application.scale_factor();
let theme = application.theme();
let appearance = theme.appearance(application.style());
@ -47,7 +45,6 @@ where
Self {
title,
mode,
scale_factor,
viewport,
viewport_version: 0,
@ -193,20 +190,6 @@ where
self.title = new_title;
}
// Update window mode
let new_mode = application.mode();
if self.mode != new_mode {
window.set_fullscreen(conversion::fullscreen(
window.current_monitor(),
new_mode,
));
window.set_visible(conversion::visible(new_mode));
self.mode = new_mode;
}
// Update scale factor
let new_scale_factor = application.scale_factor();