Rename VideoMode to VideoModeHandle (#3328)
This commit is contained in:
parent
34e42ff94d
commit
658f49b014
23 changed files with 111 additions and 104 deletions
|
|
@ -12,7 +12,7 @@ mod window;
|
|||
mod xdisplay;
|
||||
|
||||
pub(crate) use self::{
|
||||
monitor::{MonitorHandle, VideoMode},
|
||||
monitor::{MonitorHandle, VideoModeHandle},
|
||||
window::UnownedWindow,
|
||||
xdisplay::XConnection,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use super::{util, X11Error, XConnection};
|
||||
use crate::{
|
||||
dpi::{PhysicalPosition, PhysicalSize},
|
||||
platform_impl::VideoMode as PlatformVideoMode,
|
||||
platform_impl::VideoModeHandle as PlatformVideoModeHandle,
|
||||
};
|
||||
use x11rb::{
|
||||
connection::RequestConnection,
|
||||
|
|
@ -22,7 +22,7 @@ impl XConnection {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct VideoMode {
|
||||
pub struct VideoModeHandle {
|
||||
pub(crate) size: (u32, u32),
|
||||
pub(crate) bit_depth: u16,
|
||||
pub(crate) refresh_rate_millihertz: u32,
|
||||
|
|
@ -30,7 +30,7 @@ pub struct VideoMode {
|
|||
pub(crate) monitor: Option<MonitorHandle>,
|
||||
}
|
||||
|
||||
impl VideoMode {
|
||||
impl VideoModeHandle {
|
||||
#[inline]
|
||||
pub fn size(&self) -> PhysicalSize<u32> {
|
||||
self.size.into()
|
||||
|
|
@ -71,7 +71,7 @@ pub struct MonitorHandle {
|
|||
/// Used to determine which windows are on this monitor
|
||||
pub(crate) rect: util::AaRect,
|
||||
/// Supported video modes on this monitor
|
||||
video_modes: Vec<VideoMode>,
|
||||
video_modes: Vec<VideoModeHandle>,
|
||||
}
|
||||
|
||||
impl PartialEq for MonitorHandle {
|
||||
|
|
@ -191,11 +191,11 @@ impl MonitorHandle {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn video_modes(&self) -> impl Iterator<Item = PlatformVideoMode> {
|
||||
pub fn video_modes(&self) -> impl Iterator<Item = PlatformVideoModeHandle> {
|
||||
let monitor = self.clone();
|
||||
self.video_modes.clone().into_iter().map(move |mut x| {
|
||||
x.monitor = Some(monitor.clone());
|
||||
PlatformVideoMode::X(x)
|
||||
PlatformVideoModeHandle::X(x)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{env, str, str::FromStr};
|
|||
|
||||
use super::*;
|
||||
use crate::platform_impl::platform::x11::monitor;
|
||||
use crate::{dpi::validate_scale_factor, platform_impl::platform::x11::VideoMode};
|
||||
use crate::{dpi::validate_scale_factor, platform_impl::platform::x11::VideoModeHandle};
|
||||
|
||||
use log::warn;
|
||||
use x11rb::protocol::randr::{self, ConnectionExt as _};
|
||||
|
|
@ -46,7 +46,7 @@ impl XConnection {
|
|||
&self,
|
||||
resources: &monitor::ScreenResources,
|
||||
crtc: &randr::GetCrtcInfoReply,
|
||||
) -> Option<(String, f64, Vec<VideoMode>)> {
|
||||
) -> Option<(String, f64, Vec<VideoModeHandle>)> {
|
||||
let output_info = match self
|
||||
.xcb_connection()
|
||||
.randr_get_output_info(crtc.outputs[0], x11rb::CURRENT_TIME)
|
||||
|
|
@ -70,7 +70,7 @@ impl XConnection {
|
|||
// modes in the array in XRRScreenResources
|
||||
.filter(|x| output_modes.iter().any(|id| x.id == *id))
|
||||
.map(|mode| {
|
||||
VideoMode {
|
||||
VideoModeHandle {
|
||||
size: (mode.width.into(), mode.height.into()),
|
||||
refresh_rate_millihertz: monitor::mode_refresh_rate_millihertz(mode)
|
||||
.unwrap_or(0),
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ use crate::{
|
|||
X11Error,
|
||||
},
|
||||
Fullscreen, MonitorHandle as PlatformMonitorHandle, OsError, PlatformIcon,
|
||||
PlatformSpecificWindowBuilderAttributes, VideoMode as PlatformVideoMode,
|
||||
PlatformSpecificWindowBuilderAttributes, VideoModeHandle as PlatformVideoModeHandle,
|
||||
},
|
||||
window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, WindowAttributes,
|
||||
|
|
@ -754,10 +754,10 @@ impl UnownedWindow {
|
|||
// fullscreen, so we can restore it upon exit, as XRandR does not
|
||||
// provide a mechanism to set this per app-session or restore this
|
||||
// to the desktop video mode as macOS and Windows do
|
||||
(&None, &Some(Fullscreen::Exclusive(PlatformVideoMode::X(ref video_mode))))
|
||||
(&None, &Some(Fullscreen::Exclusive(PlatformVideoModeHandle::X(ref video_mode))))
|
||||
| (
|
||||
&Some(Fullscreen::Borderless(_)),
|
||||
&Some(Fullscreen::Exclusive(PlatformVideoMode::X(ref video_mode))),
|
||||
&Some(Fullscreen::Exclusive(PlatformVideoModeHandle::X(ref video_mode))),
|
||||
) => {
|
||||
let monitor = video_mode.monitor.as_ref().unwrap();
|
||||
shared_state_lock.desktop_video_mode = Some((
|
||||
|
|
@ -793,7 +793,7 @@ impl UnownedWindow {
|
|||
}
|
||||
Some(fullscreen) => {
|
||||
let (video_mode, monitor) = match fullscreen {
|
||||
Fullscreen::Exclusive(PlatformVideoMode::X(ref video_mode)) => {
|
||||
Fullscreen::Exclusive(PlatformVideoModeHandle::X(ref video_mode)) => {
|
||||
(Some(video_mode), video_mode.monitor.clone().unwrap())
|
||||
}
|
||||
Fullscreen::Borderless(Some(PlatformMonitorHandle::X(monitor))) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue