fix focusing/defocusing for pages

This commit is contained in:
Gabor Kiss-Vamosi
2020-06-24 11:24:07 +02:00
parent 9561aa767d
commit be19e91e91
3 changed files with 17 additions and 12 deletions

View File

@@ -1183,11 +1183,6 @@ static void indev_click_focus(lv_indev_proc_t * proc)
}
/*The object are not in the same group (in different group or one in not a group)*/
else {
/*Focus to the act. its group*/
if(g_act) {
lv_group_focus_obj(indev_obj_act);
if(indev_reset_check(proc)) return;
}
/*If the prev. obj. is not in a group then defocus it.*/
if(g_prev == NULL && proc->types.pointer.last_pressed) {
lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL);
@@ -1213,12 +1208,18 @@ static void indev_click_focus(lv_indev_proc_t * proc)
if(indev_reset_check(proc)) return;
}
}
}
/*Focus to the act. in its group*/
if(g_act) {
lv_group_focus_obj(indev_obj_act);
if(indev_reset_check(proc)) return;
} else {
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
if(indev_reset_check(proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
if(indev_reset_check(proc)) return;
}
}
}
#else
if(proc->types.pointer.last_pressed) {

View File

@@ -3752,7 +3752,6 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
lv_obj_clear_state(obj, LV_STATE_PRESSED);
}
#if LV_USE_GROUP
else if(sign == LV_SIGNAL_FOCUS) {
if(lv_group_get_editing(lv_obj_get_group(obj))) {
uint8_t state = LV_STATE_FOCUSED;
@@ -3779,7 +3778,6 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED);
}
#endif
else if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
}

View File

@@ -1054,10 +1054,16 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
}
}
else if(sign == LV_SIGNAL_DEFOCUS) {
res = lv_signal_send(page, LV_SIGNAL_DEFOCUS, NULL);
if(res != LV_RES_OK) return res;
res = lv_event_send(page, LV_EVENT_DEFOCUSED, NULL);
if(res != LV_RES_OK) return res;
bool in_group = false;
#if LV_USE_GROUP
in_group = lv_obj_get_group(page) ? true : false;
#endif
if(in_group == false) {
res = lv_signal_send(page, LV_SIGNAL_DEFOCUS, NULL);
if(res != LV_RES_OK) return res;
res = lv_event_send(page, LV_EVENT_DEFOCUSED, NULL);
if(res != LV_RES_OK) return res;
}
}
else if(sign == LV_SIGNAL_CLEANUP) {
page_ext->scrl = NULL;