Wayland++  0.2.6
C++ Bindings for Wayland
wayland::zwp_input_method_context_v1_t Class Reference

input method context More...

#include <wayland-client-protocol-unstable.hpp>

Inheritance diagram for wayland::zwp_input_method_context_v1_t:
Collaboration diagram for wayland::zwp_input_method_context_v1_t:

Public Types

enum  wrapper_type { wrapper_type::standard, wrapper_type::display, wrapper_type::foreign, wrapper_type::proxy_wrapper }
 

Public Member Functions

void commit_string (uint32_t serial, std::string text)
 commit string More...
 
void preedit_string (uint32_t serial, std::string text, std::string commit)
 pre-edit string More...
 
void preedit_styling (uint32_t index, uint32_t length, zwp_text_input_v1_preedit_style style)
 pre-edit styling More...
 
void preedit_cursor (int32_t index)
 pre-edit cursor More...
 
void delete_surrounding_text (int32_t index, uint32_t length)
 delete text More...
 
void cursor_position (int32_t index, int32_t anchor)
 set cursor to a new position More...
 
void modifiers_map (array_t map)
 
void keysym (uint32_t serial, uint32_t time, uint32_t sym, keyboard_key_state state, uint32_t modifiers)
 keysym More...
 
keyboard_t grab_keyboard ()
 grab hardware keyboard More...
 
void key (uint32_t serial, uint32_t time, uint32_t key, keyboard_key_state state)
 forward key event More...
 
