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

text input More...

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

Inheritance diagram for wayland::zwp_text_input_v1_t:
Collaboration diagram for wayland::zwp_text_input_v1_t:

Public Types

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

Public Member Functions

void activate (seat_t seat, surface_t surface)
 request activation More...
 
void deactivate (seat_t seat)
 request deactivation More...
 
void show_input_panel ()
 show input panels More...
 
void hide_input_panel ()
 hide input panels More...
 
void reset ()
 reset More...
 
void set_surrounding_text (std::string text, uint32_t cursor, uint32_t anchor)
 sets the surrounding text More...
 
void set_content_type (zwp_text_input_v1_content_hint hint, zwp_text_input_v1_content_purpose purpose)
 set content purpose and hint More...
 
void set_cursor_rectangle (int32_t x, int32_t y, int32_t width, int32_t height)
 
void set_preferred_language (std::string language)
 sets preferred language More...
 
void commit_state (uint32_t serial)
 
void invoke_action (uint32_t button, uint32_t index)
 
std::function< void(surface_t)> & on_enter ()
 enter event More...
 
std::function< void()> & on_leave ()
 leave event More...
 
std::function< void(array_t)> & on_modifiers_map ()
 modifiers map More...
 
std::function< void(uint32_t)> & on_input_panel_state ()
 state of the input panel More...
 
std::function< void(uint32_t, std::string, std::string)> & on_preedit_string ()
 pre-edit More...
 
std::function< void(uint32_t, uint32_t, zwp_text_input_v1_preedit_style)> & on_preedit_styling ()
 pre-edit styling More...
 
std::function< void(int32_t)> & on_preedit_cursor ()
 pre-edit cursor More...
 
std::function< void(uint32_t, std::string)> & on_commit_string ()
 commit More...
 
std::function< void(int32_t, int32_t)> & on_cursor_position ()
 set cursor to new position More...
 
std::function< void(int32_t, uint32_t)> & on_delete_surrounding_text ()
 delete surrounding text More...
 
std::function< void(uint32_t, uint32_t, uint32_t, keyboard_key_state, uint32_t)> & on_keysym ()
 keysym More...
 
std::function< void(uint32_t, std::string)> & on_language ()
 language More...
 
std::function< void(uint32_t, zwp_text_input_v1_text_direction)> & on_text_direction ()
 text direction More...
 
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 activate_since_version = 1
 Minimum protocol version required for the activate function. More...
 
static constexpr std::uint32_t deactivate_since_version = 1
 Minimum protocol version required for the deactivate function. More...
 
static constexpr std::uint32_t show_input_panel_since_version = 1
 Minimum protocol version required for the show_input_panel function. More...
 
static constexpr std::uint32_t hide_input_panel_since_version = 1
 Minimum protocol version required for the hide_input_panel function. More...
 
static constexpr std::uint32_t reset_since_version = 1
 Minimum protocol version required for the reset function. More...
 
static constexpr std::uint32_t set_surrounding_text_since_version = 1
 Minimum protocol version required for the set_surrounding_text function. More...
 
static constexpr std::uint32_t set_content_type_since_version = 1
 Minimum protocol version required for the set_content_type function. More...
 
static constexpr std::uint32_t set_cursor_rectangle_since_version = 1
 Minimum protocol version required for the set_cursor_rectangle function. More...
 
static constexpr std::uint32_t set_preferred_language_since_version = 1
 Minimum protocol version required for the set_preferred_language function. More...
 
static constexpr std::uint32_t commit_state_since_version = 1
 Minimum protocol version required for the commit_state function. More...
 
static constexpr std::uint32_t invoke_action_since_version = 1
 Minimum protocol version required for the invoke_action function. More...
 

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

◆ activate()

void zwp_text_input_v1_t::activate ( seat_t  seat,
surface_t  surface 
)

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 7575 of file wayland-client-protocol-unstable.cpp.

◆ 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_state()

void zwp_text_input_v1_t::commit_state ( uint32_t  serial)
Parameters
serialused to identify the known state

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

◆ deactivate()

void zwp_text_input_v1_t::deactivate ( seat_t  seat)

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

◆ hide_input_panel()

void zwp_text_input_v1_t::hide_input_panel ( )

hide input panels

Requests input panels (virtual keyboard) to hide.

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

◆ invoke_action()

void zwp_text_input_v1_t::invoke_action ( uint32_t  button,
uint32_t  index 
)
Parameters
button
index

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

◆ on_commit_string()

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

commit

Parameters
serialserial 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 7665 of file wayland-client-protocol-unstable.cpp.

◆ on_cursor_position()

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

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 7670 of file wayland-client-protocol-unstable.cpp.

◆ on_delete_surrounding_text()

