Simplify internal type construction

This commit is contained in:
Mads Marquart 2022-09-21 10:04:28 +02:00 committed by GitHub
parent 25b129362f
commit fafdedfb7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 242 additions and 285 deletions

View file

@ -127,7 +127,7 @@ pub(crate) struct WindowAttributes {
pub position: Option<Position>,
pub resizable: bool,
pub title: String,
pub fullscreen: Option<Fullscreen>,
pub fullscreen: Option<platform_impl::Fullscreen>,
pub maximized: bool,
pub visible: bool,
pub transparent: bool,
@ -258,7 +258,7 @@ impl WindowBuilder {
/// See [`Window::set_fullscreen`] for details.
#[inline]
pub fn with_fullscreen(mut self, fullscreen: Option<Fullscreen>) -> Self {
self.window.fullscreen = fullscreen;
self.window.fullscreen = fullscreen.map(|f| f.into());
self
}
@ -766,7 +766,7 @@ impl Window {
/// - **Android:** Unsupported.
#[inline]
pub fn set_fullscreen(&self, fullscreen: Option<Fullscreen>) {
self.window.set_fullscreen(fullscreen)
self.window.set_fullscreen(fullscreen.map(|f| f.into()))
}
/// Gets the window's current fullscreen state.
@ -778,7 +778,7 @@ impl Window {
/// - **Wayland:** Can return `Borderless(None)` when there are no monitors.
#[inline]
pub fn fullscreen(&self) -> Option<Fullscreen> {
self.window.fullscreen()
self.window.fullscreen().map(|f| f.into())
}
/// Turn window decorations on or off.
@ -1038,7 +1038,9 @@ impl Window {
/// **iOS:** Can only be called on the main thread.
#[inline]
pub fn current_monitor(&self) -> Option<MonitorHandle> {
self.window.current_monitor()
self.window
.current_monitor()
.map(|inner| MonitorHandle { inner })
}
/// Returns the list of all the monitors available on the system.
@ -1072,7 +1074,9 @@ impl Window {
/// [`EventLoopWindowTarget::primary_monitor`]: crate::event_loop::EventLoopWindowTarget::primary_monitor
#[inline]
pub fn primary_monitor(&self) -> Option<MonitorHandle> {
self.window.primary_monitor()
self.window
.primary_monitor()
.map(|inner| MonitorHandle { inner })
}
}
unsafe impl HasRawWindowHandle for Window {