Loading...
Searching...
No Matches
wayland::server::zwp_text_input_v1_t Class Reference

text input More...

`#include <wayland-server-protocol-unstable.hpp>`

Inherits wayland::server::resource_t.

## Public Member Functions

std::function< void(seat_t, surface_t)> & | on_activate ()
| request activation
std::function< void(seat_t)> & | on_deactivate ()
| request deactivation
std::function< void()> & | on_show_input_panel ()
| show input panels
std::function< void()> & | on_hide_input_panel ()
| hide input panels
std::function< void()> & | on_reset ()
| reset
std::function< void(std::string, uint32_t, uint32_t)> & | on_set_surrounding_text ()
| sets the surrounding text
std::function< void(zwp_text_input_v1_content_hint, zwp_text_input_v1_content_purpose)> & | on_set_content_type ()
| set content purpose and hint
std::function< void(int32_t, int32_t, int32_t, int32_t)> & | on_set_cursor_rectangle ()
std::function< void(std::string)> & | on_set_preferred_language ()
| sets preferred language
std::function< void(uint32_t)> & | on_commit_state ()
std::function< void(uint32_t, uint32_t)> & | on_invoke_action ()
void | enter (surface_t const &surface, bool post=true)
| enter event
void | leave (bool post=true)
| leave event
void | modifiers_map (array_t const &map, bool post=true)
| modifiers map
void | input_panel_state (uint32_t state, bool post=true)
| state of the input panel
void | preedit_string (uint32_t serial, std::string const &text, std::string const &commit, bool post=true)
| pre-edit
void | preedit_styling (uint32_t index, uint32_t length, zwp_text_input_v1_preedit_style const &style, bool post=true)
| pre-edit styling
void | preedit_cursor (int32_t index, bool post=true)
| pre-edit cursor
void | commit_string (uint32_t serial, std::string const &text, bool post=true)
| commit
void | cursor_position (int32_t index, int32_t anchor, bool post=true)
| set cursor to new position
void | delete_surrounding_text (int32_t index, uint32_t length, bool post=true)
| delete surrounding text
void | keysym (uint32_t serial, uint32_t time, uint32_t sym, keyboard_key_state const &state, uint32_t modifiers, bool post=true)
| keysym
void | language (uint32_t serial, std::string const &language, bool post=true)
| language
void | text_direction (uint32_t serial, zwp_text_input_v1_text_direction const &direction, bool post=true)
| text direction
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 | 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 | modifiers_map_since_version = 1
| Minimum protocol version required for the modifiers_map function.
static constexpr std::uint32_t | input_panel_state_since_version = 1
| Minimum protocol version required for the input_panel_state function.
static constexpr std::uint32_t | preedit_string_since_version = 1
| Minimum protocol version required for the preedit_string function.
static constexpr std::uint32_t | preedit_styling_since_version = 1
| Minimum protocol version required for the preedit_styling function.
static constexpr std::uint32_t | preedit_cursor_since_version = 1
| Minimum protocol version required for the preedit_cursor function.
static constexpr std::uint32_t | commit_string_since_version = 1
| Minimum protocol version required for the commit_string function.
static constexpr std::uint32_t | cursor_position_since_version = 1
| Minimum protocol version required for the cursor_position function.
static constexpr std::uint32_t | delete_surrounding_text_since_version = 1
| Minimum protocol version required for the delete_surrounding_text function.
static constexpr std::uint32_t | keysym_since_version = 1
| Minimum protocol version required for the keysym function.
static constexpr std::uint32_t | language_since_version = 1
| Minimum protocol version required for the language function.
static constexpr std::uint32_t | text_direction_since_version = 1
| Minimum protocol version required for the text_direction function.

## Detailed Description

text input

An object used for text input. Adds support for text input and input methods to applications. A text_input object is created from a wl_text_input_manager and corresponds typically to a text entry in an application.

Requests are used to activate/deactivate the text_input object and set state information like surrounding and selected text or the content type. The information about entered text is sent to the text_input object via the pre-edit and commit events. Using this interface removes the need for applications to directly process hardware key events and compose text out of them.

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 6433 of file wayland-server-protocol-unstable.hpp.

## Member Function Documentation

## commit_string()

