Trait breadx::display::DisplayBase
source · [−]pub trait DisplayBase {
fn setup(&self) -> &Arc<Setup>;
fn default_screen_index(&self) -> usize;
fn poll_for_reply_raw(&mut self, seq: u64) -> Result<Option<RawReply>>;
fn poll_for_event(&mut self) -> Result<Option<Event>>;
fn screens(&self) -> &[Screen] { ... }
fn default_screen(&self) -> &Screen { ... }
}
Expand description
An interface to the X11 server, containing functionality that is neither inherently synchronous nor asynchronous.
This trait is the supertrait for both Display
and AsyncDisplay
.
It only contains functions for retrieving the setup information and
for polling the server in a non-blocking manner.
These functions should be used if, for instance, you want to fetch an
event, but if it is not available you need to do something else instead.
In addition, Setup
information is useful for determining screen
parameters, among other things.
Required Methods
fn default_screen_index(&self) -> usize
fn default_screen_index(&self) -> usize
Get the screen associated with this display.
At startup time, the default screen to use in the process is determined by the user. This is the index of that screen.
Poll to see if a reply matching the sequence number has been received.
This checks the reply map to see if a reply has been received for the given sequence number. If it has, it returns the reply. Otherwise, it tries to fetch it from the server.
Blocking
This function should never block. Non-blocking I/O should be used to
fetch the reply, and None
should be returned if the call would
block.
fn poll_for_event(&mut self) -> Result<Option<Event>>
fn poll_for_event(&mut self) -> Result<Option<Event>>
Poll to see if we have received an event.
This checks the event queue to see if an event has been received. If it has, it returns the event. Otherwise, it tries to fetch it from the server.
Blocking
This function should never block. Non-blocking I/O should be used to
fetch the event, and None
should be returned if the call would
block.
Provided Methods
Get the screens for this display.
This is equivalent to self.setup().roots
, but is marginally
more convenient.
fn default_screen(&self) -> &Screen
fn default_screen(&self) -> &Screen
Get the default screen for this display.
This is equivalent to self.setup().roots[self.default_screen_index()]
.