Struct xcb::base::Connection[][src]

pub struct Connection { /* fields omitted */ }

xcb::Connection handles communication with the X server. It wraps an xcb_connection_t object and will call xcb_disconnect when the Connection goes out of scope

Implementations

impl Connection[src]

pub fn flush(&self) -> bool[src]

Forces any buffered output to be written to the server. Blocks until the write is complete.

Return true on success, false otherwise.

pub fn get_maximum_request_length(&self) -> u32[src]

Returns the maximum request length that this server accepts.

In the absence of the BIG-REQUESTS extension, returns the maximum request length field from the connection setup data, which may be as much as 65535. If the server supports BIG-REQUESTS, then the maximum request length field from the reply to the BigRequestsEnable request will be returned instead.

Note that this length is measured in four-byte units, making the theoretical maximum lengths roughly 256kB without BIG-REQUESTS and 16GB with.

pub fn prefetch_maximum_request_length(&self)[src]

Prefetch the maximum request length without blocking.

Without blocking, does as much work as possible toward computing the maximum request length accepted by the X server.

Invoking this function may cause a call to xcb_big_requests_enable, but will not block waiting for the reply. xcb_get_maximum_request_length will return the prefetched data after possibly blocking while the reply is retrieved.

Note that in order for this function to be fully non-blocking, the application must previously have called c.prefetch_extension_data(xcb::big_requests::id()) and the reply must have already arrived.

pub fn wait_for_event(&self) -> Option<GenericEvent>[src]

Returns the next event or error from the server.

Returns the next event or error from the server, or returns None in the event of an I/O error. Blocks until either an event or error arrive, or an I/O error occurs.

pub fn poll_for_event(&self) -> Option<GenericEvent>[src]

Returns the next event or error from the server.

Returns the next event or error from the server, if one is available, or returns None otherwise. If no event is available, that might be because an I/O error like connection close occurred while attempting to read the next event, in which case the connection is shut down when this function returns.

pub fn poll_for_queued_event(&self) -> Option<GenericEvent>[src]

Returns the next event without reading from the connection.

This is a version of poll_for_event that only examines the event queue for new events. The function doesn’t try to read new events from the connection if no queued events are found.

This function is useful for callers that know in advance that all interesting events have already been read from the connection. For example, callers might use wait_for_reply and be interested only of events that preceded a specific reply.

pub fn get_setup(&self) -> Setup<'_>[src]

Access the data returned by the server.

Accessor for the data returned by the server when the Connection was initialized. This data includes

  • the server’s required format for images,
  • a list of available visuals,
  • a list of available screens,
  • the server’s maximum request length (in the absence of the BIG-REQUESTS extension),
  • and other assorted information.

See the X protocol specification for more details.

pub fn has_error(&self) -> ConnResult<()>[src]

Test whether the connection has shut down due to a fatal error.

Some errors that occur in the context of a Connection are unrecoverable. When such an error occurs, the connection is shut down and further operations on the Connection have no effect, but memory will not be freed until the Connection is dropped.

pub fn generate_id(&self) -> u32[src]

Allocates an XID for a new object.

Allocates an XID for a new object. Typically used just prior to various object creation functions, such as xcb::create_window.

pub fn get_raw_conn(&self) -> *mut xcb_connection_t[src]

Returns the inner ffi xcb_connection_t pointer

pub fn into_raw_conn(self) -> *mut xcb_connection_t[src]

Consumes this object, returning the inner ffi xcb_connection_t pointer

pub fn prefetch_extension_data(&self, ext: &mut Extension)[src]

Prefetch of extension data into the extension cache

This function allows a “prefetch” of extension data into the extension cache. Invoking the function may cause a call to xcb_query_extension, but will not block waiting for the reply. xcb_get_extension_data will return the prefetched data after possibly blocking while it is retrieved.

pub fn get_extension_data<'a>(
    &'a self,
    ext: &mut Extension
) -> Option<QueryExtensionData<'a>>
[src]

Caches reply information from QueryExtension requests.

This function is the primary interface to the “extension cache”, which caches reply information from QueryExtension requests. Invoking this function may cause a call to xcb_query_extension to retrieve extension information from the server, and may block until extension data is received from the server.

pub fn connect(displayname: Option<&str>) -> ConnResult<(Connection, i32)>[src]

Connects to the X server. displayname: The name of the display.

Connects to the X server specified by displayname. If displayname is None, uses the value of the DISPLAY environment variable.

Returns Ok(connection object, preferred screen) in case of success, or Err(ConnError) in case of error. If no screen is preferred, the second member of the tuple is set to 0.

pub fn connect_with_auth_info(
    display: Option<&str>,
    auth_info: &AuthInfo
) -> ConnResult<(Connection, i32)>
[src]

Connects to the X server, using an authorization information. display: The name of the display. auth_info: The authorization information. screen: A pointer to a preferred screen number. Returns A newly allocated Connection structure.

Connects to the X server specified by displayname, using the authorization auth. The second member of the returned tuple is the preferred screen, or 0

pub unsafe fn from_raw_conn(conn: *mut xcb_connection_t) -> Connection[src]

builds a new Connection object from an available connection

Trait Implementations

impl AsRawFd for Connection[src]

impl Drop for Connection[src]

Auto Trait Implementations

impl RefUnwindSafe for Connection

impl !Send for Connection

impl !Sync for Connection

impl Unpin for Connection

impl UnwindSafe for Connection

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.