void zwp_text_input_v1_t::commit_string | ( | uint32_t | serial,
|  | std::string const & | text,
|  | bool | post = `true`
| ) |  |

commit

Parameters

  serial | serial of the latest known text input state
  text |

Notify when text should be inserted into the editor widget. 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 also be 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 should be removed.

Definition at line 7088 of file wayland-server-protocol-unstable.cpp.

## cursor_position()

void zwp_text_input_v1_t::cursor_position | ( | int32_t | index,
|  | int32_t | anchor,
|  | bool | post = `true`
| ) |  |

set cursor to new position

Parameters

  index |
  anchor |

Notify when the cursor or anchor position should be modified.

This event should be handled as part of a following commit_string event.

Definition at line 7093 of file wayland-server-protocol-unstable.cpp.

## delete_surrounding_text()

void zwp_text_input_v1_t::delete_surrounding_text | ( | int32_t | index,
|  | uint32_t | length,
|  | bool | post = `true`
| ) |  |

delete surrounding text

Parameters

  index |
  length |

Notify when the text around the current cursor position should be deleted.

Index is relative to the current cursor (in bytes). Length is the length of deleted text (in bytes).

This event should be handled as part of a following commit_string event.

Definition at line 7098 of file wayland-server-protocol-unstable.cpp.

## enter()

void zwp_text_input_v1_t::enter | ( | surface_t const & | surface,
|  | bool | post = `true`
| ) |  |

enter event

Parameters

  surface |

Notify the text_input object when it received focus. Typically in response to an activate request.

Definition at line 7053 of file wayland-server-protocol-unstable.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.

## input_panel_state()

void zwp_text_input_v1_t::input_panel_state | ( | uint32_t | state,
|  | bool | post = `true`
| ) |  |

state of the input panel

Parameters

  state |

Notify when the visibility state of the input panel changed.

Definition at line 7068 of file wayland-server-protocol-unstable.cpp.

## keysym()

void zwp_text_input_v1_t::keysym | ( | uint32_t | serial,
|  | uint32_t | time,
|  | uint32_t | sym,
|  | keyboard_key_state const & | state,
|  | uint32_t | modifiers,
|  | bool | post = `true`
| ) |  |

keysym

Parameters

  serial | serial 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 a wl_keyboard key_state. Modifiers are a mask for effective modifiers (where the modifier indices are set by the modifiers_map event)

Definition at line 7103 of file wayland-server-protocol-unstable.cpp.

## language()

void zwp_text_input_v1_t::language | ( | uint32_t | serial,
|  | std::string const & | language,
|  | bool | post = `true`
| ) |  |

language

Parameters

  serial | serial of the latest known text input state
  language |

Sets the language of the input text. The "language" argument is an RFC-3066 format language tag.

Definition at line 7108 of file wayland-server-protocol-unstable.cpp.

## leave()

void zwp_text_input_v1_t::leave | ( | bool | post = `true` | ) |

leave event

Notify the text_input object when it lost focus. Either in response to a deactivate request or when the assigned surface lost focus or was destroyed.

Definition at line 7058 of file wayland-server-protocol-unstable.cpp.

## modifiers_map()

void zwp_text_input_v1_t::modifiers_map | ( | array_t const & | map,
|  | bool | post = `true`
| ) |  |

modifiers map

Parameters

  map |

Transfer an array of 0-terminated modifier names. The position in the array is the index of the modifier as used in the modifiers bitmask in the keysym event.

Definition at line 7063 of file wayland-server-protocol-unstable.cpp.

## on_activate()

std::function< void(seat_t, surface_t)> & zwp_text_input_v1_t::on_activate | ( |  | ) |

request activation

Parameters

  seat |
  surface |

Requests the text_input object to be activated (typically when the text entry gets focus).

The seat argument is a wl_seat which maintains the focus for this activation. The surface argument is a wl_surface assigned to the text_input object and tracked for focus lost. The enter event is emitted on successful activation.

Definition at line 6987 of file wayland-server-protocol-unstable.cpp.

## on_commit_state()

std::function< void(uint32_t)> & zwp_text_input_v1_t::on_commit_state | ( |  | ) |

Parameters

  serial | used to identify the known state

