Print precommit string in callback

This commit is contained in:
Phireh 2024-12-03 11:20:57 +01:00
commit 7817917cd1

View file

@ -105,12 +105,12 @@ void zwp_text_input_v3_leave_callback(void *data, struct zwp_text_input_v3 *text
void zwp_text_input_v3_preedit_string_callback(void *data, struct zwp_text_input_v3 *text_input, const char *text, int32_t cursor_begin, int32_t cursor_end)
{
fprintf(stdout, "ZWP text input v3 preedit string callback\n");
fprintf(stdout, "ZWP text input v3 preedit string callback with text %s\n", text);
}
void zwp_text_input_v3_commit_string_callback(void *data, struct zwp_text_input_v3 *text_input, const char *text)
{
fprintf(stdout, "ZWP text input v3 commit string callback\n");
fprintf(stdout, "ZWP text input v3 commit string callback with text %s\n", text);
}
void zwp_text_input_v3_delete_surrounding_text_callback(void *data, struct zwp_text_input_v3 *text_input, uint32_t before_length, uint32_t after_length)
@ -190,9 +190,15 @@ void leave_callback(void *data, struct wl_keyboard* kb, uint serial, struct wl_s
void key_callback(void *data, struct wl_keyboard *kb, uint serial, uint time, uint key, uint state)
{
/* TODO: This does *not* respect the system's language defaults. At least not in KDE.
* Wayland's own (terrible) documentation does not go into detail about languages:
* https://wayland-book.com/seat/xkb.html
/* NOTE: libxkbcommon provides the correct glyphs if:
1. The user is using the system layout without an IME, or
2. The user is using an IME, but the current key is the same for both languages.
If none of them are true, wayback will either use text-input-v3's callbacks instead, or
call both functions.
For example, if the user is using spanish IME on US keymap and inputs the letter A, key_callback
will be called normally. However trying to write ñ or à won't call this function at all.
*/
key += 8;
uint32_t layout = xkb_state_key_get_layout(xkb_state, key);