improve widget_on_keydown

This commit is contained in:
lixianjing 2021-06-10 12:11:09 +08:00
parent 39a8c742f4
commit f3f8788a93
3 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,8 @@
2021/06/10
* 完善编辑器对左右键的处理。
* 完善widget\_on\_keydown优先处理焦点切换按钮。
2021/06/09
* 重构pages。
* 修复ui\_builder不能重入的问题。

View File

@ -2451,6 +2451,10 @@ ret_t widget_on_keydown(widget_t* widget, key_event_t* e) {
uint32_t key = e->key;
return_value_if_fail(widget != NULL && e != NULL, RET_BAD_PARAMS);
if (widget_on_keydown_general(widget, e) == RET_STOP) {
return RET_OK;
}
widget_ref(widget);
widget_map_key(widget, e);
if (e->e.type == EVT_KEY_DOWN) {
@ -2460,9 +2464,6 @@ ret_t widget_on_keydown(widget_t* widget, key_event_t* e) {
}
e->key = key;
if (ret != RET_STOP) {
ret = widget_on_keydown_general(widget, e);
}
} else if (e->e.type == EVT_KEY_LONG_PRESS) {
return_value_if_equal(widget_on_keydown_children(widget, e), RET_STOP);
ret = widget_on_keydown_after_children(widget, e);

View File

@ -636,7 +636,6 @@ static ret_t edit_on_key_down(widget_t* widget, key_event_t* e) {
edit_dispatch_value_change_event(widget, EVT_VALUE_CHANGING);
}
} else if (key < 128 && isprint(key)) {
app_type_t app_type = system_info()->app_type;
if (!input_method_is_native(input_method())) {
edit_input_char(widget, (wchar_t)key);
}