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

@ -14,7 +14,7 @@ mod platform;
pub use platform::PlatformSpecific;
use crate::conversion;
use crate::{Mode, Position};
use crate::Position;
use winit::monitor::MonitorHandle;
use winit::window::WindowBuilder;
@ -65,6 +65,9 @@ pub struct Window {
/// The maximum size of the window.
pub max_size: Option<(u32, u32)>,
/// Whether the window should be visible or not.
pub visible: bool,
/// Whether the window should be resizable or not.
pub resizable: bool,
@ -89,7 +92,6 @@ impl Window {
pub fn into_builder(
self,
title: &str,
mode: Mode,
primary_monitor: Option<MonitorHandle>,
_id: Option<String>,
) -> WindowBuilder {
@ -104,8 +106,7 @@ impl Window {
.with_decorations(self.decorations)
.with_transparent(self.transparent)
.with_window_icon(self.icon)
.with_always_on_top(self.always_on_top)
.with_visible(conversion::visible(mode));
.with_always_on_top(self.always_on_top);
if let Some(position) = conversion::position(
primary_monitor.as_ref(),
@ -166,9 +167,6 @@ impl Window {
);
}
window_builder = window_builder
.with_fullscreen(conversion::fullscreen(primary_monitor, mode));
window_builder
}
}
@ -180,6 +178,7 @@ impl Default for Window {
position: Position::default(),
min_size: None,
max_size: None,
visible: true,
resizable: true,
decorations: true,
transparent: false,