pub trait Display: DisplayBase {
fn send_request_raw(&mut self, req: RawRequest<'_, '_>) -> Result<u64>;
fn wait_for_reply_raw(&mut self, seq: u64) -> Result<RawReply>;
fn wait_for_event(&mut self) -> Result<Event>;
fn maximum_request_length(&mut self) -> Result<usize>;
fn generate_xid(&mut self) -> Result<u32>;
fn check_for_error(&mut self, seq: u64) -> Result<()>;
fn flush(&mut self) -> Result<()>;
fn synchronize(&mut self) -> Result<()> { ... }
}
Expand description
A blocking interface to the X11 server.
This interface can be used to do everything that DisplayBase
can do, but it is also capable of blocking on I/O. This allows it
to send requests, receive replies/events, among other things.
Objects of this type should never be put into non-blocking mode.
Required Methods
fn send_request_raw(&mut self, req: RawRequest<'_, '_>) -> Result<u64>
fn send_request_raw(&mut self, req: RawRequest<'_, '_>) -> Result<u64>
Send a raw request to the X11 server.
This function formats req
, sends it to the server, and returns
the sequence number associated with that request.
Blocking
This function should block until the request has been sent to the server.
fn wait_for_reply_raw(&mut self, seq: u64) -> Result<RawReply>
fn wait_for_reply_raw(&mut self, seq: u64) -> Result<RawReply>
Wait for a reply from the X11 server.
This function waits for a reply to the given sequence number.
Note that if the request has no reply, this function will likely hang forever.
Blocking
This function should block until a reply is received from the server.
fn wait_for_event(&mut self) -> Result<Event>
fn wait_for_event(&mut self) -> Result<Event>
Wait for an event.
This function waits for an event to be received from the server.
Blocking
This function should block until an event is received from the server.
fn maximum_request_length(&mut self) -> Result<usize>
fn maximum_request_length(&mut self) -> Result<usize>
Get the maximum request length that can be sent.
Returned in units of 4 bytes.
Blocking
The server may be using the Big Requests extension, which allows for requests to be larger than the default maximum request length. If so, this function will block until the server has updated its maximum request length.
fn generate_xid(&mut self) -> Result<u32>
fn generate_xid(&mut self) -> Result<u32>
Get a unique ID valid for use by the server.
This function returns a unique ID that can be used by the server to identify the client’s resources.
Blocking
If the client has exhausted its XID range, this function will block until the server has repopulated it.
fn check_for_error(&mut self, seq: u64) -> Result<()>
fn check_for_error(&mut self, seq: u64) -> Result<()>
Check for an error for the given sequence number.
This is intended to be used for void requests. For all other requests, either an error will occur or the reply will be discarded.
Provided Methods
fn synchronize(&mut self) -> Result<()>
fn synchronize(&mut self) -> Result<()>
Synchronize this display with the server.
By default, this function sends and receives a low-cost request. This is useful for ensuring that the server has “caught up” with the client.