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

input method context More...

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

Inherits wayland::server::resource_t.

## Public Member Functions

std::function< void(uint32_t, std::string)> & | on_commit_string ()
| commit string
std::function< void(uint32_t, std::string, std::string)> & | on_preedit_string ()
| pre-edit string
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(int32_t, uint32_t)> & | on_delete_surrounding_text ()
| delete text
std::function< void(int32_t, int32_t)> & | on_cursor_position ()
| set cursor to a new position
std::function< void(array_t)> & | on_modifiers_map ()
std::function< void(uint32_t, uint32_t, uint32_t, keyboard_key_state, uint32_t)> & | on_keysym ()
| keysym
std::function< void(keyboard_t)> & | on_grab_keyboard ()
| grab hardware keyboard
std::function< void(uint32_t, uint32_t, uint32_t, keyboard_key_state)> & | on_key ()
| forward key event
std::function< void(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)> & | on_modifiers ()
| forward modifiers event
std::function< void(uint32_t, std::string)> & | on_language ()
std::function< void(uint32_t, uint32_t)> & | on_text_direction ()
void | surrounding_text (std::string const &text, uint32_t cursor, uint32_t anchor, bool post=true)
| surrounding text event
void | content_type (zwp_text_input_v1_content_hint const &hint, zwp_text_input_v1_content_purpose const &purpose, bool post=true)
void | invoke_action (uint32_t button, uint32_t index, bool post=true)
void | commit_state (uint32_t serial, bool post=true)
void | preferred_language (std::string const &language, bool post=true)
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 | surrounding_text_since_version = 1
| Minimum protocol version required for the surrounding_text function.
static constexpr std::uint32_t | reset_since_version = 1
| Minimum protocol version required for the reset function.
static constexpr std::uint32_t | content_type_since_version = 1
| Minimum protocol version required for the content_type function.
static constexpr std::uint32_t | invoke_action_since_version = 1
| Minimum protocol version required for the invoke_action 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 | preferred_language_since_version = 1
| Minimum protocol version required for the preferred_language function.

## Detailed Description

input method context

Corresponds to a text input on the input method side. An input method context is created on text input activation on the input method side. It allows receiving information about the text input from the application via events. Input method contexts do not keep state after deactivation and should be destroyed after deactivation is handled.

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

## Member Function Documentation

## commit_state()

void zwp_input_method_context_v1_t::commit_state | ( | uint32_t | serial,
|  | bool | post = `true`
| ) |  |

Parameters

  serial | serial of text input state

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

## content_type()

void zwp_input_method_context_v1_t::content_type | ( | zwp_text_input_v1_content_hint const & | hint,
|  | zwp_text_input_v1_content_purpose const & | purpose,
|  | bool | post = `true`
| ) |  |

Parameters

  hint |
  purpose |

Definition at line 4513 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.

## invoke_action()

void zwp_input_method_context_v1_t::invoke_action | ( | uint32_t | button,
|  | uint32_t | index,
|  | bool | post = `true`
| ) |  |

Parameters

  button |
  index |

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

## on_commit_string()

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

commit string

Parameters

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

Send the commit string text for insertion to the application.

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 be also 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 will be removed.

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

## on_cursor_position()

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

set cursor to a new position

Parameters

  index |
  anchor |

Set the cursor and anchor to a new position. Index is the new cursor position in bytes (when >= 0 this is relative to the end of the inserted text, otherwise it is relative to the beginning of the inserted text). Anchor is the new anchor position in bytes (when >= 0 this is relative to the end of the inserted text, otherwise it is relative to the beginning of the inserted text). When there should be no selected text, anchor should be the same as index.

This request will be handled on the text_input side directly following a commit_string request.

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

## on_delete_surrounding_text()

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

delete text

Parameters

  index |
  length |

Remove the surrounding text.

This request will be handled on the text_input side directly following a commit_string request.

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

## on_grab_keyboard()

std::function< void(keyboard_t)> & zwp_input_method_context_v1_t::on_grab_keyboard | ( |  | ) |

grab hardware keyboard

Parameters

  keyboard |

Allow an input method to receive hardware keyboard input and process key events to generate text events (with pre-edit) over the wire. This allows input methods which compose multiple key events for inputting text like it is done for CJK languages.

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

## on_key()

std::function< void(uint32_t, uint32_t, uint32_t, keyboard_key_state)> & zwp_input_method_context_v1_t::on_key | ( |  | ) |

