From cd4ee8ae49f7c3ba1441917decd2e4ebb804e4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 17 Mar 2025 08:43:12 +0100 Subject: [PATCH] ime: fix initial cursor rectangle being reported as 0,0,0,0 Closes #1994 --- CHANGELOG.md | 3 +++ ime.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 541096ec..8b55c42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -143,6 +143,8 @@ * Grapheme clustering state not reset on cursor movements. * Kitty keyboard protocol: no release events emitted for composed keys. +* IME: the initial cursor position was reported as 0,0,0,0 + ([#1994][1994]). [1918]: https://codeberg.org/dnkl/foot/issues/1918 [1929]: https://codeberg.org/dnkl/foot/issues/1929 @@ -151,6 +153,7 @@ [1960]: https://codeberg.org/dnkl/foot/issues/1960 [1956]: https://codeberg.org/dnkl/foot/issues/1956 [1963]: https://codeberg.org/dnkl/foot/issues/1963 +[1994]: https://codeberg.org/dnkl/foot/issues/1994 ### Security diff --git a/ime.c b/ime.c index 54cfa908..c6ccb479 100644 --- a/ime.c +++ b/ime.c @@ -68,6 +68,16 @@ enter(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, /* The main grid is the *only* input-receiving surface we have */ seat->ime_focus = term; + + const struct coord *cursor = &term->grid->cursor.point; + + term_ime_set_cursor_rect( + term, + term->margins.left + cursor->col * term->cell_width, + term->margins.top + cursor->row * term->cell_height, + term->cell_width, + term->cell_height); + ime_enable(seat); }