Skip to content

Commit

Permalink
Ignore viewport size/position on iOS (#4922)
Browse files Browse the repository at this point in the history
I disabled some code that changes the viewport of iOS devices. 
* [X] I have followed the instructions in the PR template
  • Loading branch information
frederik-uni committed Aug 26, 2024
1 parent ba80038 commit e9522cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,11 @@ 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(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,
egui::viewport::WindowLevel::AlwaysOnTop => WindowLevel::AlwaysOnTop,
Expand All @@ -1631,27 +1635,31 @@ 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,
pixels_per_point * size.y,
));
}

#[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,
pixels_per_point * size.y,
));
}

#[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,
pixels_per_point * size.y,
));
}

#[cfg(not(target_os = "ios"))]
if let Some(pos) = position {
window_attributes = window_attributes.with_position(PhysicalPosition::new(
pixels_per_point * pos.x,
Expand Down

0 comments on commit e9522cf

Please sign in to comment.