Definition at line 7041 of file wayland-server-protocol-unstable.cpp.

## on_deactivate()

std::function< void(seat_t)> & zwp_text_input_v1_t::on_deactivate | ( |  | ) |

request deactivation

Parameters

  seat |

Requests the text_input object to be deactivated (typically when the text entry lost focus). The seat argument is a wl_seat which was used for activation.

Definition at line 6993 of file wayland-server-protocol-unstable.cpp.

## on_hide_input_panel()

std::function< void()> & zwp_text_input_v1_t::on_hide_input_panel | ( |  | ) |

hide input panels

Requests input panels (virtual keyboard) to hide.

Definition at line 7005 of file wayland-server-protocol-unstable.cpp.

## on_invoke_action()

std::function< void(uint32_t, uint32_t)> & zwp_text_input_v1_t::on_invoke_action | ( |  | ) |

Parameters

  button |
  index |

Definition at line 7047 of file wayland-server-protocol-unstable.cpp.

## on_reset()

std::function< void()> & zwp_text_input_v1_t::on_reset | ( |  | ) |

reset

Should be called by an editor widget when the input state should be reset, for example after the text was changed outside of the normal input method flow.

Definition at line 7011 of file wayland-server-protocol-unstable.cpp.

## on_set_content_type()

std::function< void(zwp_text_input_v1_content_hint, zwp_text_input_v1_content_purpose)> & zwp_text_input_v1_t::on_set_content_type | ( |  | ) |

set content purpose and hint

Parameters

  hint |
  purpose |

Sets the content purpose and content hint. While the purpose is the basic purpose of an input field, the hint flags allow to modify some of the behavior.

When no content type is explicitly set, a normal content purpose with default hints (auto completion, auto correction, auto capitalization) should be assumed.

Definition at line 7023 of file wayland-server-protocol-unstable.cpp.

## on_set_cursor_rectangle()

std::function< void(int32_t, int32_t, int32_t, int32_t)> & zwp_text_input_v1_t::on_set_cursor_rectangle | ( |  | ) |

Parameters

  x |
  y |
  width |
  height |

Definition at line 7029 of file wayland-server-protocol-unstable.cpp.

## on_set_preferred_language()

std::function< void(std::string)> & zwp_text_input_v1_t::on_set_preferred_language | ( |  | ) |

sets preferred language

Parameters

  language |

Sets a specific language. This allows for example a virtual keyboard to show a language specific layout. The "language" argument is an RFC-3066 format language tag.

It could be used for example in a word processor to indicate the language of the currently edited document or in an instant message application which tracks languages of contacts.

Definition at line 7035 of file wayland-server-protocol-unstable.cpp.

## on_set_surrounding_text()

std::function< void(std::string, uint32_t, uint32_t)> & zwp_text_input_v1_t::on_set_surrounding_text | ( |  | ) |

sets the surrounding text

Parameters

  text |
  cursor |
  anchor |

Sets the plain surrounding text around the input position. Text is UTF-8 encoded. Cursor is the byte offset within the surrounding text. Anchor is the byte offset of the selection anchor within the surrounding text. If there is no selected text anchor, then it is the same as cursor.

Definition at line 7017 of file wayland-server-protocol-unstable.cpp.

## on_show_input_panel()

std::function< void()> & zwp_text_input_v1_t::on_show_input_panel | ( |  | ) |

show input panels

Requests input panels (virtual keyboard) to show.

Definition at line 6999 of file wayland-server-protocol-unstable.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.

## preedit_cursor()

void zwp_text_input_v1_t::preedit_cursor | ( | int32_t | index,
|  | bool | post = `true`
| ) |  |

pre-edit cursor

Parameters

  index |

Sets the cursor position inside the composing text (as byte offset) relative to the start of the composing text. When index is a negative number no cursor is shown.

This event is handled as part of a following preedit_string event.

Definition at line 7083 of file wayland-server-protocol-unstable.cpp.

## preedit_string()

void zwp_text_input_v1_t::preedit_string | ( | uint32_t | serial,
|  | std::string const & | text,
|  | std::string const & | commit,
|  | bool | post = `true`
| ) |  |

pre-edit

Parameters

  serial | serial of the latest known text input state
  text |
  commit |

