From df4111ea7c5c7da0cd4eb80f5fe3510d798da401 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Wed, 9 Oct 2019 15:25:44 +0800 Subject: [PATCH] fix mledit soft keyboard return bug --- docs/changes.md | 1 + src/base/input_method.c | 2 +- src/ext_widgets/mledit/mledit.c | 4 ++++ src/streams/iostream_mem.h | 2 +- src/tkc/object.h | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/changes.md b/docs/changes.md index 56418aff2..3c2dcd2a2 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -2,6 +2,7 @@ * 2019/10/09 * slider 的min/max/value/step使用浮动数。 * combo\_box 增加item\_height属性(感谢朝泽提供补丁)。 + * 修改mledit软键盘回车的问题(感谢俊杰提供补丁)。 * 2019/10/08 * 增加istream buffered。 diff --git a/src/base/input_method.c b/src/base/input_method.c index ded39a29d..673cc5741 100644 --- a/src/base/input_method.c +++ b/src/base/input_method.c @@ -90,7 +90,7 @@ ret_t input_method_dispatch_action(input_method_t* im) { input_method_dispatch(im, &e); - if (im->engine != NULL && im->action_buton_text[0] == '\0') { + if (im->engine != NULL && im->engine->keys.size > 0) { char text[64]; tk_strncpy(text, im->engine->keys.str, sizeof(text) - 1); input_method_commit_text(im, text); diff --git a/src/ext_widgets/mledit/mledit.c b/src/ext_widgets/mledit/mledit.c index 80274946e..8e5c649ff 100644 --- a/src/ext_widgets/mledit/mledit.c +++ b/src/ext_widgets/mledit/mledit.c @@ -391,6 +391,10 @@ static ret_t mledit_on_event(widget_t* widget, event_t* e) { mledit_update_status(widget); break; } + case EVT_IM_ACTION : { + mledit_commit_str(widget, "\n"); + break; + } case EVT_KEY_UP: { break; } diff --git a/src/streams/iostream_mem.h b/src/streams/iostream_mem.h index e86e2a1f5..bfbbb1ba6 100644 --- a/src/streams/iostream_mem.h +++ b/src/streams/iostream_mem.h @@ -34,7 +34,7 @@ typedef struct _tk_iostream_mem_t tk_iostream_mem_t; * @class tk_iostream_mem_t * @parent tk_iostream_t * - * input stream base on mem + * iostream base on mem * */ struct _tk_iostream_mem_t { diff --git a/src/tkc/object.h b/src/tkc/object.h index e256996c8..6ca6ef673 100644 --- a/src/tkc/object.h +++ b/src/tkc/object.h @@ -554,6 +554,8 @@ float_t object_get_prop_float_by_path(object_t* obj, const char* path, float_t d #define OBJECT(obj) ((object_t*)(obj)) +#define OBJECT_UNREF(obj) if((obj) != NULL) { object_unref((object_t*)(obj)); (obj) = NULL; } + END_C_DECLS #endif /*TK_OBJECT_H*/