Add PlatformSpecific winit settings for macOS
This commit is contained in:
parent
a7c40665fe
commit
bbe5fe9d71
3 changed files with 32 additions and 6 deletions
|
|
@ -2,10 +2,12 @@
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
#[path = "settings/windows.rs"]
|
#[path = "settings/windows.rs"]
|
||||||
mod platform;
|
mod platform;
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(target_os = "macos")]
|
||||||
#[path = "settings/not_windows.rs"]
|
#[path = "settings/macos.rs"]
|
||||||
|
mod platform;
|
||||||
|
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
|
||||||
|
#[path = "settings/other.rs"]
|
||||||
mod platform;
|
mod platform;
|
||||||
|
|
||||||
pub use platform::PlatformSpecific;
|
pub use platform::PlatformSpecific;
|
||||||
|
|
||||||
use crate::conversion;
|
use crate::conversion;
|
||||||
|
|
@ -137,6 +139,20 @@ impl Window {
|
||||||
.with_drag_and_drop(self.platform_specific.drag_and_drop);
|
.with_drag_and_drop(self.platform_specific.drag_and_drop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
use winit::platform::macos::WindowBuilderExtMacOS;
|
||||||
|
|
||||||
|
window_builder = window_builder
|
||||||
|
.with_title_hidden(self.platform_specific.title_hidden)
|
||||||
|
.with_titlebar_transparent(
|
||||||
|
self.platform_specific.titlebar_transparent,
|
||||||
|
)
|
||||||
|
.with_fullsize_content_view(
|
||||||
|
self.platform_specific.fullsize_content_view,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
window_builder = window_builder
|
window_builder = window_builder
|
||||||
.with_fullscreen(conversion::fullscreen(primary_monitor, mode));
|
.with_fullscreen(conversion::fullscreen(primary_monitor, mode));
|
||||||
|
|
||||||
|
|
|
||||||
13
winit/src/settings/macos.rs
Normal file
13
winit/src/settings/macos.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#![cfg(target_os = "macos")]
|
||||||
|
//! Platform specific settings for macOS.
|
||||||
|
|
||||||
|
/// The platform specific window settings of an application.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||||
|
pub struct PlatformSpecific {
|
||||||
|
/// Hides the window title.
|
||||||
|
pub title_hidden: bool,
|
||||||
|
/// Makes the titlebar transparent and allows the content to appear behind it.
|
||||||
|
pub titlebar_transparent: bool,
|
||||||
|
/// Makes the window content appear behind the titlebar.
|
||||||
|
pub fullsize_content_view: bool,
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
#![cfg(not(target_os = "windows"))]
|
|
||||||
//! Platform specific settings for not Windows.
|
|
||||||
|
|
||||||
/// The platform specific window settings of an application.
|
/// The platform specific window settings of an application.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub struct PlatformSpecific {}
|
pub struct PlatformSpecific {}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue