From 218ce4ab8736e15ec0952224f90ac53a2af642a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 25 Dec 2020 22:03:52 +0100 Subject: [PATCH 1/2] wayland: log warning when compositor does not implement text-input --- wayland.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wayland.c b/wayland.c index f156533e..7dbf8593 100644 --- a/wayland.c +++ b/wayland.c @@ -1130,6 +1130,13 @@ wayl_init(const struct config *conf, struct fdm *fdm) goto out; } +#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED + if (wayl->text_input_manager == NULL) { + LOG_WARN("text input interface not implemented by compositor; " + "IME will be disabled"); + } +#endif + /* Trigger listeners registered when handling globals */ wl_display_roundtrip(wayl->display); From 2227e36c662d05c0a91ef6d98e8bee1ad625928d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 25 Dec 2020 22:04:19 +0100 Subject: [PATCH 2/2] =?UTF-8?q?ime:=20don=E2=80=99t=20call=20text-input=20?= =?UTF-8?q?functions=20when=20it=20isn=E2=80=99t=20available?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #259 --- CHANGELOG.md | 2 ++ ime.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c86c0eaf..92c35225 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ * Exit when the client application terminates, not when the TTY file descriptor is closed. +* Crash on compositors not implementing the _text input_ interface + (https://codeberg.org/dnkl/foot/issues/259). ### Security diff --git a/ime.c b/ime.c index 24237d69..9e2699f2 100644 --- a/ime.c +++ b/ime.c @@ -327,6 +327,9 @@ ime_reset(struct seat *seat) void ime_enable(struct seat *seat) { + if (unlikely(seat->wayl->text_input_manager == NULL)) + return; + struct terminal *term = seat->kbd_focus; assert(term != NULL); @@ -348,6 +351,9 @@ ime_enable(struct seat *seat) void ime_disable(struct seat *seat) { + if (unlikely(seat->wayl->text_input_manager == NULL)) + return; + ime_reset(seat); zwp_text_input_v3_disable(seat->wl_text_input);