1 | use crate::monitor::{MonitorHandle as RootMonitorHandle, VideoMode as RootVideoMode}; |
2 | use crate::window::Fullscreen as RootFullscreen; |
3 | |
4 | #[cfg (windows_platform)] |
5 | #[path = "windows/mod.rs" ] |
6 | mod platform; |
7 | #[cfg (any(x11_platform, wayland_platform))] |
8 | #[path = "linux/mod.rs" ] |
9 | mod platform; |
10 | #[cfg (macos_platform)] |
11 | #[path = "macos/mod.rs" ] |
12 | mod platform; |
13 | #[cfg (android_platform)] |
14 | #[path = "android/mod.rs" ] |
15 | mod platform; |
16 | #[cfg (ios_platform)] |
17 | #[path = "ios/mod.rs" ] |
18 | mod platform; |
19 | #[cfg (wasm_platform)] |
20 | #[path = "web/mod.rs" ] |
21 | mod platform; |
22 | #[cfg (orbital_platform)] |
23 | #[path = "orbital/mod.rs" ] |
24 | mod platform; |
25 | |
26 | pub use self::platform::*; |
27 | |
28 | /// Helper for converting between platform-specific and generic VideoMode/MonitorHandle |
29 | #[derive (Clone, Debug, PartialEq, Eq)] |
30 | pub(crate) enum Fullscreen { |
31 | Exclusive(VideoMode), |
32 | Borderless(Option<MonitorHandle>), |
33 | } |
34 | |
35 | impl From<RootFullscreen> for Fullscreen { |
36 | fn from(f: RootFullscreen) -> Self { |
37 | match f { |
38 | RootFullscreen::Exclusive(mode: VideoMode) => Self::Exclusive(mode.video_mode), |
39 | RootFullscreen::Borderless(Some(handle: MonitorHandle)) => Self::Borderless(Some(handle.inner)), |
40 | RootFullscreen::Borderless(None) => Self::Borderless(None), |
41 | } |
42 | } |
43 | } |
44 | |
45 | impl From<Fullscreen> for RootFullscreen { |
46 | fn from(f: Fullscreen) -> Self { |
47 | match f { |
48 | Fullscreen::Exclusive(video_mode: VideoMode) => Self::Exclusive(RootVideoMode { video_mode }), |
49 | Fullscreen::Borderless(Some(inner: MonitorHandle)) => { |
50 | Self::Borderless(Some(RootMonitorHandle { inner })) |
51 | } |
52 | Fullscreen::Borderless(None) => Self::Borderless(None), |
53 | } |
54 | } |
55 | } |
56 | |
57 | #[cfg (all( |
58 | not(ios_platform), |
59 | not(windows_platform), |
60 | not(macos_platform), |
61 | not(android_platform), |
62 | not(x11_platform), |
63 | not(wayland_platform), |
64 | not(wasm_platform), |
65 | not(orbital_platform), |
66 | ))] |
67 | compile_error!("The platform you're compiling for is not supported by winit" ); |
68 | |