Notify when a new composing text (pre-edit) should be set around the current cursor position. Any previously set composing text should be removed.

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

The text input should also handle all preedit_style and preedit_cursor events occurring directly before preedit_string.

Definition at line 7073 of file wayland-server-protocol-unstable.cpp.

## preedit_styling()

void zwp_text_input_v1_t::preedit_styling | ( | uint32_t | index,
|  | uint32_t | length,
|  | zwp_text_input_v1_preedit_style const & | style,
|  | bool | post = `true`
| ) |  |

pre-edit styling

Parameters

  index |
  length |
  style |

Sets styling information on composing text. The style is applied for length bytes from index relative to the beginning of the composing text (as byte offset). Multiple styles can be applied to a composing text by sending multiple preedit_styling events.

This event is handled as part of a following preedit_string event.

Definition at line 7078 of file wayland-server-protocol-unstable.cpp.

## 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

## text_direction()

void zwp_text_input_v1_t::text_direction | ( | uint32_t | serial,
|  | zwp_text_input_v1_text_direction const & | direction,
|  | bool | post = `true`
| ) |  |

text direction

Parameters

  serial | serial of the latest known text input state
  direction |

Sets the text direction of input text.

It is mainly needed for showing an input cursor on the correct side of the editor when there is no input done yet and making sure neutral direction text is laid out properly.

Definition at line 7113 of file wayland-server-protocol-unstable.cpp.

## Member Data Documentation

## commit_string_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::commit_string_since_version = 1

static constexpr

Minimum protocol version required for the commit_string function.

Definition at line 6709 of file wayland-server-protocol-unstable.hpp.

## cursor_position_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::cursor_position_since_version = 1

static constexpr

Minimum protocol version required for the cursor_position function.

Definition at line 6725 of file wayland-server-protocol-unstable.hpp.

## delete_surrounding_text_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::delete_surrounding_text_since_version = 1

static constexpr

Minimum protocol version required for the delete_surrounding_text function.

Definition at line 6745 of file wayland-server-protocol-unstable.hpp.

## enter_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::enter_since_version = 1

static constexpr

Minimum protocol version required for the enter function.

Definition at line 6593 of file wayland-server-protocol-unstable.hpp.

## input_panel_state_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::input_panel_state_since_version = 1

static constexpr

Minimum protocol version required for the input_panel_state function.

Definition at line 6632 of file wayland-server-protocol-unstable.hpp.

## keysym_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::keysym_since_version = 1

static constexpr

Minimum protocol version required for the keysym function.

Definition at line 6766 of file wayland-server-protocol-unstable.hpp.

## language_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::language_since_version = 1

static constexpr

Minimum protocol version required for the language function.

Definition at line 6780 of file wayland-server-protocol-unstable.hpp.

## leave_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::leave_since_version = 1

static constexpr

Minimum protocol version required for the leave function.

Definition at line 6606 of file wayland-server-protocol-unstable.hpp.

## modifiers_map_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::modifiers_map_since_version = 1

static constexpr

Minimum protocol version required for the modifiers_map function.

Definition at line 6620 of file wayland-server-protocol-unstable.hpp.

## preedit_cursor_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::preedit_cursor_since_version = 1

static constexpr

Minimum protocol version required for the preedit_cursor function.

Definition at line 6690 of file wayland-server-protocol-unstable.hpp.

## preedit_string_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::preedit_string_since_version = 1

static constexpr

Minimum protocol version required for the preedit_string function.

Definition at line 6654 of file wayland-server-protocol-unstable.hpp.

## preedit_styling_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::preedit_styling_since_version = 1

static constexpr

Minimum protocol version required for the preedit_styling function.

Definition at line 6674 of file wayland-server-protocol-unstable.hpp.

## text_direction_since_version

constexpr std::uint32_t wayland::server::zwp_text_input_v1_t::text_direction_since_version = 1

static constexpr

Minimum protocol version required for the text_direction function.

Definition at line 6797 of file wayland-server-protocol-unstable.hpp.

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

- obj-x86_64-linux-gnu/wayland-server-protocol-unstable.hpp
- obj-x86_64-linux-gnu/wayland-server-protocol-unstable.cpp