winit-core: move monitor handle

This commit is contained in:
Kirill Chibisov 2025-05-01 19:35:04 +09:00
parent 3493a20173
commit 3142355417
10 changed files with 43 additions and 32 deletions

View file

@ -83,9 +83,9 @@ impl Eq for MonitorHandle {}
/// Convert the wayland's [`Mode`] to winit's [`VideoMode`].
fn wayland_mode_to_core_mode(mode: Mode) -> VideoMode {
VideoMode {
size: (mode.dimensions.0, mode.dimensions.1).into(),
bit_depth: None,
refresh_rate_millihertz: NonZeroU32::new(mode.refresh_rate as u32),
}
VideoMode::new(
(mode.dimensions.0, mode.dimensions.1).into(),
None,
NonZeroU32::new(mode.refresh_rate as u32),
)
}

View file

@ -85,11 +85,11 @@ impl XConnection {
.filter(|x| output_modes.iter().any(|id| x.id == *id))
.map(|mode| VideoModeHandle {
current: mode.id == current_mode,
mode: VideoMode {
size: (mode.width as u32, mode.height as u32).into(),
refresh_rate_millihertz: monitor::mode_refresh_rate_millihertz(mode),
bit_depth: NonZeroU16::new(bit_depth as u16),
},
mode: VideoMode::new(
(mode.width as u32, mode.height as u32).into(),
NonZeroU16::new(bit_depth as u16),
monitor::mode_refresh_rate_millihertz(mode),
),
native_mode: mode.id,
})
.collect();