wayland::zwp_i...d_context_v1_t(3)

πŸ’… wayland::zwp_i...d_context_v1_t(3) β€” Wayland++

okay bestie, welcome to the Wayland++ manual page for wayland::zwp_i...d_context_v1_t. this is part 1 of 3, and we are keeping every single detail β€” no cap. it's giving very specific protocol energy, and honestly? iconic. πŸŽ€


✨ NAME ✨

wayland::zwp_input_method_context_v1_t β€” input method context. that's the name, bestie, and that's the vibe. πŸ’…


🌸 SYNOPSIS 🌸

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

Inherits wayland::proxy_t. periodt. 🫢

🧬 Public Types 🧬

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

πŸ› οΈ Public Member Functions πŸ› οΈ

  • void commit_string (uint32_t serial, std::string const &text) β€” commit string. yes bestie, it commits the string. πŸ’–
  • void preedit_string (uint32_t serial, std::string const &text, std::string const &commit) β€” pre-edit string. the pre-edit-era main character. ✨
  • void preedit_styling (uint32_t index, uint32_t length, zwp_text_input_v1_preedit_style const &style) β€” pre-edit styling. serving looks, literally. πŸ’…
  • void preedit_cursor (int32_t index) β€” pre-edit cursor. where the little cursor lives in pre-edit land. πŸŽ€
  • void delete_surrounding_text (int32_t index, uint32_t length) β€” delete text. bye-bye surrounding text. πŸ¦‹
  • void cursor_position (int32_t index, int32_t anchor) β€” set cursor to a new position. move it, move it. 🌸
  • void modifiers_map (array_t const &map) β€” the modifiers_map call. no extra one-liner in the source, just the signature, iykyk. 🫢
  • void keysym (uint32_t serial, uint32_t time, uint32_t sym, keyboard_key_state const &state, uint32_t modifiers) β€” keysym. keyboard lore. ⌨️
  • keyboard_t grab_keyboard () β€” grab hardware keyboard. highkey main character energy. πŸ‘‘
  • void key (uint32_t serial, uint32_t time, uint32_t key, keyboard_key_state const &state) β€” forward key event. sending it along. πŸ”₯
  • void modifiers (uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) β€” forward modifiers event. all the mods, bestie. πŸ’œ
  • void language (uint32_t serial, std::string const &language) β€” the language call. 🌈
  • void text_direction (uint32_t serial, uint32_t direction) β€” the text_direction call. ⭐
  • std::function< void(std::string, uint32_t, uint32_t)> & on_surrounding_text () β€” surrounding text event. πŸ‘€
  • std::function< void(zwp_text_input_v1_content_hint, zwp_text_input_v1_content_purpose)> & on_content_type () β€” the on_content_type handler. 🧚
  • std::function< void(uint32_t, uint32_t)> & on_invoke_action () β€” the on_invoke_action handler. πŸ’«
  • std::function< void(uint32_t)> & on_commit_state () β€” the on_commit_state handler. πŸŽ€
  • std::function< void(std::string)> & on_preferred_language () β€” the on_preferred_language handler. 🌸
  • 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. same energy, different syntax. 🫢
  • bool operator== (const proxy_t &right) const β€” Check whether two wrappers refer to the same object. twins fr fr. πŸ‘―
  • bool operator!= (const proxy_t &right) const β€” Check whether two wrappers refer to different objects. not twins. πŸ™ˆ
  • void proxy_release () β€” Release the wrapped object (if any), making this an empty wrapper. release the wrapper, bestie. πŸ•ŠοΈ

πŸ“Œ Static Public Attributes πŸ“Œ

  • static constexpr std::uint32_t commit_string_since_version = 1 β€” Minimum protocol version required for the commit_string 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 delete_surrounding_text_since_version = 1 β€” Minimum protocol version required for the delete_surrounding_text 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 modifiers_map_since_version = 1 β€” Minimum protocol version required for the modifiers_map function. 🧚
  • static constexpr std::uint32_t keysym_since_version = 1 β€” Minimum protocol version required for the keysym function. ⌨️
  • static constexpr std::uint32_t grab_keyboard_since_version = 1 β€” Minimum protocol version required for the grab_keyboard function. πŸ‘‘
  • static constexpr std::uint32_t key_since_version = 1 β€” Minimum protocol version required for the key function. πŸ”₯
  • static constexpr std::uint32_t modifiers_since_version = 1 β€” Minimum protocol version required for the modifiers 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 🧠

