Trait breadx::display::Display[][src]

pub trait Display: DisplayBase {
    fn wait(&mut self) -> Result;
fn send_request_raw(&mut self, request_info: RequestInfo) -> Result<u16>; fn synchronize(&mut self) -> Result { ... }
fn resolve_request_raw(&mut self, req_id: u16) -> Result<PendingReply> { ... }
fn wait_for_event(&mut self) -> Result<Event> { ... }
fn wait_for_special_event(&mut self, xid: XID) -> Result<Event> { ... } }
Expand description

A wrapper around a synchronous connection to the X11 server.

There are two ways to send and receive data along a connection to the server: synchronously or asynchronously. This type of display communicates synchronously with the server. Its function are assumed to block the flow of execution while it is waiting for data to be sent to and received from the server.

See DisplayBase for more information on the function of a display object.

Required methods

Wait for something to happen on the connection.

This function waits for 32 or more bytes to be sent by the server, processes those bytes, and then appends the result of that processing to either the pending items map or one of the event queues. It can be assumed that, if wait returns without an error, either an event, an error, or a reply has been sent from the server and added to this display.

Errors

If the server sends all zero bytes, the implementation should return BreadError::ClosedConnection, since this usually indicates that the connection has closed unless the client is out of sync with the server. If the server returns a reply that the client is not expecting because the corresponding request was never sent, the implementation should return BreadError::NoMatchingRequest. If an error is sent by the server and there is no corresponding pending request in the item map, that error should be converted into a BreadError and returned.

In addition, system IO errors should be wrapped into a BreadError and returned.

Send a request across the connection, given the monomorphized request info.

This function sends the bytes and occasionally file descriptors contained in the given RequestInfo across the wrapped connection. The number of bytes should be a multiple of 4, and it should consist of a valid request that the X11 server can read.

If the request belongs to an extension whose opcode has yet to be registered in the display’s extension map, the display should first send and resolve a QueryExtensionRequest in order to determine which opcode the request needs.

Errors

Since this function may potentially have to resolve a QueryExtensionRequest, it can return any error that wait is capable of returning. In addition, if the extension if not present, it will return BreadError::ExtensionNotPresent. Aside from querying for the extension, it may bubble up IO errors emitted by the internal system.

Provided methods

Synchronize this display, ensuring that all data sent across it has been replied to.

It is occasionally useful to make sure the display has processed all of the information we have sent it. This is mostly done when running requests with zero-sized replies. This can be easily done by sending a small request (in this case, a GetInputFocusRequest) and waiting for it to be resolved. By resolving the request, the server acknowledges that it has also received and processed every request that came before it.

Errors

This function calls send_request_raw and then wait in a loop. Therefore, it can return any error that wait and send_request_raw can.

Resolve for a request, returning only the raw data of the reply. The default implementation assumes that the reply is not zero-sized.

This function attempts to take the pending reply for the given request ID and, if the reply is not found, starts waiting in a loop. If the reply is zero-sized, this may be an infinite loop.

Errors

This function can return any error that wait can.

Wait for an event to be sent from the X server.

Similarly to resolve_request_raw, this calls wait in a loop until an event is sent by the server.

Errors

This function can return any error that wait can.

Wait for a special event to be sent from the X server. See wait_for_event for more information on how it functions.

Implementations on Foreign Types

Implementors