config: allow retrieving the modes
This commit is contained in:
parent
2ab7b43f74
commit
558bea47b7
8 changed files with 73 additions and 3 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue