1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(group): fix indev guessing logic

This commit is contained in:
Gabor Kiss-Vamosi 2023-04-27 01:23:17 +02:00
parent b603fb90f1
commit 02a20152d3

View File

@ -474,17 +474,19 @@ static bool focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
*/ */
static lv_indev_t * get_indev(const lv_group_t * g) static lv_indev_t * get_indev(const lv_group_t * g)
{ {
lv_indev_t * indev_guess = NULL;
lv_indev_t * indev = lv_indev_get_next(NULL); lv_indev_t * indev = lv_indev_get_next(NULL);
while(indev) { while(indev) {
lv_indev_type_t indev_type = lv_indev_get_type(indev); lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(lv_indev_get_group(indev) == g) {
/*Prefer POINTER*/ /*Prefer POINTER*/
if(indev_type == LV_INDEV_TYPE_POINTER) return indev; if(indev_type == LV_INDEV_TYPE_POINTER) return indev;
if(lv_indev_get_group(indev) == g) {
indev_guess = indev;
} }
indev = lv_indev_get_next(indev); indev = lv_indev_get_next(indev);
} }
/*In lack of a better option use the first input device. (It can be NULL if there is no input device)*/ return indev_guess;
return lv_indev_get_next(NULL);
} }