Struct smithay::wayland::seat::Seat

source ·
pub struct Seat { /* private fields */ }
Expand description

A Seat handle

This struct gives you access to the control of the capabilities of the associated seat.

It is directly inserted in the event loop by its new method.

This is an handle to the inner logic, it can be cloned and shared accross threads.

See module-level documentation for details of use.

Implementations§

Create a new seat global

A new seat global is created with given name and inserted into this event loop.

You are provided with the state token to retrieve it (allowing you to add or remove capabilities from it), and the global handle, in case you want to remove it.

Attempt to retrieve a Seat from an existing resource

Acces the UserDataMap associated with this Seat

Adds the pointer capability to this seat

You are provided a PointerHandle, which allows you to send input events to this pointer. This handle can be cloned and sent across threads.

Calling this method on a seat that already has a pointer capability will overwrite it, and will be seen by the clients as if the mouse was unplugged and a new one was plugged.

You need to provide a compositor token, as well as a callback that will be notified whenever a client requests to set a custom cursor image.

Examples
let pointer_handle = seat.add_pointer(
    compositor_token.clone(),
    |new_status| { /* a closure handling requests from clients tot change the cursor icon */ }
);

Access the pointer of this seat if any

Remove the pointer capability from this seat

Clients will be appropriately notified.

Adds the keyboard capability to this seat

You are provided a KeyboardHandle, which allows you to send input events to this keyboard. This handle can be cloned and sent across threads.

You also provide a Model/Layout/Variant/Options specification of the keymap to be used for this keyboard, as well as any repeat-info that will be forwarded to the clients.

Calling this method on a seat that already has a keyboard capability will overwrite it, and will be seen by the clients as if the keyboard was unplugged and a new one was plugged.

Examples
let keyboard = seat
    .add_keyboard(
        XkbConfig {
            layout: "de",
            variant: "nodeadkeys",
            ..XkbConfig::default()
        },
        1000,
        500,
        |seat, focus| {
            /* This closure is called whenever the keyboard focus
             * changes, with the new focus as argument */
        }
    )
    .expect("Failed to initialize the keyboard");

Access the keyboard of this seat if any

Remove the keyboard capability from this seat

Clients will be appropriately notified.

Checks whether a given WlSeat is associated with this Seat

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Sets value as a parameter of self.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.