1
0
Fork 0
forked from wry/wry

config: allow retrieving the modes

This commit is contained in:
Julian Orth 2024-03-04 16:09:53 +01:00
parent 2ab7b43f74
commit 558bea47b7
8 changed files with 73 additions and 3 deletions

View file

@ -21,7 +21,7 @@ use {
/// - width in pixels
/// - height in pixels
/// - refresh rate in mhz.
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)]
pub struct Mode {
pub(crate) width: i32,
pub(crate) height: i32,
@ -112,6 +112,14 @@ impl Connector {
get!(Mode::zeroed()).connector_mode(self)
}
/// Returns the available modes of the connector.
pub fn modes(self) -> Vec<Mode> {
if !self.exists() {
return Vec::new();
}
get!(Vec::new()).connector_modes(self)
}
/// Returns the logical width of the connector.
///
/// The returned value will be different from `mode().width()` if the scale is not 1.