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.rs34
1 files changed, 33 insertions, 1 deletions
diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs
index 5d0f8348..462be65b 100644
--- a/winit/src/conversion.rs
+++ b/winit/src/conversion.rs
@@ -23,6 +23,12 @@ pub fn window_attributes(
width: settings.size.width,
height: settings.size.height,
})
+ .with_maximized(settings.maximized)
+ .with_fullscreen(
+ settings
+ .fullscreen
+ .then_some(winit::window::Fullscreen::Borderless(None)),
+ )
.with_resizable(settings.resizable)
.with_enabled_buttons(if settings.resizable {
winit::window::WindowButtons::all()
@@ -191,6 +197,8 @@ pub fn window_event(
}))
}
},
+ // Ignore keyboard presses/releases during window focus/unfocus
+ WindowEvent::KeyboardInput { is_synthetic, .. } if is_synthetic => None,
WindowEvent::KeyboardInput { event, .. } => Some(Event::Keyboard({
let key = {
#[cfg(not(target_arch = "wasm32"))]
@@ -1112,7 +1120,7 @@ pub fn native_key_code(
}
}
-/// Converts some [`UserAttention`] into it's `winit` counterpart.
+/// Converts some [`UserAttention`] into its `winit` counterpart.
///
/// [`UserAttention`]: window::UserAttention
pub fn user_attention(
@@ -1128,6 +1136,30 @@ pub fn user_attention(
}
}
+/// Converts some [`window::Direction`] into a [`winit::window::ResizeDirection`].
+pub fn resize_direction(
+ resize_direction: window::Direction,
+) -> winit::window::ResizeDirection {
+ match resize_direction {
+ window::Direction::North => winit::window::ResizeDirection::North,
+ window::Direction::South => winit::window::ResizeDirection::South,
+ window::Direction::East => winit::window::ResizeDirection::East,
+ window::Direction::West => winit::window::ResizeDirection::West,
+ window::Direction::NorthEast => {
+ winit::window::ResizeDirection::NorthEast
+ }
+ window::Direction::NorthWest => {
+ winit::window::ResizeDirection::NorthWest
+ }
+ window::Direction::SouthEast => {
+ winit::window::ResizeDirection::SouthEast
+ }
+ window::Direction::SouthWest => {
+ winit::window::ResizeDirection::SouthWest
+ }
+ }
+}
+
/// Converts some [`window::Icon`] into it's `winit` counterpart.
///
/// Returns `None` if there is an error during the conversion.