input method context. that's the whole name, and honestly it ate.

so okay: this 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. that part is important, bestie β€” handle deactivation and then clean up. πŸ’…

text is generally UTF-8 encoded, and indices and lengths are in bytes. not vibes, not characters β€” bytes. iykyk. πŸŽ€

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). literally a whole synchronization situation. πŸ”„

⚠️ 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. so yeah β€” experimental protocol, bestie. read the warning, don't ignore the warning. 🫢

Definition at line 705 of file wayland-client-protocol-unstable.hpp. πŸŽ€


πŸ” Member Enumeration Documentation πŸ”

enum class wayland::proxy_t::wrapper_type [strong], [inherited]

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 117 of file wayland-client.hpp. πŸ¦‹

πŸ’« Member Function Documentation πŸ’«

okay bestie, this is the big one β€” every single member function, in the order the page gives them. no skipping, no "you get the idea" β€” we're doing all of them because we're thorough like that πŸ’…


c_ptr

wl_proxy * wayland::proxy_t::c_ptr () const [inherited]

Grab a pointer to the underlying C struct. yep, the actual raw thing under all the C++ wrapping πŸ¦‹

Returns: the underlying wl_proxy wrapped by this proxy_t if it exists β€” and if it doesn't exist? an exception gets thrown. no vibes, just consequences 😭


commit_string

void zwp_input_method_context_v1_t::commit_string (uint32_t serial,
    std::string const & text)

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 you commit could be just a single character after a key press, or the result of some composing (pre-edit). It could also be an empty text β€” like when some text should be removed (see delete_surrounding_text) or when the input cursor should be moved (see cursor_position).

heads up: any previously set composing text will be removed πŸ‘€

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


cursor_position

void zwp_input_method_context_v1_t::cursor_position (int32_t index, int32_t
    anchor)

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 it's >= 0 that's relative to the end of the inserted text, otherwise it's relative to the beginning of the inserted text. anchor is the new anchor position in bytes β€” same deal, >= 0 means relative to the end of the inserted text, otherwise relative to the beginning of the inserted text. And when there should be no selected text, anchor should be the same as index. periodt βœ‹

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

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


delete_surrounding_text

void zwp_input_method_context_v1_t::delete_surrounding_text (int32_t index,
    uint32_t length)

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 4567 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 ✨


get_version

uint32_t wayland::proxy_t::get_version () const [inherited]

Get the protocol object version of a proxy object. It 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 there's no version information available, so the caller must make safe assumptions about the object's real version. no cap, that's on you to handle πŸ™ˆ

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 [inline],
    [inherited]

Get the type of a proxy object πŸ¦‹

Definition at line 303 of file wayland-client.hpp.


grab_keyboard

keyboard_t zwp_input_method_context_v1_t::grab_keyboard ()

grab hardware 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 is what lets input methods compose multiple key events for inputting text, the way it's done for CJK languages. iconic behavior honestly πŸ‘‘

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


key

void zwp_input_method_context_v1_t::key (uint32_t serial, uint32_t time,
    uint32_t key, keyboard_key_state const & state)

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. iykyk πŸ’…

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


keysym

void zwp_input_method_context_v1_t::keysym (uint32_t serial, uint32_t time,
    uint32_t sym, keyboard_key_state const & state, uint32_t modifiers)

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 β€” those 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 4585 of file wayland-client-protocol-unstable.cpp.


language

void zwp_input_method_context_v1_t::language (uint32_t serial, std::string
    const & language)

Parameters:

  • serial β€” serial of the latest known text input state
  • language

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


modifiers

void zwp_input_method_context_v1_t::modifiers (uint32_t serial, uint32_t
    mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t
    group)

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


modifiers_map

void zwp_input_method_context_v1_t::modifiers_map (array_t const & map)

Parameters:

  • map

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


on_commit_state

