Various Monitor/VideoModeHandle methods now return an Option

`VideoModeHandle::refresh_rate_millihertz()` and `bit_depth()` now return a `Option<NonZero*>`.
`MonitorHandle::position()` now returns an `Option`.
On Orbital `MonitorHandle::name()` now returns `None` instead of a dummy name.
This commit is contained in:
daxpedda 2024-07-23 19:59:37 +02:00
parent 0ffcfd8a3a
commit 58142680ce
No known key found for this signature in database
GPG key ID: 43D62A3EA388E46F
15 changed files with 259 additions and 195 deletions

View file

@ -1,3 +1,4 @@
use std::num::NonZeroU16;
use std::str::FromStr;
use std::{env, str};
@ -86,7 +87,7 @@ impl XConnection {
current: mode.id == current_mode,
size: (mode.width.into(), mode.height.into()),
refresh_rate_millihertz: monitor::mode_refresh_rate_millihertz(mode),
bit_depth: bit_depth as u16,
bit_depth: NonZeroU16::new(bit_depth as u16),
native_mode: mode.id,
// This is populated in `MonitorHandle::video_modes` as the
// video mode is returned to the user