Wayland++ 1.0.0
C++ Bindings for Wayland
Loading...
Searching...
No Matches
wayland::server::keyboard_t Class Reference

keyboard input device More...

#include <wayland-server-protocol.hpp>

Inherits wayland::server::resource_t.

Public Member Functions

std::function< void()> & on_release ()
 release the keyboard object
 
void keymap (keyboard_keymap_format const &format, int fd, uint32_t size, bool post=true)
 keyboard mapping
 
void enter (uint32_t serial, surface_t const &surface, array_t const &keys, bool post=true)
 enter event
 
void leave (uint32_t serial, surface_t const &surface, bool post=true)
 leave event
 
void key (uint32_t serial, uint32_t time, uint32_t key, keyboard_key_state const &state, bool post=true)
 key event
 
void modifiers (uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group, bool post=true)
 modifier and group state
 
void repeat_info (int32_t rate, int32_t delay, bool post=true)
 repeat rate and delay
 
bool can_repeat_info () const
 Check whether the repeat_info function is available with the currently bound version of the protocol.
 
bool proxy_has_object () const
 Check whether this wrapper actually wraps an object.
 
void post_no_memory () const
 
uint32_t get_id () const
 
client_t get_client () const
 
unsigned int get_version () const
 
std::string get_class ()
 

Static Public Attributes

static constexpr std::uint32_t keymap_since_version = 1
 Minimum protocol version required for the keymap function.
 
static constexpr std::uint32_t enter_since_version = 1
 Minimum protocol version required for the enter function.
 
static constexpr std::uint32_t leave_since_version = 1
 Minimum protocol version required for the leave function.
 
static constexpr std::uint32_t key_since_version = 1
 Minimum protocol version required for the key function.
 
static constexpr std::uint32_t modifiers_since_version = 1
 Minimum protocol version required for the modifiers function.
 
static constexpr std::uint32_t repeat_info_since_version = 4
 Minimum protocol version required for the repeat_info function.
 

Detailed Description

keyboard input device

The wl_keyboard interface represents one or more keyboards associated with a seat.

Definition at line 3291 of file wayland-server-protocol.hpp.

Member Function Documentation

◆ can_repeat_info()

bool keyboard_t::can_repeat_info ( ) const

Check whether the repeat_info function is available with the currently bound version of the protocol.

Definition at line 2822 of file wayland-server-protocol.cpp.

◆ enter()

void keyboard_t::enter ( uint32_t  serial,
surface_t const &  surface,
array_t const &  keys,
bool  post = true 
)

enter event

Parameters
serialserial number of the enter event
surfacesurface gaining keyboard focus
keysthe currently pressed keys

Notification that this seat's keyboard focus is on a certain surface.

The compositor must send the wl_keyboard.modifiers event after this event.

Definition at line 2797 of file wayland-server-protocol.cpp.

◆ get_class()

std::string wayland::server::resource_t::get_class ( )
inherited

Retrieve the interface name (class) of a resource object.

Returns
Interface name of the resource object.

◆ get_client()

client_t wayland::server::resource_t::get_client ( ) const
inherited

Get the associated client

Returns
the client that owns the resource.

◆ get_id()

uint32_t wayland::server::resource_t::get_id ( ) const
inherited

Get the internal ID of the resource

Returns
the internal ID of the resource

◆ get_version()

unsigned int wayland::server::resource_t::get_version ( ) const
inherited

Get interface version

Returns
Interface version this resource has been constructed with.

◆ key()

void keyboard_t::key ( uint32_t  serial,
uint32_t  time,
uint32_t  key,
keyboard_key_state const &  state,
bool  post = true 
)

key event

Parameters
serialserial number of the key event
timetimestamp with millisecond granularity
keykey that produced the event
statephysical state of the key

A key was pressed or released. The time argument is a timestamp with millisecond granularity, with an undefined base.

The key is a platform-specific key code that can be interpreted by feeding it to the keyboard mapping (see the keymap event).

If this event produces a change in modifiers, then the resulting wl_keyboard.modifiers event must be sent after this event.

Definition at line 2807 of file wayland-server-protocol.cpp.

◆ keymap()

void keyboard_t::keymap ( keyboard_keymap_format const &  format,
int  fd,
uint32_t  size,
bool  post = true 
)

keyboard mapping