std::function< void(uint32_t)> &
    zwp_input_method_context_v1_t::on_commit_state ()

Parameters:

  • serial β€” serial of text input state

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


on_content_type

std::function< void(zwp_text_input_v1_content_hint,
    zwp_text_input_v1_content_purpose)> &
    zwp_input_method_context_v1_t::on_content_type ()

Parameters:

  • hint
  • purpose

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


on_invoke_action

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

Parameters:

  • button
  • index

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


on_preferred_language

std::function< void(std::string)> &
    zwp_input_method_context_v1_t::on_preferred_language ()

Parameters:

  • language

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


on_surrounding_text

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

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's no selected text then anchor is the same as cursor. easy πŸ’œ

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


operator bool

wayland::proxy_t::operator bool () const [inherited]

Check whether this wrapper actually wraps an object. the vibe check of wrappers, fr 🫢

Returns: true if there's 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.


preedit_cursor

void zwp_input_method_context_v1_t::preedit_cursor (int32_t index)

pre-edit cursor 🎯

Parameters:

  • index

Set the cursor position inside the composing text (as a 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 4561 of file wayland-client-protocol-unstable.cpp.


preedit_string

void zwp_input_method_context_v1_t::preedit_string (uint32_t serial,
    std::string const & text, std::string const & commit)

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. so like, they all show up together πŸ¦‹

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


preedit_styling

void zwp_input_method_context_v1_t::preedit_styling (uint32_t index,
    uint32_t length, zwp_text_input_v1_preedit_style const & style)

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


proxy_has_object

bool wayland::proxy_t::proxy_has_object () const [inherited]

Check whether this wrapper actually wraps an object. same energy as operator bool, different spelling πŸ’€

Returns: true if there's 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.

ngl there's a catch: display_t instances cannot be released this way. attempts to do so are ignored. so don't even try it 😭

Examples: foreign_display.cpp.


set_queue

void wayland::proxy_t::set_queue (event_queue_t queue) [inherited]

Assign a proxy to an event queue 🧚

Parameters:

  • 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().

Examples: proxy_wrapper.cpp.


text_direction

void zwp_input_method_context_v1_t::text_direction (uint32_t serial,
    uint32_t direction)

Parameters:

  • serial β€” serial of the latest known text input state
  • direction

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


πŸŽ€ Member Data Documentation πŸŽ€

okay bestie so these are all the little static constexpr version constants β€” every single one of them is = 1, because this whole protocol landed in version 1 like an absolute icon. They're basically tiny bouncers at the club door checking "is your protocol version at least this?" before letting the function in πŸ’…

  • std::uint32_t wayland::zwp_input_method_context_v1_t::commit_string_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the commit_string function. Defined at line 752 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::cursor_position_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the cursor_position function. Defined at line 846 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::delete_surrounding_text_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the delete_surrounding_text function. Defined at line 824 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::grab_keyboard_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the grab_keyboard function. Defined at line 889 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::key_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the key function. Defined at line 909 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::keysym_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the keysym function. Defined at line 875 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::language_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the language function. Defined at line 939 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::modifiers_map_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the modifiers_map function. Defined at line 856 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::modifiers_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the modifiers function. Defined at line 928 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::preedit_cursor_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the preedit_cursor function. Defined at line 808 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::preedit_string_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the preedit_string function. Defined at line 772 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::preedit_styling_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the preedit_styling function. Defined at line 791 of file wayland-client-protocol-unstable.hpp.
  • std::uint32_t wayland::zwp_input_method_context_v1_t::text_direction_since_version = 1 β€” [static], [constexpr] β€” the minimum protocol version required for the text_direction function. Defined at line 950 of file wayland-client-protocol-unstable.hpp.
🫢 lowkey obsessed with how every single one of these is 1 β€” consistent queen behavior, no notes.

πŸ‘‘ Author

Generated automatically by Doxygen for Wayland++ from the source code. like, the docs wrote themselves fr fr πŸ€–βœ¨


and that's a wrap on the whole page bestie!! πŸŽ€ source + version check: this is Version 1.0.1, dated Fri Mar 27 2026, from the Wayland++ fam β€” go forth and vibe with your input method contexts πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from