From 26ac5de659671f57965a829505318e3c2c4e0b06 Mon Sep 17 00:00:00 2001 From: p0ns Date: Tue, 14 Jul 2026 01:17:31 -0300 Subject: [PATCH] fix: send message on main Return key in MUI composer (X11/native-tft) LVGL's X11 input driver maps only XK_KP_Enter to LV_KEY_ENTER; the main Return key falls through XLookupString as a raw '\r', which the one-line message textarea silently discards (lv_textarea.c one_line filter). As a result, typing worked but pressing Enter never sent the message - only the on-screen keyboard checkmark did (lv_keyboard sends LV_EVENT_READY directly). Handle LV_EVENT_KEY == '\r' in ui_event_message_ready and route it into the existing LV_EVENT_READY send logic. Keypad Enter is unaffected (its LV_KEY_ENTER already triggers a nested LV_EVENT_READY from the textarea class handler, and '\n' != '\r' avoids any double-send). The space+return CR_REPLACEMENT newline trick keeps working, now also with the physical Return key. --- source/graphics/TFT/TFTView_320x240.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/graphics/TFT/TFTView_320x240.cpp b/source/graphics/TFT/TFTView_320x240.cpp index 72f662e8..3dfa3c17 100644 --- a/source/graphics/TFT/TFTView_320x240.cpp +++ b/source/graphics/TFT/TFTView_320x240.cpp @@ -1678,6 +1678,15 @@ void TFTView_320x240::ui_event_Keyboard(lv_event_t *e) void TFTView_320x240::ui_event_message_ready(lv_event_t *e) { lv_event_code_t event_code = lv_event_get_code(e); + if (event_code == LV_EVENT_KEY) { + // LVGL's X11 driver maps only keypad enter to LV_KEY_ENTER; the main Return + // key arrives as raw '\r' and is silently dropped by the one-line textarea. + // Treat it as ready-to-send so a physical Enter submits the message. + uint32_t *key = (uint32_t *)lv_event_get_param(e); + if (!key || *key != '\r') + return; + event_code = LV_EVENT_READY; + } if (event_code == LV_EVENT_READY) { char *txt = (char *)lv_textarea_get_text(objects.message_input_area); uint32_t len = strlen(txt);