void modifiers (uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
 forward modifiers event More...
 
void language (uint32_t serial, std::string language)
 
void text_direction (uint32_t serial, uint32_t direction)
 
std::function< void(std::string, uint32_t, uint32_t)> & on_surrounding_text ()
 surrounding text event More...
 
std::function< void(zwp_text_input_v1_content_hint, zwp_text_input_v1_content_purpose)> & on_content_type ()
 
std::function< void(uint32_t, uint32_t)> & on_invoke_action ()
 
std::function< void(uint32_t)> & on_commit_state ()
 
std::function< void(std::string)> & on_preferred_language ()
 
uint32_t get_id () const
 Get the id of a proxy object. More...
 
std::string get_class () const
 Get the interface name (class) of a proxy object. More...
 
uint32_t get_version () const
 Get the protocol object version of a proxy object. More...
 
wrapper_type get_wrapper_type () const
 Get the type of a proxy object. More...
 
void set_queue (event_queue_t queue)
 Assign a proxy to an event queue. More...
 
wl_proxy * c_ptr () const
 Get a pointer to the underlying C struct. More...
 
bool proxy_has_object () const
 Check whether this wrapper actually wraps an object. More...
 
 operator bool () const
 Check whether this wrapper actually wraps an object. More...
 
bool operator== (const proxy_t &right) const
 Check whether two wrappers refer to the same object. More...
 
bool operator!= (const proxy_t &right) const
 Check whether two wrappers refer to different objects. More...
 
void proxy_release ()
 Release the wrapped object (if any), making this an empty wrapper. More...
 

Static Public Attributes

static constexpr std::uint32_t commit_string_since_version = 1
 Minimum protocol version required for the commit_string function. More...
 
static constexpr std::uint32_t preedit_string_since_version = 1
 Minimum protocol version required for the preedit_string function. More...
 
static constexpr std::uint32_t preedit_styling_since_version = 1
 Minimum protocol version required for the preedit_styling function. More...
 
static constexpr std::uint32_t preedit_cursor_since_version = 1
 Minimum protocol version required for the preedit_cursor function. More...
 
static constexpr std::uint32_t delete_surrounding_text_since_version = 1
 Minimum protocol version required for the delete_surrounding_text function. More...
 
static constexpr std::uint32_t cursor_position_since_version = 1
 Minimum protocol version required for the cursor_position function. More...
 
static constexpr std::uint32_t modifiers_map_since_version = 1
 Minimum protocol version required for the modifiers_map function. More...
 
static constexpr std::uint32_t keysym_since_version = 1
 Minimum protocol version required for the keysym function. More...
 
static constexpr std::uint32_t grab_keyboard_since_version = 1
 Minimum protocol version required for the grab_keyboard function. More...
 
static constexpr std::uint32_t key_since_version = 1
 Minimum protocol version required for the key function. More...
 
static constexpr std::uint32_t modifiers_since_version = 1
 Minimum protocol version required for the modifiers function. More...
 
static constexpr std::uint32_t language_since_version = 1
 Minimum protocol version required for the language function. More...
 
static constexpr std::uint32_t text_direction_since_version = 1
 Minimum protocol version required for the text_direction function. More...
 

Detailed Description

input method context

Corresponds to a text input on the input method side. An input method context is created on text input activation on the input method side. It allows receiving information about the text input from the application via events. Input method contexts do not keep state after deactivation and should be destroyed after deactivation is handled.

Text is generally UTF-8 encoded, indices and lengths are in bytes.

Serials are used to synchronize the state between the text input and an input method. New serials are sent by the text input in the commit_state request and are used by the input method to indicate the known text input state in events like preedit_string, commit_string, and keysym. The text input can then ignore events from the input method which are based on an outdated state (for example after a reset).

Warning! The protocol described in this file is experimental and backward incompatible changes may be made. Backward compatible changes may be added together with the corresponding interface version bump. Backward incompatible changes are done by bumping the version number in the protocol and interface names and resetting the interface version. Once the protocol is to be declared stable, the 'z' prefix and the version number in the protocol and interface names are removed and the interface version number is reset.

Definition at line 678 of file wayland-client-protocol-unstable.hpp.

Member Enumeration Documentation

◆ wrapper_type

enum wayland::proxy_t::wrapper_type
stronginherited

Underlying wl_proxy type and properties of a proxy_t that affect construction, destruction, and event handling

Enumerator
standard 

C pointer is a standard type compatible with wl_proxy*. Events are dispatched and it is destructed when the proxy_t is destructed. User data is set.

display 

C pointer is a wl_display*. No events are dispatched, wl_display_disconnect is called when the proxy_t is destructed. User data is set.

foreign 

C pointer is a standard type compatible with wl_proxy*, but another library owns it and it should not be touched in a way that could affect the operation of the other library. No events are dispatched, wl_proxy_destroy is not called when the proxy_t is destructed, user data is not touched. Consequently, there is no reference counting for the proxy_t. Lifetime of such wrappers should preferably be short to minimize the chance that the owning library decides to destroy the wl_proxy.

proxy_wrapper 

C pointer is a wl_proxy* that was constructed with wl_proxy_create_wrapper. No events are dispatched, wl_proxy_wrapper_destroy is called when the proxy_t is destroyed. Reference counting is active. A reference to the proxy_t creating this proxy wrapper is held to extend its lifetime until after the proxy wrapper is destroyed.

Definition at line 105 of file wayland-client.hpp.

Member Function Documentation

◆ c_ptr()

wl_proxy* wayland::proxy_t::c_ptr ( ) const
inherited

Get a pointer to the underlying C struct.

Returns
The underlying wl_proxy wrapped by this proxy_t if it exists, otherwise an exception is thrown

◆ commit_string()

void zwp_input_method_context_v1_t::commit_string ( uint32_t  serial,
std::string  text 
)

commit string

Parameters
serialserial of the latest known text input state
text

Send the commit string text for insertion to the application.

The text to commit could be either just a single character after a key press or the result of some composing (pre-edit). It could be also an empty text when some text should be removed (see delete_surrounding_text) or when the input cursor should be moved (see cursor_position).

Any previously set composing text will be removed.

Definition at line 4265 of file wayland-client-protocol-unstable.cpp.

◆ cursor_position()

void zwp_input_method_context_v1_t::cursor_position ( int32_t  index,
int32_t  anchor 
)

set cursor to a new position

Parameters
index
anchor

Set the cursor and anchor to a new position. Index is the new cursor position in bytes (when >= 0 this is relative to the end of the inserted text, otherwise it is relative to the beginning of the inserted text). Anchor is the new anchor position in bytes (when >= 0 this is relative to the end of the inserted text, otherwise it is relative to the beginning of the inserted text). When there should be no selected text, anchor should be the same as index.

This request will be handled on the text_input side directly following a commit_string request.

Definition at line 4290 of file wayland-client-protocol-unstable.cpp.

◆ delete_surrounding_text()

void zwp_input_method_context_v1_t::delete_surrounding_text ( int32_t  index,
uint32_t  length 
)

delete text

Parameters
index
length

Remove the surrounding text.

This request will be handled on the text_input side directly following a commit_string request.

Definition at line 4285 of file wayland-client-protocol-unstable.cpp.

◆ get_class()

std::string wayland::proxy_t::get_class ( ) const
inherited

Get the interface name (class) of a proxy object.

Returns
The interface name of the object associated with the proxy

◆ get_id()

uint32_t wayland::proxy_t::get_id ( ) const
inherited

Get the id of a proxy object.

Returns
The id the object associated with the proxy
Examples
dump.cpp.

◆ get_version()

uint32_t wayland::proxy_t::get_version ( ) const
inherited

Get the protocol object version of a proxy object.

Gets the protocol object version of a proxy object, or 0 if the proxy was created with unversioned API.

A returned value of 0 means that no version information is available, so the caller must make safe assumptions about the object's real version.

display_t will always return version 0.

Returns
The protocol object version of the proxy or 0

◆ get_wrapper_type()

wrapper_type wayland::proxy_t::get_wrapper_type ( ) const
inlineinherited

Get the type of a proxy object.

Definition at line 288 of file wayland-client.hpp.

◆ grab_keyboard()

keyboard_t zwp_input_method_context_v1_t::grab_keyboard ( )

grab hardware keyboard

Allow an input method to receive hardware keyboard input and process key events to generate text events (with pre-edit) over the wire. This allows input methods which compose multiple key events for inputting text like it is done for CJK languages.

Definition at line 4305 of file wayland-client-protocol-unstable.cpp.

◆ key()

void zwp_input_method_context_v1_t::key ( uint32_t  serial,
uint32_t  time,
uint32_t  key,
keyboard_key_state  state 
)

forward key event

Parameters
serialserial from wl_keyboard::key
timetime from wl_keyboard::key
keykey from wl_keyboard::key
statestate from wl_keyboard::key

Forward a wl_keyboard::key event to the client that was not processed by the input method itself. Should be used when filtering key events with grab_keyboard. The arguments should be the ones from the wl_keyboard::key event.

For generating custom key events use the keysym request instead.

Definition at line 4311 of file wayland-client-protocol-unstable.cpp.

◆ keysym()

void zwp_input_method_context_v1_t::keysym ( uint32_t  serial,
uint32_t  time,
uint32_t  sym,
keyboard_key_state  state,
uint32_t  modifiers 
)

keysym

Parameters
serialserial of the latest known text input state
time
sym
state
modifiers

Notify when a key event was sent. Key events should not be used for normal text input operations, which should be done with commit_string, delete_surrounding_text, etc. The key event follows the wl_keyboard key event convention. Sym is an XKB keysym, state is a wl_keyboard key_state.

Definition at line 4300 of file wayland-client-protocol-unstable.cpp.

◆ language()

void zwp_input_method_context_v1_t::language ( uint32_t  serial,
std::string  language 
)
Parameters
serialserial of the latest known text input state
language

Definition at line 4321 of file wayland-client-protocol-unstable.cpp.

◆ modifiers()

void zwp_input_method_context_v1_t::modifiers ( uint32_t  serial,
uint32_t  mods_depressed,
uint32_t  mods_latched,
uint32_t  mods_locked,
uint32_t  group 
)

forward modifiers event

Parameters
serialserial from wl_keyboard::modifiers
mods_depressedmods_depressed from wl_keyboard::modifiers
mods_latchedmods_latched from wl_keyboard::modifiers
mods_lockedmods_locked from wl_keyboard::modifiers
groupgroup from wl_keyboard::modifiers

Forward a wl_keyboard::modifiers event to the client that was not processed by the input method itself. Should be used when filtering key events with grab_keyboard. The arguments should be the ones from the wl_keyboard::modifiers event.

Definition at line 4316 of file wayland-client-protocol-unstable.cpp.

◆ modifiers_map()

void zwp_input_method_context_v1_t::modifiers_map ( array_t  map)
Parameters
map

Definition at line 4295 of file wayland-client-protocol-unstable.cpp.

◆ on_commit_state()

std::function< void(uint32_t)> & zwp_input_method_context_v1_t::on_commit_state ( )
Parameters
serialserial of text input state

Definition at line 4351 of file wayland-client-protocol-unstable.cpp.

◆ on_content_type()

std::function< void(zwp_text_input_v1_content_hint, zwp_text_input_v1_content_purpose)> & zwp_input_method_context_v1_t::on_content_type ( )
Parameters
hint
purpose

Definition at line 4341 of file wayland-client-protocol-unstable.cpp.

◆ on_invoke_action()

std::function< void(uint32_t, uint32_t)> & zwp_input_method_context_v1_t::on_invoke_action ( )
Parameters
button
index

Definition at line 4346 of file wayland-client-protocol-unstable.cpp.

◆ on_preferred_language()

std::function< void(std::string)> & zwp_input_method_context_v1_t::on_preferred_language ( )
Parameters
language

Definition at line 4356 of file wayland-client-protocol-unstable.cpp.

◆ on_surrounding_text()

std::function< void(std::string, uint32_t, uint32_t)> & zwp_input_method_context_v1_t::on_surrounding_text ( )

surrounding text event

Parameters
text
cursor
anchor

The plain surrounding text around the input position. Cursor is the position in bytes within the surrounding text relative to the beginning of the text. Anchor is the position in bytes of the selection anchor within the surrounding text relative to the beginning of the text. If there is no selected text then anchor is the same as cursor.

Definition at line 4331 of file wayland-client-protocol-unstable.cpp.

◆ operator bool()

wayland::proxy_t::operator bool ( ) const
inherited

Check whether this wrapper actually wraps an object.

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

◆ operator!=()

bool wayland::proxy_t::operator!= ( const proxy_t right) const
inherited

Check whether two wrappers refer to different objects.

◆ operator==()

bool wayland::proxy_t::operator== ( const proxy_t right) const
inherited

Check whether two wrappers refer to the same object.

◆ preedit_cursor()

void zwp_input_method_context_v1_t::preedit_cursor ( int32_t  index)

pre-edit cursor

Parameters
index

Set the cursor position inside the composing text (as byte offset) relative to the start of the composing text.

When index is negative no cursor should be displayed.

This request should be sent before sending a preedit_string request.

Definition at line 4280 of file wayland-client-protocol-unstable.cpp.

◆ preedit_string()

void zwp_input_method_context_v1_t::preedit_string ( uint32_t  serial,
std::string  text,
std::string  commit 
)

pre-edit string

Parameters
serialserial of the latest known text input state
text
commit

Send the pre-edit string text to the application text input.

The commit text can be used to replace the pre-edit text on reset (for example on unfocus).

Previously sent preedit_style and preedit_cursor requests are also processed by the text_input.

Definition at line 4270 of file wayland-client-protocol-unstable.cpp.

◆ preedit_styling()

void zwp_input_method_context_v1_t::preedit_styling ( uint32_t  index,
uint32_t  length,
zwp_text_input_v1_preedit_style  style 
)

pre-edit styling

Parameters
index
length
style

Set the styling information on composing text. The style is applied for length in bytes from index relative to the beginning of the composing text (as byte offset). Multiple styles can be applied to a composing text.

This request should be sent before sending a preedit_string request.

Definition at line 4275 of file wayland-client-protocol-unstable.cpp.

◆ proxy_has_object()

bool wayland::proxy_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

◆ proxy_release()

void wayland::proxy_t::proxy_release ( )
inherited

Release the wrapped object (if any), making this an empty wrapper.

Note that display_t instances cannot be released this way. Attempts to do so are ignored.

Examples
foreign_display.cpp.

◆ set_queue()

void wayland::proxy_t::set_queue ( event_queue_t  queue)
inherited

Assign a proxy to an event queue.

Parameters
queueThe event queue that will handle this proxy

Assign proxy to event queue. Events coming from proxy will be queued in queue instead of the display's main queue.

See also: display_t::dispatch_queue().

Examples
proxy_wrapper.cpp.

◆ text_direction()

void zwp_input_method_context_v1_t::text_direction ( uint32_t  serial,
uint32_t  direction 
)
Parameters
serialserial of the latest known text input state
direction

Definition at line 4326 of file wayland-client-protocol-unstable.cpp.

Member Data Documentation

◆ commit_string_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::commit_string_since_version = 1
staticconstexpr

Minimum protocol version required for the commit_string function.

Definition at line 725 of file wayland-client-protocol-unstable.hpp.

◆ cursor_position_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::cursor_position_since_version = 1
staticconstexpr

Minimum protocol version required for the cursor_position function.

Definition at line 819 of file wayland-client-protocol-unstable.hpp.

◆ delete_surrounding_text_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::delete_surrounding_text_since_version = 1
staticconstexpr

Minimum protocol version required for the delete_surrounding_text function.

Definition at line 797 of file wayland-client-protocol-unstable.hpp.

◆ grab_keyboard_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::grab_keyboard_since_version = 1
staticconstexpr

Minimum protocol version required for the grab_keyboard function.

Definition at line 862 of file wayland-client-protocol-unstable.hpp.

◆ key_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::key_since_version = 1
staticconstexpr

Minimum protocol version required for the key function.

Definition at line 882 of file wayland-client-protocol-unstable.hpp.

◆ keysym_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::keysym_since_version = 1
staticconstexpr

Minimum protocol version required for the keysym function.

Definition at line 848 of file wayland-client-protocol-unstable.hpp.

◆ language_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::language_since_version = 1
staticconstexpr

Minimum protocol version required for the language function.

Definition at line 912 of file wayland-client-protocol-unstable.hpp.

◆ modifiers_map_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::modifiers_map_since_version = 1
staticconstexpr

Minimum protocol version required for the modifiers_map function.

Definition at line 829 of file wayland-client-protocol-unstable.hpp.

◆ modifiers_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::modifiers_since_version = 1
staticconstexpr

Minimum protocol version required for the modifiers function.

Definition at line 901 of file wayland-client-protocol-unstable.hpp.

◆ preedit_cursor_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::preedit_cursor_since_version = 1
staticconstexpr

Minimum protocol version required for the preedit_cursor function.

Definition at line 781 of file wayland-client-protocol-unstable.hpp.

◆ preedit_string_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::preedit_string_since_version = 1
staticconstexpr

Minimum protocol version required for the preedit_string function.

Definition at line 745 of file wayland-client-protocol-unstable.hpp.

◆ preedit_styling_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::preedit_styling_since_version = 1
staticconstexpr

Minimum protocol version required for the preedit_styling function.

Definition at line 764 of file wayland-client-protocol-unstable.hpp.

◆ text_direction_since_version

constexpr std::uint32_t wayland::zwp_input_method_context_v1_t::text_direction_since_version = 1
staticconstexpr

Minimum protocol version required for the text_direction function.

Definition at line 923 of file wayland-client-protocol-unstable.hpp.


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