---
name: "wayland_server_zwp_text_input_v1_t"
section: "3"
platform: "linux"
package: "waylandpp-dev"
version: "1.0.0-6+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/wayland_server_zwp_text_input_v1_t"
---

# wayland\_server\_zwp\_text\_input\_v1\_t(3)

text input

## NAME

wayland::server::zwp\_text\_input\_v1\_t - text input

## SYNOPSIS

`#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 **6432** of file **wayland-server-protocol-unstable.hpp**.

## Member Function Documentation

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

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

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

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

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

### client\_t wayland::server::resource\_t::get\_client () const` [inherited]`

Get the associated client

**Returns**

the client that owns the resource.

### uint32\_t wayland::server::resource\_t::get\_id () const` [inherited]`

Get the internal ID of the resource

**Returns**

the internal ID of the resource

### unsigned int wayland::server::resource\_t::get\_version () const` [inherited]`

Get interface version

**Returns**

Interface version this resource has been constructed with.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

## Author

Generated automatically by Doxygen for Wayland++ from the source code.
