api: make VideoModeHandle into VideoMode

The video mode is generally a static data and not a reference to some
video mode. This changes the exclusive fullscreen API to match that an
accept a monitor now.
This commit is contained in:
Kirill Chibisov
2025-01-02 03:29:42 +03:00
committed by GitHub
parent 5462f27dda
commit ee245c569d
28 changed files with 247 additions and 475 deletions

View File

@@ -1,4 +1,4 @@
use crate::monitor::{MonitorHandle as RootMonitorHandle, VideoModeHandle as RootVideoModeHandle};
use crate::monitor::{MonitorHandle as RootMonitorHandle, VideoMode};
use crate::window::Fullscreen as RootFullscreen;
#[cfg(android_platform)]
@@ -30,17 +30,19 @@ use self::web as platform;
use self::windows as platform;
/// Helper for converting between platform-specific and generic
/// [`VideoModeHandle`]/[`MonitorHandle`]
/// [`VideoMode`]/[`MonitorHandle`]
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) enum Fullscreen {
Exclusive(VideoModeHandle),
Exclusive(MonitorHandle, VideoMode),
Borderless(Option<MonitorHandle>),
}
impl From<RootFullscreen> for Fullscreen {
fn from(f: RootFullscreen) -> Self {
match f {
RootFullscreen::Exclusive(mode) => Self::Exclusive(mode.video_mode),
RootFullscreen::Exclusive(handle, video_mode) => {
Self::Exclusive(handle.inner, video_mode)
},
RootFullscreen::Borderless(Some(handle)) => Self::Borderless(Some(handle.inner)),
RootFullscreen::Borderless(None) => Self::Borderless(None),
}
@@ -50,8 +52,8 @@ impl From<RootFullscreen> for Fullscreen {
impl From<Fullscreen> for RootFullscreen {
fn from(f: Fullscreen) -> Self {
match f {
Fullscreen::Exclusive(video_mode) => {
Self::Exclusive(RootVideoModeHandle { video_mode })
Fullscreen::Exclusive(inner, video_mode) => {
Self::Exclusive(RootMonitorHandle { inner }, video_mode)
},
Fullscreen::Borderless(Some(inner)) => {
Self::Borderless(Some(RootMonitorHandle { inner }))