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: AtomicU16The screen’s size now: it changes when the screen is resized (resize, or another connection’s, which follow_size hears of).
h: AtomicU16§resized: AtomicBoolSet 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
impl Screen
fn atom(&self, name: &str) -> Result<Atom, String>
Sourcefn clients(&self) -> Result<Vec<u32>, String>
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.
fn is_maximized(&self, window: u32) -> Result<bool, String>
Sourcefn maximize(&self, window: u32, on: bool) -> Result<(), String>
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§impl Screen
impl Screen
Sourcepub fn resize(&self, w: u16, h: u16) -> Result<(), String>
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.
fn set_screen(&self, w: u16, h: u16) -> Result<(), String>
fn make_mode(&self, w: u16, h: u16) -> Result<u32, String>
Source§impl Screen
impl Screen
pub(super) fn set_size(&self, w: u16, h: u16)
Sourcepub fn follow_size(&self) -> Result<(), String>
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.
Sourcepub fn refresh_size(&self) -> bool
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.
Sourcepub fn take_resized(&self) -> bool
pub fn take_resized(&self) -> bool
True once if the screen changed size since the last call.
Sourcepub fn grab(&self) -> Result<Vec<u8>, String>
pub fn grab(&self) -> Result<Vec<u8>, String>
The whole screen: four bytes a pixel (blue, green, red, one unused), row after row.
Sourcepub fn grab_rect(&self, at: Rect) -> Result<Vec<u8>, String>
pub fn grab_rect(&self, at: Rect) -> Result<Vec<u8>, String>
A part of the screen, as grab gives the whole of it.
Sourcepub fn watch_damage(&self) -> Result<u32, String>
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.
Sourcepub fn wait_damage(&self) -> Result<Option<Rect>, String>
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.
Sourcepub fn take_damage(&self) -> Result<Option<Rect>, String>
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.
Sourcepub fn clear_damage(&self, id: u32) -> Result<(), String>
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).
fn damaged(&self, event: &Event) -> Option<Rect>
Sourcepub fn visible_windows(&self) -> Result<usize, String>
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.
Sourcepub fn follow_windows(&self) -> Result<(), String>
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.
Sourcepub fn next_window_event(&self) -> Result<(), String>
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.
fn fake(&self, kind: u8, detail: u8, x: i16, y: i16) -> Result<(), String>
pub fn move_to(&self, x: f64, y: f64) -> Result<(), String>
Button 1 left, 2 middle, 3 right, 4 and 5 wheel up and down, 6 and 7 wheel left and right.
pub fn key(&self, keycode: u8, down: bool) -> Result<(), String>
Auto Trait Implementations§
impl !Freeze for Screen
impl RefUnwindSafe for Screen
impl Send for Screen
impl Sync for Screen
impl Unpin for Screen
impl UnsafeUnpin for Screen
impl UnwindSafe for Screen
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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