Wayland++
0.2.6
C++ Bindings for Wayland
|
text input More...
#include <wayland-client-protocol-unstable.hpp>
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... | |
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.
|
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.
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 7575 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 7620 of file wayland-client-protocol-unstable.cpp.
void zwp_text_input_v1_t::deactivate | ( | seat_t | 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 7580 of file wayland-client-protocol-unstable.cpp.
|
inherited |
Get the interface name (class) of a proxy object.
|
inherited |
|
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 288 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 7590 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 7625 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 7665 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 7670 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 7675 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 7630 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 7645 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 7680 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 7685 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 7635 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 7640 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 7660 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 7650 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 7655 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 7690 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 7595 of file wayland-client-protocol-unstable.cpp.
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
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.
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 7610 of file wayland-client-protocol-unstable.cpp.
void zwp_text_input_v1_t::set_preferred_language | ( | std::string | 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 7615 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 | 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 7600 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 7585 of file wayland-client-protocol-unstable.cpp.
|
staticconstexpr |
Minimum protocol version required for the activate function.
Definition at line 5269 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the commit_state function.
Definition at line 5396 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the deactivate function.
Definition at line 5283 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the hide_input_panel function.
Definition at line 5305 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the invoke_action function.
Definition at line 5407 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the reset function.
Definition at line 5318 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_content_type function.
Definition at line 5355 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_cursor_rectangle function.
Definition at line 5368 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_preferred_language function.
Definition at line 5386 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the set_surrounding_text function.
Definition at line 5336 of file wayland-client-protocol-unstable.hpp.
|
staticconstexpr |
Minimum protocol version required for the show_input_panel function.
Definition at line 5294 of file wayland-client-protocol-unstable.hpp.