Struct wayland_client::core::seat::Keyboard [] [src]

pub struct Keyboard {
    // some fields omitted
}

A keyboard interface.

This struct is a handle to the keyboard interface of a given Seat.It allows you to change the keyboard display and handle all keyboard-related events.

The events are handled in a callback way. Each callback are provided a KeyboardId identifying the keyboard. This is to allow specific situation where you need the keyboard to not be borrowed (to change its surface for example) and have more than one cursor.

Methods

impl Keyboard

fn get_id(&self) -> KeyboardId

Returns the unique KeyboardId associated to this keyboard.

This struct can be tested for equality, and will be provided in event callbacks as a mean to identify the keyboard associated with the events.

fn get_seat(&self) -> &Seat

Get access to the seat associated with this keyboard

fn keymap_fd(&self) -> Option<(i32, u32)>

Provides the file descriptor giving access to the keymap definition currently used by the compositor for this keyboard.

Provided data is (fd, size). size being the number of bytes to read from fd.

It gives away ownership of the Fd, and thus other calls of this methos will return None.

Will also return None if the event providing this information has not been received yet. In such case you'll need to wait for more events to be processed. Using Display::dispatch_pending() for example.

fn repeat_info(&self) -> Option<(i32, i32)>

Provides the repeat information of this keayboard.

Provided data is (rate, delay). rate is the rate of repeating keys, in characters per second, and delay is the delay in miliseconds between the moment the key is pressed and the moment it starts repeating.

Will return None if the event providing this information has not been received yet. In such case you'll need to wait for more events to be processed. Using Display::dispatch_pending() for example.

fn release(self)

fn set_enter_action<F>(&mut self, f: F) where F: Fn(KeyboardId, Serial, SurfaceId, &[u32]) + 'static + Send + Sync

Defines the action to be executed when a surface gains keyboard focus.

Arguments are:

  • Id of the keyboard
  • Id of the surface
  • a slice of the keycodes of the currenlty pressed keys

fn set_leave_action<F>(&mut self, f: F) where F: Fn(KeyboardId, Serial, SurfaceId) + 'static + Send + Sync

Defines the action to be executed when a surface loses keyboard focus.

This event is generated before the enter event is generated for the new surface the focus goes to.

Arguments are:

  • Id of the keyboard
  • Id of the surface

fn set_key_action<F>(&mut self, f: F) where F: Fn(KeyboardId, Serial, u32, u32, KeyState) + 'static + Send + Sync

Defines the action to be executed when a keystroke is done.

Arguments are:

  • Id of the Keyboard
  • time of event (timestamp with milisecond granularity)
  • raw keycode of the key
  • new key status

fn set_modifiers_action<F>(&mut self, f: F) where F: Fn(KeyboardId, Serial, u32, u32, u32, u32) + 'static + Send + Sync

Defines the action to be executed when a modifier is changed.

This event providesthe new state of the modifiers.

Arguments are:

  • Id of the Keyboard
  • mods_depressed
  • mods_latched
  • mods_locked
  • group

Trait Implementations

impl Send for Keyboard

impl Sync for Keyboard

impl Drop for Keyboard

fn drop(&mut self)

impl FFI for Keyboard

type Ptr = wl_keyboard

fn ptr(&self) -> *const wl_keyboard

unsafe fn ptr_mut(&self) -> *mut wl_keyboard