forward key event

Parameters

  serial | serial from wl_keyboard::key
  time | time from wl_keyboard::key
  key | key from wl_keyboard::key
  state | state from wl_keyboard::key

Forward a wl_keyboard::key event to the client that was not processed by the input method itself. Should be used when filtering key events with grab_keyboard. The arguments should be the ones from the wl_keyboard::key event.

For generating custom key events use the keysym request instead.

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

## on_keysym()

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

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 is a wl_keyboard key_state.

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

## on_language()

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

Parameters

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

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

## on_modifiers()

std::function< void(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)> & zwp_input_method_context_v1_t::on_modifiers | ( |  | ) |

forward modifiers event

Parameters

  serial | serial from wl_keyboard::modifiers
  mods_depressed | mods_depressed from wl_keyboard::modifiers
  mods_latched | mods_latched from wl_keyboard::modifiers
  mods_locked | mods_locked from wl_keyboard::modifiers
  group | group from wl_keyboard::modifiers

Forward a wl_keyboard::modifiers event to the client that was not processed by the input method itself. Should be used when filtering key events with grab_keyboard. The arguments should be the ones from the wl_keyboard::modifiers event.

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

## on_modifiers_map()

std::function< void(array_t)> & zwp_input_method_context_v1_t::on_modifiers_map | ( |  | ) |

Parameters

  map |

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

## on_preedit_cursor()

std::function< void(int32_t)> & zwp_input_method_context_v1_t::on_preedit_cursor | ( |  | ) |

pre-edit cursor

Parameters

  index |

Set the cursor position inside the composing text (as byte offset) relative to the start of the composing text.

When index is negative no cursor should be displayed.

This request should be sent before sending a preedit_string request.

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

## on_preedit_string()

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

pre-edit string

Parameters

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

Send the pre-edit string text to the application text input.

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

Previously sent preedit_style and preedit_cursor requests are also processed by the text_input.

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

## on_preedit_styling()

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

pre-edit styling

Parameters

  index |
  length |
  style |

Set the styling information on composing text. The style is applied for length in bytes from index relative to the beginning of the composing text (as byte offset). Multiple styles can be applied to a composing text.

This request should be sent before sending a preedit_string request.

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

## on_text_direction()

std::function< void(uint32_t, uint32_t)> & zwp_input_method_context_v1_t::on_text_direction | ( |  | ) |

Parameters

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

Definition at line 4497 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.

## preferred_language()

void zwp_input_method_context_v1_t::preferred_language | ( | std::string const & | language,
|  | bool | post = `true`
| ) |  |

Parameters

  language |

Definition at line 4528 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

## surrounding_text()

void zwp_input_method_context_v1_t::surrounding_text | ( | std::string const & | text,
|  | uint32_t | cursor,
|  | uint32_t | anchor,
|  | bool | post = `true`
| ) |  |

surrounding text event

Parameters

  text |
  cursor |
  anchor |

The plain surrounding text around the input position. Cursor is the position in bytes within the surrounding text relative to the beginning of the text. Anchor is the position in bytes of the selection anchor within the surrounding text relative to the beginning of the text. If there is no selected text then anchor is the same as cursor.

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

## Member Data Documentation

## commit_state_since_version

constexpr std::uint32_t wayland::server::zwp_input_method_context_v1_t::commit_state_since_version = 1

static constexpr

Minimum protocol version required for the commit_state function.

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

## content_type_since_version

constexpr std::uint32_t wayland::server::zwp_input_method_context_v1_t::content_type_since_version = 1

static constexpr

Minimum protocol version required for the content_type function.

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

## invoke_action_since_version

constexpr std::uint32_t wayland::server::zwp_input_method_context_v1_t::invoke_action_since_version = 1

static constexpr

Minimum protocol version required for the invoke_action function.

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

## preferred_language_since_version

constexpr std::uint32_t wayland::server::zwp_input_method_context_v1_t::preferred_language_since_version = 1

static constexpr

Minimum protocol version required for the preferred_language function.

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

## reset_since_version

constexpr std::uint32_t wayland::server::zwp_input_method_context_v1_t::reset_since_version = 1

static constexpr

Minimum protocol version required for the reset function.

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

## surrounding_text_since_version

constexpr std::uint32_t wayland::server::zwp_input_method_context_v1_t::surrounding_text_since_version = 1

static constexpr

Minimum protocol version required for the surrounding_text function.

Definition at line 980 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