From 8c3d48c5cdb2ae4e8bdbdc48f155f53d1a92973b Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 2 Dec 2020 18:52:50 +0100 Subject: ime: render pre-edit text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is done by allocating cells for the pre-edit text when receiving the text-input::done() call, and populating them by converting the utf-8 formatted pre-edit text to wchars. We also convert the pre-edit cursor position to cell positions (it can cover multiple cells). When rendering, we simply render the pre-edit cells on-top off the regular grid. While doing so, we also mark the underlying, “real”, cells as dirty, to ensure they are re-rendered when the pre-edit text is modified or removed. --- wayland.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'wayland.h') diff --git a/wayland.h b/wayland.h index b29bb8ab..51a6fad1 100644 --- a/wayland.h +++ b/wayland.h @@ -15,6 +15,9 @@ #include "fdm.h" +/* Forward declarations */ +struct terminal; + typedef tll(xkb_keycode_t) xkb_keycode_list_t; struct key_binding { @@ -225,18 +228,24 @@ struct seat { struct zwp_text_input_v3 *wl_text_input; struct { struct { - char *text; - int32_t cursor_begin; - int32_t cursor_end; + struct { + char *text; + int32_t cursor_begin; + int32_t cursor_end; + } pending; } preedit; struct { - char *text; + struct { + char *text; + } pending; } commit; struct { - uint32_t before_length; - uint32_t after_length; + struct { + uint32_t before_length; + uint32_t after_length; + } pending; } surrounding; uint32_t serial; -- cgit v1.3