Wayland++ 1.0.0
C++ Bindings for Wayland
|
text input More...
#include <wayland-client-protocol-unstable.hpp>
Public Types | |
enum class | wrapper_type { standard , display , foreign , proxy_wrapper } |
Public Member Functions | |
void | activate (seat_t const &seat, surface_t const &surface) |
request activation | |
void | deactivate (seat_t const &seat) |
request deactivation | |
void | show_input_panel () |
show input panels | |
void | hide_input_panel () |
hide input panels | |
void | reset () |
reset | |
void | set_surrounding_text (std::string const &text, uint32_t cursor, uint32_t anchor) |
sets the surrounding text | |
void | set_content_type (zwp_text_input_v1_content_hint const &hint, zwp_text_input_v1_content_purpose const &purpose) |
set content purpose and hint | |
void | set_cursor_rectangle (int32_t x, int32_t y, int32_t width, int32_t height) |
void | set_preferred_language (std::string const &language) |
sets preferred language | |
void | commit_state (uint32_t serial) |
void | invoke_action (uint32_t button, uint32_t index) |
std::function< void(surface_t)> & | on_enter () |
enter event | |
std::function< void()> & | on_leave () |
leave event | |
std::function< void(array_t)> & | on_modifiers_map () |
modifiers map | |
std::function< void(uint32_t)> & | on_input_panel_state () |
state of the input panel | |
std::function< void(uint32_t, std::string, std::string)> & | on_preedit_string () |
pre-edit | |
std::function< void(uint32_t, uint32_t, zwp_text_input_v1_preedit_style)> & | on_preedit_styling () |
pre-edit styling | |
std::function< void(int32_t)> & | on_preedit_cursor () |
pre-edit cursor | |
std::function< void(uint32_t, std::string)> & | on_commit_string () |
commit | |
std::function< void(int32_t, int32_t)> & | on_cursor_position () |
set cursor to new position | |
std::function< void(int32_t, uint32_t)> & | on_delete_surrounding_text () |
delete surrounding text | |
std::function< void(uint32_t, uint32_t, uint32_t, keyboard_key_state, uint32_t)> & | on_keysym () |
keysym | |
std::function< void(uint32_t, std::string)> & | on_language () |
language | |
std::function< void(uint32_t, zwp_text_input_v1_text_direction)> & | on_text_direction () |
text direction | |
uint32_t | get_id () const |
Get the id of a proxy object. | |
std::string | get_class () const |
Get the interface name (class) of a proxy object. | |
uint32_t | get_version () const |
Get the protocol object version of a proxy object. | |
wrapper_type | get_wrapper_type () const |
Get the type of a proxy object. | |
void | set_queue (event_queue_t queue) |
Assign a proxy to an event queue. | |
wl_proxy * | c_ptr () const |
Get a pointer to the underlying C struct. | |
bool | proxy_has_object () const |
Check whether this wrapper actually wraps an object. | |
operator bool () const | |
Check whether this wrapper actually wraps an object. | |
bool | operator== (const proxy_t &right) const |
Check whether two wrappers refer to the same object. | |
bool | operator!= (const proxy_t &right) const |
Check whether two wrappers refer to different objects. | |
void | proxy_release () |
Release the wrapped object (if any), making this an empty wrapper. | |
Static Public Attributes | |
static constexpr std::uint32_t | activate_since_version = 1 |
Minimum protocol version required for the activate function. | |
static constexpr std::uint32_t | deactivate_since_version = 1 |
Minimum protocol version required for the deactivate function. | |
static constexpr std::uint32_t | show_input_panel_since_version = 1 |
Minimum protocol version required for the show_input_panel function. | |
static constexpr std::uint32_t | hide_input_panel_since_version = 1 |
Minimum protocol version required for the hide_input_panel function. | |
static constexpr std::uint32_t | reset_since_version = 1 |
Minimum protocol version required for the reset function. | |
static constexpr std::uint32_t | set_surrounding_text_since_version = 1 |
Minimum protocol version required for the set_surrounding_text function. | |
static constexpr std::uint32_t | set_content_type_since_version = 1 |
Minimum protocol version required for the set_content_type function. | |
static constexpr std::uint32_t | set_cursor_rectangle_since_version = 1 |
Minimum protocol version required for the set_cursor_rectangle function. | |
static constexpr std::uint32_t | set_preferred_language_since_version = 1 |
Minimum protocol version required for the set_preferred_language function. | |
static constexpr std::uint32_t | commit_state_since_version = 1 |
Minimum protocol version required for the commit_state function. | |
static constexpr std::uint32_t | invoke_action_since_version = 1 |
Minimum protocol version required for the invoke_action function. | |
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 5625 of file wayland-client-protocol-unstable.hpp.
|
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 116 of file wayland-client.hpp.
request activation
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 8136 of file wayland-client-protocol-unstable.cpp.
|
inherited |
Get a pointer to the underlying C struct.
void zwp_text_input_v1_t::commit_state | ( | uint32_t | serial | ) |
serial | used to identify the known state |
Definition at line 8190 of file wayland-client-protocol-unstable.cpp.
void zwp_text_input_v1_t::deactivate | ( | seat_t const & | seat | ) |
request deactivation
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 8142 of file wayland-client-protocol-unstable.cpp.
|
inherited |
Get the interface name (class) of a proxy object.
|
inherited |
Get the id of a proxy object.
|
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.
|
inlineinherited |
Get the type of a proxy object.
Definition at line 302 of file wayland-client.hpp.
void zwp_text_input_v1_t::hide_input_panel | ( | ) |
hide input panels
Requests input panels (virtual keyboard) to hide.
Definition at line 8154 of file wayland-client-protocol-unstable.cpp.
void zwp_text_input_v1_t::invoke_action | ( | uint32_t | button, |
uint32_t | index ) |
button | |
index |
Definition at line 8196 of file wayland-client-protocol-unstable.cpp.
std::function< void(uint32_t, std::string)> & zwp_text_input_v1_t::on_commit_string | ( | ) |
commit
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 8237 of file wayland-client-protocol-unstable.cpp.
std::function< void(int32_t, int32_t)> & zwp_text_input_v1_t::on_cursor_position | ( | ) |
set cursor to new position
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 8242 of file wayland-client-protocol-unstable.cpp.
std::function< void(int32_t, uint32_t)> & zwp_text_input_v1_t::on_delete_surrounding_text | ( | ) |
delete surrounding text
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 8247 of file wayland-client-protocol-unstable.cpp.
std::function< void(surface_t)> & zwp_text_input_v1_t::on_enter | ( | ) |
enter event
surface |
Notify the text_input object when it received focus. Typically in response to an activate request.
Definition at line 8202 of file wayland-client-protocol-unstable.cpp.
std::function< void(uint32_t)> & zwp_text_input_v1_t::on_input_panel_state | ( | ) |
state of the input panel
state |
Notify when the visibility state of the input panel changed.
Definition at line 8217 of file wayland-client-protocol-unstable.cpp.
std::function< void(uint32_t, uint32_t, uint32_t, keyboard_key_state, uint32_t)> & zwp_text_input_v1_t::on_keysym | ( | ) |
keysym
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 8252 of file wayland-client-protocol-unstable.cpp.
std::function< void(uint32_t, std::string)> & zwp_text_input_v1_t::on_language | ( | ) |
language
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 8257 of file wayland-client-protocol-unstable.cpp.
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 8207 of file wayland-client-protocol-unstable.cpp.
std::function< void(array_t)> & zwp_text_input_v1_t::on_modifiers_map | ( | ) |
modifiers map
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 8212 of file wayland-client-protocol-unstable.cpp.
std::function< void(int32_t)> & zwp_text_input_v1_t::on_preedit_cursor | ( | ) |
pre-edit cursor
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 8232 of file wayland-client-protocol-unstable.cpp.
std::function< void(uint32_t, std::string, std::string)> & zwp_text_input_v1_t::on_preedit_string | ( | ) |
pre-edit
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 8222 of file wayland-client-protocol-unstable.cpp.
std::function< void(uint32_t, uint32_t, zwp_text_input_v1_preedit_style)> & zwp_text_input_v1_t::on_preedit_styling | ( | ) |
pre-edit styling
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 8227 of file wayland-client-protocol-unstable.cpp.
std::function< void(uint32_t, zwp_text_input_v1_text_direction)> & zwp_text_input_v1_t::on_text_direction | ( | ) |
text direction
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 8262 of file wayland-client-protocol-unstable.cpp.
|
inherited |
Check whether this wrapper actually wraps an object.
|
inherited |
Check whether two wrappers refer to different objects.
|
inherited |
Check whether two wrappers refer to the same object.
|
inherited |
Check whether this wrapper actually wraps an object.
|
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.
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 8160 of file wayland-client-protocol-unstable.cpp.
void zwp_text_input_v1_t::set_content_type | ( | zwp_text_input_v1_content_hint const & | hint, |
zwp_text_input_v1_content_purpose const & | purpose ) |
set content purpose and hint
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 8172 of file wayland-client-protocol-unstable.cpp.
void zwp_text_input_v1_t::set_cursor_rectangle | ( | int32_t | x, |
int32_t | y, | ||
int32_t | width, | ||
int32_t | height ) |
x | |
y | |
width | |
height |
Definition at line 8178 of file wayland-client-protocol-unstable.cpp.
void zwp_text_input_v1_t::set_preferred_language | ( | std::string const & | language | ) |
sets preferred language
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 8184 of file wayland-client-protocol-unstable.cpp.
|
inherited |
Assign a proxy to an event queue.
queue | The 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().
void zwp_text_input_v1_t::set_surrounding_text | ( | std::string const & | text, |
uint32_t | cursor, | ||
uint32_t | anchor ) |
sets the surrounding text
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 8166 of file wayland-client-protocol-unstable.cpp.
void zwp_text_input_v1_t::show_input_panel | ( | ) |
show input panels
Requests input panels (virtual keyboard) to show.
Definition at line 8148 of file wayland-client-protocol-unstable.cpp.
|
staticconstexpr |
Minimum protocol version required for the activate function.
Definition at line 5677 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the commit_state function.
Definition at line 5804 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the deactivate function.
Definition at line 5691 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the hide_input_panel function.
Definition at line 5713 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the invoke_action function.
Definition at line 5815 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the reset function.
Definition at line 5726 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_content_type function.
Definition at line 5763 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_cursor_rectangle function.
Definition at line 5776 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_preferred_language function.
Definition at line 5794 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_surrounding_text function.
Definition at line 5744 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the show_input_panel function.
Definition at line 5702 of file wayland-client-protocol-unstable.hpp.