Parameters
formatkeymap format
fdkeymap file descriptor
sizekeymap size, in bytes

This event provides a file descriptor to the client which can be memory-mapped in read-only mode to provide a keyboard mapping description.

From version 7 onwards, the fd must be mapped with MAP_PRIVATE by the recipient, as MAP_SHARED may fail.

Definition at line 2792 of file wayland-server-protocol.cpp.

◆ leave()

void keyboard_t::leave ( uint32_t  serial,
surface_t const &  surface,
bool  post = true 
)

leave event

Parameters
serialserial number of the leave event
surfacesurface that lost keyboard focus

Notification that this seat's keyboard focus is no longer on a certain surface.

The leave notification is sent before the enter notification for the new focus.

After this event client must assume that all keys, including modifiers, are lifted and also it must stop key repeating if there's some going on.

Definition at line 2802 of file wayland-server-protocol.cpp.

◆ modifiers()

void keyboard_t::modifiers ( uint32_t  serial,
uint32_t  mods_depressed,
uint32_t  mods_latched,
uint32_t  mods_locked,
uint32_t  group,
bool  post = true 
)

modifier and group state

Parameters
serialserial number of the modifiers event
mods_depresseddepressed modifiers
mods_latchedlatched modifiers
mods_lockedlocked modifiers
groupkeyboard layout

Notifies clients that the modifier and/or group state has changed, and it should update its local state.

Definition at line 2812 of file wayland-server-protocol.cpp.

◆ on_release()

std::function< void()> & keyboard_t::on_release ( )

release the keyboard object

Definition at line 2786 of file wayland-server-protocol.cpp.

◆ post_no_memory()

void wayland::server::resource_t::post_no_memory ( ) const
inherited

Post "not enough memory" error to the client

If the compositor has not enough memory to fulfill a certail request of the client, this function can be called to notify the client of this circumstance.

◆ proxy_has_object()

bool wayland::server::resource_t::proxy_has_object ( ) const
inherited

Check whether this wrapper actually wraps an object.

Returns
true if there is an underlying object, false if this wrapper is empty

◆ repeat_info()

void keyboard_t::repeat_info ( int32_t  rate,
int32_t  delay,
bool  post = true 
)

repeat rate and delay

Parameters
ratethe rate of repeating keys in characters per second
delaydelay in milliseconds since key down until repeating starts

Informs the client about the keyboard's repeat rate and delay.

This event is sent as soon as the wl_keyboard object has been created, and is guaranteed to be received by the client before any key press event.

Negative values for either rate or delay are illegal. A rate of zero will disable any repeating (regardless of the value of delay).

This event can be sent later on as well with a new value if necessary, so clients should continue listening for the event past the creation of wl_keyboard.

Definition at line 2817 of file wayland-server-protocol.cpp.

Member Data Documentation

◆ enter_since_version

constexpr std::uint32_t wayland::server::keyboard_t::enter_since_version = 1
staticconstexpr

Minimum protocol version required for the enter function.

Definition at line 3357 of file wayland-server-protocol.hpp.

◆ key_since_version

constexpr std::uint32_t wayland::server::keyboard_t::key_since_version = 1
staticconstexpr

Minimum protocol version required for the key function.

Definition at line 3400 of file wayland-server-protocol.hpp.

◆ keymap_since_version

constexpr std::uint32_t wayland::server::keyboard_t::keymap_since_version = 1
staticconstexpr

Minimum protocol version required for the keymap function.

Definition at line 3339 of file wayland-server-protocol.hpp.

◆ leave_since_version

constexpr std::uint32_t wayland::server::keyboard_t::leave_since_version = 1
staticconstexpr

Minimum protocol version required for the leave function.

Definition at line 3377 of file wayland-server-protocol.hpp.

◆ modifiers_since_version

constexpr std::uint32_t wayland::server::keyboard_t::modifiers_since_version = 1
staticconstexpr

Minimum protocol version required for the modifiers function.

Definition at line 3417 of file wayland-server-protocol.hpp.

◆ repeat_info_since_version

constexpr std::uint32_t wayland::server::keyboard_t::repeat_info_since_version = 4
staticconstexpr

Minimum protocol version required for the repeat_info function.

Definition at line 3441 of file wayland-server-protocol.hpp.


The documentation for this class was generated from the following files: