summaryrefslogtreecommitdiffstats
path: root/winit/src/conversion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'winit/src/conversion.rs')
-rw-r--r--winit/src/conversion.rs29
1 files changed, 22 insertions, 7 deletions
diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs
index 279b975a..725b2d86 100644
--- a/winit/src/conversion.rs
+++ b/winit/src/conversion.rs
@@ -7,10 +7,25 @@ use crate::{
keyboard::{KeyCode, ModifiersState},
mouse, ButtonState,
},
- MouseCursor,
+ Mode, MouseCursor,
};
-/// Convert a `MouseCursor` from [`iced_native`] to a [`winit`] cursor icon.
+/// Converts a [`Mode`] to a [`winit`] fullscreen mode.
+///
+/// [`Mode`]:
+pub fn fullscreen(
+ monitor: winit::monitor::MonitorHandle,
+ mode: Mode,
+) -> Option<winit::window::Fullscreen> {
+ match mode {
+ Mode::Windowed => None,
+ Mode::Fullscreen => {
+ Some(winit::window::Fullscreen::Borderless(monitor))
+ }
+ }
+}
+
+/// Converts a `MouseCursor` from [`iced_native`] to a [`winit`] cursor icon.
///
/// [`winit`]: https://github.com/rust-windowing/winit
/// [`iced_native`]: https://github.com/hecrj/iced/tree/master/native
@@ -26,7 +41,7 @@ pub fn mouse_cursor(mouse_cursor: MouseCursor) -> winit::window::CursorIcon {
}
}
-/// Convert a `MouseButton` from [`winit`] to an [`iced_native`] mouse button.
+/// Converts a `MouseButton` from [`winit`] to an [`iced_native`] mouse button.
///
/// [`winit`]: https://github.com/rust-windowing/winit
/// [`iced_native`]: https://github.com/hecrj/iced/tree/master/native
@@ -39,7 +54,7 @@ pub fn mouse_button(mouse_button: winit::event::MouseButton) -> mouse::Button {
}
}
-/// Convert an `ElementState` from [`winit`] to an [`iced_native`] button state.
+/// Converts an `ElementState` from [`winit`] to an [`iced_native`] button state.
///
/// [`winit`]: https://github.com/rust-windowing/winit
/// [`iced_native`]: https://github.com/hecrj/iced/tree/master/native
@@ -50,8 +65,8 @@ pub fn button_state(element_state: winit::event::ElementState) -> ButtonState {
}
}
-/// Convert some `ModifiersState` from [`winit`] to an [`iced_native`] modifiers
-/// state.
+/// Converts some `ModifiersState` from [`winit`] to an [`iced_native`]
+/// modifiers state.
///
/// [`winit`]: https://github.com/rust-windowing/winit
/// [`iced_native`]: https://github.com/hecrj/iced/tree/master/native
@@ -66,7 +81,7 @@ pub fn modifiers_state(
}
}
-/// Convert a `VirtualKeyCode` from [`winit`] to an [`iced_native`] key code.
+/// Converts a `VirtualKeyCode` from [`winit`] to an [`iced_native`] key code.
///
/// [`winit`]: https://github.com/rust-windowing/winit
/// [`iced_native`]: https://github.com/hecrj/iced/tree/master/native