WlcOutput

Struct WlcOutput 

Source
#[repr(C)]
pub struct WlcOutput(pub uintptr_t);
Expand description

Represents a handle to a wlc output.

Tuple Fields§

§0: uintptr_t

Implementations§

Source§

impl WlcOutput

Source

pub fn as_view(self) -> WlcView

Compatability/debugging function.

wlc internally stores views and outputs under the same type. If for some reason a conversion between the two was required, this function could be called. If this is the case please submit a bug report.

Source

pub fn is_null(self) -> bool

Determines if this is a null a output (invalid).

Source

pub fn dummy(code: u32) -> WlcOutput

Create a dummy WlcOutput for testing purposes.

§Unsafety

The following operations on a dummy WlcOutput will cause crashes:

  • WlcOutput::focused when wlc is not running
  • WlcOutput::list when wlc is not running
  • WlcOutput::set_resolution on a dummy output

In addition, WlcOutput::set_views will return an error.

All other methods can be used on dummy outputs.

§Example
let output = WlcOutput::dummy(0u32);
let output2 = WlcOutput::dummy(1u32);
assert!(output < output2);
assert!(output != output2);
Source

pub unsafe fn get_user_data<T>(&self) -> &mut T

Gets user-specified data.

§Unsafety

The wlc implementation of this method uses void* pointers for raw C data. This function will internaly do a conversion between the input T and a libc::c_void.

This is a highly unsafe conversion with no guarantees. As such, usage of these functions requires an understanding of what data they will have. Please review wlc’s usage of these functions before attempting to use them yourself.

Source

pub unsafe fn set_user_data<T>(&self, data: &T)

Sets user-specified data.

§Unsafety

The wlc implementation of this method uses void* pointers for raw C data. This function will internaly do a conversion between the input T and a libc::c_void.

This is a highly unsafe conversion with no guarantees. As such, usage of these functions requires an understanding of what data they will have. Please review wlc’s usage of these functions before attempting to use them yourself.

Source

pub fn schedule_render(&self)

Schedules output for rendering next frame.

If the output was already scheduled, this is a no-op; if output is currently rendering, it will render immediately after.

Source

pub fn list() -> Vec<WlcOutput>

Gets a list of the current outputs.

§Safety

This function will crash the program if run when wlc is not running.

Source

pub fn focused() -> WlcOutput

Gets the currently focused output.

§Safety

This function will crash the program if run when wlc is not running.

Source

pub fn get_name(&self) -> String

Gets the name of the WlcOutput.

Names are usually assigned in the format WLC-n, where the first output is WLC-1.

Source

pub fn get_sleep(&self) -> bool

Gets the sleep status of the output.

Returns true if the monitor is sleeping, such as having been set with set_sleep.

Source

pub fn set_sleep(&self, sleep: bool)

Sets the sleep status of the output.

Source

pub fn get_resolution(&self) -> Option<Size>

Gets the output resolution in pixels.

Source

pub fn set_resolution(&self, size: Size, scaling: u32)

Sets the resolution of the output.

§Safety

This method will crash the program if use when wlc is not running.

Source

pub fn get_views(&self) -> Vec<WlcView>

Get views in stack order.

This is mainly useful for wm’s who need another view stack for inplace sorting. For example tiling wms, may want to use this to keep their tiling order separated from floating order. This handles wlc_output_get_views and wlc_output_get_mutable_views.

Source

pub fn get_mask(&self) -> u32

Gets the mask of this output

Source

pub fn set_mask(&self, mask: u32)

Sets the mask for this output

Source

pub fn get_mutable_views(&self) -> Vec<WlcView>

§Deprecated

This function is equivalent to simply calling get_views

Source

pub fn set_views(&self, views: &mut Vec<WlcView>) -> Result<(), &'static str>

Attempts to set the views of a given output.

Returns success if operation succeeded. An error will be returned if something went wrong or if wlc isn’t running.

Source

pub fn focus(output: Option<WlcOutput>)

Focuses compositor on a specific output.

Pass in Option::None for no focus.

Trait Implementations§

Source§

impl Clone for WlcOutput

Source§

fn clone(&self) -> WlcOutput

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WlcOutput

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<WlcOutput> for WlcView

Source§

fn from(output: WlcOutput) -> Self

Converts to this type from the input type.
Source§

impl From<WlcView> for WlcOutput

Source§

fn from(view: WlcView) -> Self

Converts to this type from the input type.
Source§

impl Hash for WlcOutput

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for WlcOutput

Source§

fn cmp(&self, other: &WlcOutput) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for WlcOutput

Source§

fn eq(&self, other: &WlcOutput) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for WlcOutput

Source§

fn partial_cmp(&self, other: &WlcOutput) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for WlcOutput

Source§

impl Eq for WlcOutput

Source§

impl StructuralPartialEq for WlcOutput

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.