add TK_KEY_LONG_PRESS_TIME

This commit is contained in:
lixianjing 2020-09-21 12:10:30 +08:00
parent b554ee26ed
commit af947f5b5d
3 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# 最新动态
* 2020/09/19
* 更新 dll 导出函数列表。
* 增加 TK\_KEY\_LONG\_PRESS\_TIME让触屏长按和键盘长按可以设置为不同的时间。
* 2020/09/18
* EVT\_VALUE\_WILL\_CHANGE、EVT\_VALUE\_CHANGING 和 EVT\_VALUE\_CHANGED 事件结构改为 value\_change\_event\_t从中可以获得旧值和新值。
* EVT\_VALUE\_WILL\_CHANGE 事件返回 RET\_STOP 可以阻止修改值。

View File

@ -67,7 +67,7 @@ static ret_t input_device_status_dispatch_long_press(input_device_status_t* ids)
key_pressed_info_t* iter = ids->pressed_info + i;
if (iter->key && !iter->emitted) {
uint64_t t = now - iter->time;
if (t >= TK_LONG_PRESS_TIME) {
if (t >= TK_KEY_LONG_PRESS_TIME) {
key_event_init(&evt, EVT_KEY_LONG_PRESS, widget, iter->key);
widget_on_keydown(widget, &evt);
log_debug("long press:%d\n", iter->key);
@ -105,7 +105,7 @@ static ret_t input_device_status_update_key_press_info(input_device_status_t* id
}
if (ids->long_press_check_timer == TK_INVALID_ID) {
ids->long_press_check_timer = timer_add(long_press_check_on_timer, ids, TK_LONG_PRESS_TIME);
ids->long_press_check_timer = timer_add(long_press_check_on_timer, ids, TK_KEY_LONG_PRESS_TIME);
}
} else {
return_value_if_fail(info != NULL, RET_BAD_PARAMS);

View File

@ -267,6 +267,9 @@ typedef struct _widget_animator_t widget_animator_t;
}
#define TK_LONG_PRESS_TIME 1000
#ifndef TK_KEY_LONG_PRESS_TIME
#define TK_KEY_LONG_PRESS_TIME TK_LONG_PRESS_TIME
#endif/*TK_KEY_LONG_PRESS_TIME*/
#ifdef WITH_WIDGET_TYPE_CHECK
#define TK_REF_VTABLE(vt) &(g_##vt##_vtable)