1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix unexpeted DEFOCUS on lv_page

Fixes #1762
This commit is contained in:
Gabor Kiss-Vamosi 2020-09-04 13:06:10 +02:00
parent fb6e7deadf
commit 804c3c7994
2 changed files with 3 additions and 26 deletions

View File

@ -392,6 +392,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
new_obj->protect = copy->protect;
new_obj->gesture_parent = copy->gesture_parent;
new_obj->focus_parent = copy->focus_parent;
#if LV_USE_GROUP
/*Add to the same group*/

View File

@ -118,6 +118,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
/*Init the new page object*/
if(copy == NULL) {
ext->scrl = lv_cont_create(page, NULL);
lv_obj_set_focus_parent(ext->scrl, true);
lv_obj_set_drag(ext->scrl, true);
lv_obj_set_drag_throw(ext->scrl, true);
lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
@ -131,6 +132,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_set_signal_cb(page, lv_page_signal);
lv_obj_set_design_cb(page, lv_page_design);
lv_page_set_scrollbar_mode(page, ext->scrlbar.mode);
lv_theme_apply(page, LV_THEME_PAGE);
@ -1043,32 +1045,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
}
}
}
else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
if(lv_obj_get_group(page)) {
lv_group_focus_obj(page);
}
else
#endif
{
res = lv_signal_send(page, LV_SIGNAL_FOCUS, NULL);
if(res != LV_RES_OK) return res;
res = lv_event_send(page, LV_EVENT_FOCUSED, NULL);
if(res != LV_RES_OK) return res;
}
}
else if(sign == LV_SIGNAL_DEFOCUS) {
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;