Skip to content

Commit 7aeb752

Browse files
committed
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.
1 parent effbb92 commit 7aeb752

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

source/graphics/TFT/TFTView_320x240.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,15 @@ void TFTView_320x240::ui_event_Keyboard(lv_event_t *e)
16781678
void TFTView_320x240::ui_event_message_ready(lv_event_t *e)
16791679
{
16801680
lv_event_code_t event_code = lv_event_get_code(e);
1681+
if (event_code == LV_EVENT_KEY) {
1682+
// LVGL's X11 driver maps only keypad enter to LV_KEY_ENTER; the main Return
1683+
// key arrives as raw '\r' and is silently dropped by the one-line textarea.
1684+
// Treat it as ready-to-send so a physical Enter submits the message.
1685+
uint32_t *key = (uint32_t *)lv_event_get_param(e);
1686+
if (!key || *key != '\r')
1687+
return;
1688+
event_code = LV_EVENT_READY;
1689+
}
16811690
if (event_code == LV_EVENT_READY) {
16821691
char *txt = (char *)lv_textarea_get_text(objects.message_input_area);
16831692
uint32_t len = strlen(txt);

0 commit comments

Comments
 (0)