improve double click

This commit is contained in:
lixianjing 2023-03-20 18:37:08 +08:00
parent fce0869c8d
commit 8dad483a24
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,8 @@
# 最新动态 # 最新动态
2023/03/20
* 修复分发double_clicked事件时存在的野指针风险(感谢雨欣提供补丁)
2023/03/16 2023/03/16
* 完善JSON((感谢俊杰提供补丁) * 完善JSON((感谢俊杰提供补丁)

View File

@ -345,9 +345,10 @@ static ret_t input_device_status_dispatch_input_event(input_device_status_t* ids
if (delta_time < TK_DOUBLE_CLICK_TIME && tk_abs(delta_x) < TK_DOUBLE_CLICK_XY && if (delta_time < TK_DOUBLE_CLICK_TIME && tk_abs(delta_x) < TK_DOUBLE_CLICK_XY &&
tk_abs(delta_y) < TK_DOUBLE_CLICK_XY) { tk_abs(delta_y) < TK_DOUBLE_CLICK_XY) {
event_t* d_evt;
pointer_event_t double_click; pointer_event_t double_click;
e = pointer_event_init(&double_click, EVT_DOUBLE_CLICK, widget, evt->x, evt->y); d_evt = pointer_event_init(&double_click, EVT_DOUBLE_CLICK, widget, evt->x, evt->y);
widget_dispatch_event_to_target_recursive(widget, e); widget_dispatch_event_to_target_recursive(widget, d_evt);
log_debug("double clicked\n"); log_debug("double clicked\n");
} }