Skip to content

Commit

Permalink
fix(obj) improve how the focusing indev is determined
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Jul 13, 2021
1 parent b6bda5e commit a04f2de
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/lv_obj.c
Expand Up @@ -705,7 +705,12 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
editing = lv_group_get_editing(lv_obj_get_group(obj));
lv_state_t state = LV_STATE_FOCUSED;

lv_indev_t * indev = lv_event_get_indev(e);
/* Use the indev for then indev handler.
* But if the obj was focused manually it returns NULL so try to
* use the indev from the event*/
lv_indev_t * indev = lv_indev_get_act();
if(indev == NULL) indev = lv_event_get_indev(e);

lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_KEYPAD || indev_type == LV_INDEV_TYPE_ENCODER) state |= LV_STATE_FOCUS_KEY;
if(editing) {
Expand Down

0 comments on commit a04f2de

Please sign in to comment.