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

@ -6,7 +6,7 @@ use crate::keyboard;
use crate::mouse;
use crate::touch;
use crate::window;
use crate::{Event, Mode, Point, Position};
use crate::{Event, Point, Position};
/// Converts a winit window event into an iced event.
pub fn window_event(
@ -182,29 +182,6 @@ pub fn position(
}
}
/// Converts a [`Mode`] to a [`winit`] fullscreen mode.
///
/// [`winit`]: https://github.com/rust-windowing/winit
pub fn fullscreen(
monitor: Option<winit::monitor::MonitorHandle>,
mode: Mode,
) -> Option<winit::window::Fullscreen> {
match mode {
Mode::Windowed | Mode::Hidden => None,
Mode::Fullscreen => {
Some(winit::window::Fullscreen::Borderless(monitor))
}
}
}
/// Converts a [`Mode`] to a visibility flag.
pub fn visible(mode: Mode) -> bool {
match mode {
Mode::Windowed | Mode::Fullscreen => true,
Mode::Hidden => false,
}
}
/// Converts a `MouseCursor` from [`iced_native`] to a [`winit`] cursor icon.
///
/// [`winit`]: https://github.com/rust-windowing/winit