Skip to main content

Screen

Struct Screen 

Source
pub struct Screen {
    pub(super) conn: RustConnection,
    pub(super) root: u32,
    w: AtomicU16,
    h: AtomicU16,
    resized: AtomicBool,
    pub opened: Arc<AtomicUsize>,
}

Fields§

§conn: RustConnection§root: u32§w: AtomicU16

The screen’s size now: it changes when the screen is resized (resize, or another connection’s, which follow_size hears of).

§h: AtomicU16§resized: AtomicBool

Set when the screen’s size changed under this connection; read (and cleared) by take_resized.

§opened: Arc<AtomicUsize>

How many windows have opened (after the browser’s first), counted by the thread that watches the screen’s windows. Text being typed stops when it changes, so what is left of a paste does not go to a window the person has not seen.

Implementations§

Source§

impl Screen

Source

fn atom(&self, name: &str) -> Result<Atom, String>

Source

fn clients(&self) -> Result<Vec<u32>, String>

The windows the window manager manages (its _NET_CLIENT_LIST); none when there is no window manager or it has none yet.

Source

fn is_maximized(&self, window: u32) -> Result<bool, String>

Source

fn maximize(&self, window: u32, on: bool) -> Result<(), String>

Ask the window manager to make window maximised (or not): the message a pager or a maximise button sends to the root window.

Source

pub fn maximize_first_within(&self, wait: Duration) -> Result<(), String>

Make the browser’s window fill the screen: the biggest window the window manager manages, once there is one (waits up to wait). It stays maximised, and follows the screen’s size (refit).

Source

pub fn refit(&self) -> Result<(), String>

After the screen changed size: every window that is maximised is made so again, so the window manager fits it to the new screen. A window that is not maximised (a pop-up) keeps its size.

Source§

impl Screen

Source

pub fn resize(&self, w: u16, h: u16) -> Result<(), String>

Make the screen w by h (cut to what a screen can be). The windows on it follow if the window manager lets a maximised window follow.

Source

fn set_screen(&self, w: u16, h: u16) -> Result<(), String>

Source

fn make_mode(&self, w: u16, h: u16) -> Result<u32, String>

Source§

impl Screen

Source

pub fn connect(display: &str) -> Result<Self, String>

Connect to display display (:12).

Source

pub fn size(&self) -> (u16, u16)

The screen’s width and height now.

Source

pub(super) fn set_size(&self, w: u16, h: u16)

Source

pub fn follow_size(&self) -> Result<(), String>

Ask for the screen’s own events (its size changing), so a resize made by another connection is known here. Needed by whoever reads the screen.

Source

pub fn refresh_size(&self) -> bool

Read the screen’s size from the screen itself (a read of it failed: it may have changed size under this connection). True when it differs.

Source

pub fn take_resized(&self) -> bool

True once if the screen changed size since the last call.

Source

pub fn grab(&self) -> Result<Vec<u8>, String>

The whole screen: four bytes a pixel (blue, green, red, one unused), row after row.

Source

pub fn grab_rect(&self, at: Rect) -> Result<Vec<u8>, String>

A part of the screen, as grab gives the whole of it.

Source

pub fn watch_damage(&self) -> Result<u32, String>

Ask the screen to say which part of it changed (the damage extension), so the screen is read when it changed and only where. The answer is the damage’s id, for clear_damage.

Source

pub fn wait_damage(&self) -> Result<Option<Rect>, String>

Wait until some part of the screen changes, and say which part (cut to the screen); none when the screen changed size (see take_resized: all of it is new). An error when the screen has gone.

Source

pub fn take_damage(&self) -> Result<Option<Rect>, String>

The parts that changed since the last look, as one rectangle that holds them all; none when nothing did.

Source

pub fn clear_damage(&self, id: u32) -> Result<(), String>

Tell the screen the changes so far are taken in (it forgets the region it has kept for them).

Source

fn damaged(&self, event: &Event) -> Option<Rect>

Source

pub fn visible_windows(&self) -> Result<usize, String>

How many top-level windows a person would see: shown, not a menu or tooltip (override-redirect), and bigger than 100 by 100.

Source

pub fn follow_windows(&self) -> Result<(), String>

Ask the screen to say when a top-level window is mapped, unmapped or destroyed (events on the root window), so a window opening is known at the moment it opens and not at the next look.

Source

pub fn next_window_event(&self) -> Result<(), String>

Wait for the next event about a top-level window (after follow_windows). An error when the screen has gone.

Source

fn fake(&self, kind: u8, detail: u8, x: i16, y: i16) -> Result<(), String>

Source

pub fn move_to(&self, x: f64, y: f64) -> Result<(), String>

Source

pub fn button(&self, button: u8, down: bool) -> Result<(), String>

Button 1 left, 2 middle, 3 right, 4 and 5 wheel up and down, 6 and 7 wheel left and right.

Source

pub fn key(&self, keycode: u8, down: bool) -> Result<(), String>

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more