1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-02-04 07:13:00 +08:00

Fix click focus

This commit is contained in:
Gabor Kiss-Vamosi 2020-10-02 10:54:53 +02:00
parent 0b1590d9ac
commit 79d72f9286
2 changed files with 6 additions and 5 deletions

View File

@ -7,6 +7,7 @@
- Fix copying base dir in `lv_obj_create` - Fix copying base dir in `lv_obj_create`
- Handle sub pixel rendering in font loader - Handle sub pixel rendering in font loader
- Fix transitions with style caching - Fix transitions with style caching
- Fix click focus
## v7.6.0 (22.09.2020) ## v7.6.0 (22.09.2020)

View File

@ -1162,14 +1162,14 @@ static void indev_click_focus(lv_indev_proc_t * proc)
if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false && if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false &&
proc->types.pointer.last_pressed != obj_to_focus) { proc->types.pointer.last_pressed != obj_to_focus) {
#if LV_USE_GROUP #if LV_USE_GROUP
lv_group_t * g_act = lv_obj_get_group(indev_obj_act); lv_group_t * g_act = lv_obj_get_group(obj_to_focus);
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL; lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
/*If both the last and act. obj. are in the same group (or no group but it's also the same) */ /*If both the last and act. obj. are in the same group (or no group but it's also the same) */
if(g_act == g_prev) { if(g_act == g_prev) {
/*The objects are in a group*/ /*The objects are in a group*/
if(g_act) { if(g_act) {
lv_group_focus_obj(indev_obj_act); lv_group_focus_obj(obj_to_focus);
if(indev_reset_check(proc)) return; if(indev_reset_check(proc)) return;
} }
/*The object are not in group*/ /*The object are not in group*/
@ -1218,7 +1218,7 @@ static void indev_click_focus(lv_indev_proc_t * proc)
/*Focus to the act. in its group*/ /*Focus to the act. in its group*/
if(g_act) { if(g_act) {
lv_group_focus_obj(indev_obj_act); lv_group_focus_obj(obj_to_focus);
if(indev_reset_check(proc)) return; if(indev_reset_check(proc)) return;
} }
else { else {
@ -1236,9 +1236,9 @@ static void indev_click_focus(lv_indev_proc_t * proc)
if(indev_reset_check(proc)) return; if(indev_reset_check(proc)) return;
} }
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL); lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
if(indev_reset_check(proc)) return; if(indev_reset_check(proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL); lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
if(indev_reset_check(proc)) return; if(indev_reset_check(proc)) return;
#endif #endif
proc->types.pointer.last_pressed = obj_to_focus; proc->types.pointer.last_pressed = obj_to_focus;