improve keyboard for window_manager_back_to_home

This commit is contained in:
xianjimli 2020-06-12 17:38:36 +08:00
parent 54c1c7af05
commit 8eaa3d2797
2 changed files with 33 additions and 2 deletions

View File

@ -2,11 +2,12 @@
* 2020/06/11
* 增加 app\_conf\_set\_wstr/app\_conf\_get\_wstr
* 完善 window\_manager\_back\_to\_home 对软键盘窗口的处理。
* 2020/06/11
* 完善conf\_io支持#name/#size
* 完善 conf\_io支持#name/#size
* 增加 dll 导出函数(感谢俊杰提供补丁)。
* 修改 canvas\_draw\_char\_impl baseline的BUG。
* 修改 canvas\_draw\_char\_impl baseline BUG。
* 完善文档。
* 2020/06/10

View File

@ -30,6 +30,9 @@
#include "base/window_manager.h"
#include "ui_loader/ui_builder_default.h"
static ret_t input_method_default_on_edit_destroy(void* ctx, event_t* e);
static ret_t input_method_default_on_keyboard_destroy(void* ctx, event_t* e);
static const char* input_type_to_keyboard_name(int32_t input_type) {
const char* keyboard = NULL;
@ -176,6 +179,7 @@ static ret_t input_type_open_keyboard(input_method_t* im, const char* keyboard_n
im->busy = TRUE;
widget_on(im->keyboard, EVT_WINDOW_OPEN, input_method_default_on_keyboard_open, im);
widget_on(im->keyboard, EVT_DESTROY, input_method_default_on_keyboard_destroy, im);
if ((p.y + widget->h) > im->keyboard->y) {
close_anim_hint = "vtranslate";
@ -279,6 +283,31 @@ static ret_t input_method_default_ensure_suggest_words(input_method_t* im) {
return RET_OK;
}
static ret_t input_method_default_on_keyboard_destroy(void* ctx, event_t* e) {
widget_t* widget = WIDGET(e->target);
input_method_t* im = (input_method_t*)ctx;
if (im->keyboard == widget) {
input_method_default_restore_win_position(im);
im->win = NULL;
im->widget = NULL;
im->keyboard = NULL;
}
return RET_REMOVE;
}
static ret_t input_method_default_on_edit_destroy(void* ctx, event_t* e) {
widget_t* widget = WIDGET(e->target);
input_method_t* im = (input_method_t*)ctx;
if(im->widget == widget) {
input_method_request(im, NULL);
}
return RET_REMOVE;
}
static ret_t input_method_default_request(input_method_t* im, widget_t* widget) {
if (im->widget == widget) {
return RET_OK;
@ -291,6 +320,7 @@ static ret_t input_method_default_request(input_method_t* im, widget_t* widget)
if (widget != NULL) {
im->widget = widget;
input_method_default_show_keyboard(im);
widget_on(widget, EVT_DESTROY, input_method_default_on_edit_destroy, im);
} else {
if (im->keyboard != NULL) {
idle_close_info_t* info = TKMEM_ZALLOC(idle_close_info_t);