From d6708f60f198b8a91f9e174a17d11d09543d5685 Mon Sep 17 00:00:00 2001 From: frederik-uni <147479464+frederik-uni@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:28:27 +0200 Subject: [PATCH 1/2] iOS winit not perfect, but at least better than before --- crates/egui-winit/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index b7881e3ca84..8bf8fa0acf6 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1592,7 +1592,10 @@ pub fn create_winit_window_attributes( .with_decorations(decorations.unwrap_or(true)) .with_resizable(resizable.unwrap_or(true)) .with_visible(visible.unwrap_or(true)) - .with_maximized(maximized.unwrap_or(false)) + .with_maximized(match cfg!(target_os = "ios") { + true => true, + false => maximized.unwrap_or(false), + }) .with_window_level(match window_level.unwrap_or_default() { egui::viewport::WindowLevel::AlwaysOnBottom => WindowLevel::AlwaysOnBottom, egui::viewport::WindowLevel::AlwaysOnTop => WindowLevel::AlwaysOnTop, @@ -1616,6 +1619,7 @@ pub fn create_winit_window_attributes( }) .with_active(active.unwrap_or(true)); + #[cfg(not(target_os = "ios"))] if let Some(size) = inner_size { window_attributes = window_attributes.with_inner_size(PhysicalSize::new( pixels_per_point * size.x, @@ -1623,6 +1627,7 @@ pub fn create_winit_window_attributes( )); } + #[cfg(not(target_os = "ios"))] if let Some(size) = min_inner_size { window_attributes = window_attributes.with_min_inner_size(PhysicalSize::new( pixels_per_point * size.x, @@ -1630,6 +1635,7 @@ pub fn create_winit_window_attributes( )); } + #[cfg(not(target_os = "ios"))] if let Some(size) = max_inner_size { window_attributes = window_attributes.with_max_inner_size(PhysicalSize::new( pixels_per_point * size.x, @@ -1637,6 +1643,7 @@ pub fn create_winit_window_attributes( )); } + #[cfg(not(target_os = "ios"))] if let Some(pos) = position { window_attributes = window_attributes.with_position(PhysicalPosition::new( pixels_per_point * pos.x, From b47367ddb027994f2e4190488b1f1110d746ffc6 Mon Sep 17 00:00:00 2001 From: frederik-uni <147479464+frederik-uni@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:54:07 +0200 Subject: [PATCH 2/2] clippy --- crates/egui-winit/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 8bf8fa0acf6..4e9e4c061d1 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1592,9 +1592,10 @@ pub fn create_winit_window_attributes( .with_decorations(decorations.unwrap_or(true)) .with_resizable(resizable.unwrap_or(true)) .with_visible(visible.unwrap_or(true)) - .with_maximized(match cfg!(target_os = "ios") { - true => true, - false => maximized.unwrap_or(false), + .with_maximized(if cfg!(target_os = "ios") { + true + } else { + maximized.unwrap_or(false) }) .with_window_level(match window_level.unwrap_or_default() { egui::viewport::WindowLevel::AlwaysOnBottom => WindowLevel::AlwaysOnBottom,