Struct ScreenResources

Source
pub struct ScreenResources {
    pub timestamp: XTime,
    pub config_timestamp: XTime,
    pub ncrtc: i32,
    pub outputs: Vec<XId>,
    pub nmode: i32,
    pub modes: Vec<Mode>,
    /* private fields */
}

Fields§

§timestamp: XTime§config_timestamp: XTime§ncrtc: i32§outputs: Vec<XId>§nmode: i32§modes: Vec<Mode>

Implementations§

Source§

impl ScreenResources

Source

pub fn new(handle: &mut XHandle) -> Result<ScreenResources, XrandrError>

Create a handle to the XRRScreenResources object from libxrandr. This handle is used to query many parts of the current x11 config.

§Errors
  • XrandrError::GetResources - Getting the handle failed.
§Examples
let xhandle = XHandle.open()?;
let res = ScreenResources::new(&mut xhandle)?;
let crtc_87 = res.crtc(&mut xhandle, 87);
Source

pub fn outputs(&self, handle: &mut XHandle) -> Result<Vec<Output>, XrandrError>

Gets information on all outputs

§Errors
  • XrandrError::GetOutputInfo(xid) – Getting info failed for output xid
§Examples
let res = ScreenResources::new(&mut xhandle)?;
let outputs = res.outputs(&mut xhandle);
Source

pub fn output( &self, handle: &mut XHandle, xid: XId, ) -> Result<Output, XrandrError>

Gets information on output with given xid

§Errors
  • XrandrError::GetOutputInfo(xid) – Getting info failed for output with XID xid
§Examples
let res = ScreenResources::new(&mut xhandle)?;
let output_89 = res.output(&mut xhandle, 89);
Source

pub fn crtcs(&self, handle: &mut XHandle) -> Result<Vec<Crtc>, XrandrError>

Gets information on all crtcs

§Errors
  • XrandrError::GetCrtcInfo(xid) – Getting info failed for crtc with XID xid
§Examples
let res = ScreenResources::new(&mut xhandle)?;
let crtcs = res.crtcs(&mut xhandle);
Source

pub fn enabled_crtcs( &self, handle: &mut XHandle, ) -> Result<Vec<Crtc>, XrandrError>

Gets information of only the enabled crtcs See also: self.crtcs()

§Errors
  • XrandrError::GetCrtcInfo(xid) – Getting info failed for crtc with XID xid
Source

pub fn crtc(&self, handle: &mut XHandle, xid: XId) -> Result<Crtc, XrandrError>

Gets information on crtc with given xid

§Errors
  • XrandrError::GetCrtcInfo(xid) – Getting info failed for crtc with XID xid
§Examples
let res = ScreenResources::new(&mut xhandle)?;
let current_crtc = res.crtc(&mut xhandle, output.crtc);
Source

pub fn modes(&self) -> Vec<Mode>

Gets information on all crtcs

§Errors
  • XrandrError::GetCrtcInfo(xid) – Getting info failed for crtc with XID xid
§Examples
let res = ScreenResources::new(&mut xhandle)?;
let crtcs = res.crtcs(&mut xhandle);
Source

pub fn mode(&self, xid: XId) -> Result<Mode, XrandrError>

Gets information on mode with given xid

§Errors
  • XrandrError::GetModeInfo(xid) – Getting info failed for mode with XID xid
§Examples
let res = ScreenResources::new(&mut xhandle)?;
let current_mode = res.mode(&mut xhandle, output.mode);

Trait Implementations§

Source§

impl Debug for ScreenResources

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.