mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 21:23:05 +00:00
Support prefers_home_indicator_hidden (#16005)
# Objective - Fixes #15757 ## Solution - Add the platform specific property `prefers_home_indicator_hidden` to bevy's Window configuration, and applying it by invoking `with_prefers_home_indicator_hidden` in `winit`. ## Testing - I have tested the `bevy_mobile_example` on the iOS platform. ## Showcase - Currently, the `prefers_home_indicator_hidden` is enabled in the bevy_mobile_example demo. You can test it with an iOS device. The home indicator will disappear after several seconds of inactivity in the bottom areas. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
parent
88d1692105
commit
db4a74be76
3 changed files with 20 additions and 0 deletions
|
@ -388,6 +388,16 @@ pub struct Window {
|
|||
///
|
||||
/// [`WindowAttributesExtMacOS::with_titlebar_buttons_hidden`]: https://docs.rs/winit/latest/x86_64-apple-darwin/winit/platform/macos/trait.WindowAttributesExtMacOS.html#tymethod.with_titlebar_buttons_hidden
|
||||
pub titlebar_show_buttons: bool,
|
||||
/// Sets whether the Window prefers the home indicator hidden.
|
||||
///
|
||||
/// Corresponds to [`WindowAttributesExtIOS::with_prefers_home_indicator_hidden`].
|
||||
///
|
||||
/// # Platform-specific
|
||||
///
|
||||
/// - Only used on iOS.
|
||||
///
|
||||
/// [`WindowAttributesExtIOS::with_prefers_home_indicator_hidden`]: https://docs.rs/winit/latest/x86_64-apple-darwin/winit/platform/ios/trait.WindowAttributesExtIOS.html#tymethod.with_prefers_home_indicator_hidden
|
||||
pub prefers_home_indicator_hidden: bool,
|
||||
}
|
||||
|
||||
impl Default for Window {
|
||||
|
@ -429,6 +439,7 @@ impl Default for Window {
|
|||
titlebar_transparent: false,
|
||||
titlebar_show_title: true,
|
||||
titlebar_show_buttons: true,
|
||||
prefers_home_indicator_hidden: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,6 +140,13 @@ impl WinitWindows {
|
|||
.with_titlebar_buttons_hidden(!window.titlebar_show_buttons);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
{
|
||||
use winit::platform::ios::WindowAttributesExtIOS;
|
||||
winit_window_attributes = winit_window_attributes
|
||||
.with_prefers_home_indicator_hidden(window.prefers_home_indicator_hidden);
|
||||
}
|
||||
|
||||
let display_info = DisplayInfo {
|
||||
window_physical_resolution: (
|
||||
window.resolution.physical_width(),
|
||||
|
|
|
@ -27,6 +27,8 @@ fn main() {
|
|||
// on iOS, gestures must be enabled.
|
||||
// This doesn't work on Android
|
||||
recognize_rotation_gesture: true,
|
||||
// Only has an effect on iOS
|
||||
prefers_home_indicator_hidden: true,
|
||||
..default()
|
||||
}),
|
||||
..default()
|
||||
|
|
Loading…
Reference in a new issue