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

@ -4,6 +4,7 @@
compile_error!("Please select a feature to build for unix: `x11`, `wayland`");
use std::collections::VecDeque;
use std::num::{NonZeroU16, NonZeroU32};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
use std::sync::Arc;
use std::time::Duration;
@ -242,7 +243,7 @@ impl MonitorHandle {
}
#[inline]
pub fn position(&self) -> PhysicalPosition<i32> {
pub fn position(&self) -> Option<PhysicalPosition<i32>> {
x11_or_wayland!(match self; MonitorHandle(m) => m.position())
}
@ -277,12 +278,12 @@ impl VideoModeHandle {
}
#[inline]
pub fn bit_depth(&self) -> u16 {
pub fn bit_depth(&self) -> Option<NonZeroU16> {
x11_or_wayland!(match self; VideoModeHandle(m) => m.bit_depth())
}
#[inline]
pub fn refresh_rate_millihertz(&self) -> Option<u32> {
pub fn refresh_rate_millihertz(&self) -> Option<NonZeroU32> {
x11_or_wayland!(match self; VideoModeHandle(m) => m.refresh_rate_millihertz())
}