std::function< void(int32_t, uint32_t)> & zwp_text_input_v1_t::on_delete_surrounding_text ( )

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 7675 of file wayland-client-protocol-unstable.cpp.

◆ on_enter()

std::function< void(surface_t)> & zwp_text_input_v1_t::on_enter ( )

enter event

Parameters
surface

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

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

◆ on_input_panel_state()

std::function< void(uint32_t)> & zwp_text_input_v1_t::on_input_panel_state ( )

state of the input panel

Parameters
state

Notify when the visibility state of the input panel changed.

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

◆ on_keysym()

std::function< void(uint32_t, uint32_t, uint32_t, keyboard_key_state, uint32_t)> & zwp_text_input_v1_t::on_keysym ( )

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 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 7680 of file wayland-client-protocol-unstable.cpp.

◆ on_language()

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

language

Parameters
serialserial 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 7685 of file wayland-client-protocol-unstable.cpp.

◆ on_leave()

std::function< void()> & zwp_text_input_v1_t::on_leave ( )

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 7635 of file wayland-client-protocol-unstable.cpp.

◆ on_modifiers_map()

std::function< void(array_t)> & zwp_text_input_v1_t::on_modifiers_map ( )

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 7640 of file wayland-client-protocol-unstable.cpp.

◆ on_preedit_cursor()

std::function< void(int32_t)> & zwp_text_input_v1_t::on_preedit_cursor ( )

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 7660 of file wayland-client-protocol-unstable.cpp.

◆ on_preedit_string()

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

pre-edit

Parameters
serialserial 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 7650 of file wayland-client-protocol-unstable.cpp.

◆ on_preedit_styling()

std::function< void(uint32_t, uint32_t, zwp_text_input_v1_preedit_style)> & zwp_text_input_v1_t::on_preedit_styling ( )

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 7655 of file wayland-client-protocol-unstable.cpp.

◆ on_text_direction()

std::function< void(uint32_t, zwp_text_input_v1_text_direction)> & zwp_text_input_v1_t::on_text_direction ( )

text direction

Parameters
serialserial 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 7690 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.

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

◆ reset()

void zwp_text_input_v1_t::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 7595 of file wayland-client-protocol-unstable.cpp.

◆ set_content_type()

void zwp_text_input_v1_t::set_content_type ( zwp_text_input_v1_content_hint  hint,
zwp_text_input_v1_content_purpose  purpose 
)

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 7605 of file wayland-client-protocol-unstable.cpp.

◆ set_cursor_rectangle()

void zwp_text_input_v1_t::set_cursor_rectangle ( int32_t  x,
int32_t  y,
int32_t  width,
int32_t  height 
)
Parameters
x
y
width
height

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

◆ set_preferred_language()

void zwp_text_input_v1_t::set_preferred_language ( std::string  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 7615 of file wayland-client-protocol-unstable.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.

◆ set_surrounding_text()

void zwp_text_input_v1_t::set_surrounding_text ( std::string  text,
uint32_t  cursor,
uint32_t  anchor 
)

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 7600 of file wayland-client-protocol-unstable.cpp.

◆ show_input_panel()

void zwp_text_input_v1_t::show_input_panel ( )

show input panels

Requests input panels (virtual keyboard) to show.

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

Member Data Documentation

◆ activate_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::activate_since_version = 1
staticconstexpr

Minimum protocol version required for the activate function.

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

◆ commit_state_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::commit_state_since_version = 1
staticconstexpr

Minimum protocol version required for the commit_state function.

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

◆ deactivate_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::deactivate_since_version = 1
staticconstexpr

Minimum protocol version required for the deactivate function.

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

◆ hide_input_panel_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::hide_input_panel_since_version = 1
staticconstexpr

Minimum protocol version required for the hide_input_panel function.

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

◆ invoke_action_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::invoke_action_since_version = 1
staticconstexpr

Minimum protocol version required for the invoke_action function.

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

◆ reset_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::reset_since_version = 1
staticconstexpr

Minimum protocol version required for the reset function.

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

◆ set_content_type_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::set_content_type_since_version = 1
staticconstexpr

Minimum protocol version required for the set_content_type function.

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

◆ set_cursor_rectangle_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::set_cursor_rectangle_since_version = 1
staticconstexpr

Minimum protocol version required for the set_cursor_rectangle function.

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

◆ set_preferred_language_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::set_preferred_language_since_version = 1
staticconstexpr

Minimum protocol version required for the set_preferred_language function.

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

◆ set_surrounding_text_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::set_surrounding_text_since_version = 1
staticconstexpr

Minimum protocol version required for the set_surrounding_text function.

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

◆ show_input_panel_since_version

constexpr std::uint32_t wayland::zwp_text_input_v1_t::show_input_panel_since_version = 1
staticconstexpr

Minimum protocol version required for the show_input_panel function.

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


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