Skip to content

wl_display¤

wayland.wl_display ¤

Core global object

The core global object. This is a special singleton object. It is used for internal Wayland protocol features.

Methods:

  • sync

    Asynchronous roundtrip

  • get_registry

    Get global registry object

  • on_error

    Fatal error event.

  • on_delete_id

    Acknowledge object id deletion.

  • dispatch

    Call dispatch to dispatch incoming Wayland events to your

  • dispatch_pending

    Call dispatch_pending to dispatch any pending Wayland events to your

  • dispatch_timeout

    Call dispatch_timeout to dispatch incoming Wayland events

error ¤

Global error values

These errors are global and can be emitted in response to any server request.

events

error ¤

error(object_id: object, code: int, message: str) -> None

Fatal error event

The error event is sent out when a fatal (non-recoverable) error has occurred. The object_id argument is the object where the error occurred, most often in response to a request to that object. The code identifies the error and is defined by the object interface. As such, each interface defines its own set of error codes. The message is a brief description of the error, for (debugging) convenience.

Parameters:

  • object_id ¤

    (object) –

    Object where the error occurred

  • code ¤

    (int) –

    Error code

  • message ¤

    (str) –

    Error description

delete_id ¤

delete_id(id: int) -> None

Acknowledge object id deletion

This event is used internally by the object ID management logic. When a client deletes an object that it had created, the server will send this event to acknowledge that it has seen the delete request. When the client receives this event, it will know that it can safely reuse the object ID.

Parameters:

  • id ¤

    (int) –

    Deleted object id

sync ¤

sync() -> wl_callback

Asynchronous roundtrip

The sync request asks the server to emit the 'done' event on the returned wl_callback object. Since requests are handled in-order and events are delivered in-order, this can be used as a barrier to ensure all previous requests and the resulting events have been handled.

The object returned by this request will be destroyed by the compositor after the callback is fired and as such the client must not attempt to use it after that point.

The callback_data passed in the callback is undefined and should be ignored.

Returns:

get_registry ¤

get_registry() -> wl_registry

Get global registry object

This request creates a registry object that allows the client to list and bind the global objects available from the compositor.

It should be noted that the server side resources consumed in response to a get_registry request can only be released when the client disconnects, not when the client side proxy is destroyed. Therefore, clients should invoke get_registry as infrequently as possible to avoid wasting memory.

Returns:

on_error ¤

on_error(object_id: object, code: int, message: str) -> None

Fatal error event.

Override to handle wayland.wl_display.events.error.

on_delete_id ¤

on_delete_id(id: int) -> None

Acknowledge object id deletion.

Override to handle wayland.wl_display.events.delete_id.

dispatch ¤

dispatch() -> None

Call dispatch to dispatch incoming Wayland events to your event handlers.

This is a blocking call. It is not return until some events have been dispatched.

dispatch_pending ¤

dispatch_pending() -> bool

Call dispatch_pending to dispatch any pending Wayland events to your event handlers.

This is a non-blocking call. It returns as soon as any pending events have been dispatched. If there are no pending events it returns immediately.

Returns:

  • bool ( bool ) –

    True if any events were dispatched, otherwise False

dispatch_timeout ¤

dispatch_timeout(timeout: float) -> None

Call dispatch_timeout to dispatch incoming Wayland events to your event handlers.

This is a blocking call. It returns either when some events have been dispatched or when the wait time specified by timeout has been exceeded.

Examples:

Wait for 1/50th of a second for events and return

had_events = wayland.wl_display.dispatch_timeout(1/50)

Parameters:

  • timeout ¤

    (float) –

    the maximum time to wait for events in seconds.

Returns:

  • bool ( None ) –

    True if any events were dispatched, otherwise False