Struct wayland_client::EventQueue [] [src]

pub struct EventQueue { /* fields omitted */ }

An event queue managing wayland events

Each wayland object can receive events from the server. To handle these events you must associate to these objects an implementation: a struct defined in their respective module, in which you provide a set of functions that will handle each event.

Your implementation can also access a shared state managed by the event queue. See the State struct and the state() method on EventQueueHandle. If you need this, the way to do it is:

  • insert your state value in the event queue state store, your are then provided with a token to access it
  • provide this token (you can clone it) as implementation data to any wayland object that need to access this state in its event callbacks.

The event queues also provides you control on the flow of the program, via the dispatch() and dispatch_pending() methods.

Methods

impl EventQueue
[src]

[src]

Dispatches events from the internal buffer.

Dispatches all events to their appropriate handlers. If not events were in the internal buffer, will block until some events are read and dispatch them. This process can insert events in the internal buffers of other event queues.

If an error is returned, your connection with the wayland compositor is probably lost.

[src]

Dispatches pending events from the internal buffer.

Dispatches all events to their appropriate handlers. Never blocks, if not events were pending, simply returns Ok(0).

If an error is returned, your connection with the wayland compositor is probably lost.

[src]

Synchronous roundtrip

This call will cause a synchonous roundtrip with the wayland server. It will block until all pending requests of this queue are sent to the server and it has processed all of them and send the appropriate events.

Handlers are called as a consequence.

On success returns the number of dispatched events.

[src]

Prepare an conccurent read

Will declare your intention to read events from the server socket.

Will return None if there are still some events awaiting dispatch on this EventIterator. In this case, you need to call dispatch_pending() before calling this method again.

As long as the returned guard is in scope, no events can be dispatched to any event iterator.

The guard can then be destroyed by two means:

  • Calling its cancel() method (or letting it go out of scope): the read intention will be cancelled
  • Calling its read_events() method: will block until all existing guards are destroyed by one of these methods, then events will be read and all blocked read_events() calls will return.

This call will otherwise not block on the server socket if it is empty, and return an io error WouldBlock in such cases.

Methods from Deref<Target = EventQueueHandle>

[src]

Register a proxy to this event queue.

You are required to provide a valid implementation for this proxy as well as some associated implementation data. This implementation is expected to be a struct holding the various relevant function pointers.

This implementation data can typically contain indexes to state value that the implementation will need to work on.

This overwrites any precedently set implementation for this proxy.

Returns appropriately and does nothing if this proxy is dead or already managed by something else than this library.

[src]

Get a handle to the internal state

The returned guard object allows you to get references to the handler objects you previously inserted in this event queue.

Trait Implementations

impl Deref for EventQueue
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

impl DerefMut for EventQueue
[src]

[src]

Mutably dereferences the value.