Skip to content

Commit

Permalink
fix(sdl): fix keyboard handling
Browse files Browse the repository at this point in the history
was broken after lvgl#5363
  • Loading branch information
kisvegabor committed Feb 2, 2024
1 parent e4de2d2 commit e859956
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/drivers/sdl/lv_sdl_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,13 @@ static void sdl_keyboard_read(lv_indev_t * indev, lv_indev_data_t * data)
if(dev->dummy_read) {
dev->dummy_read = false;
data->state = LV_INDEV_STATE_RELEASED;
data->continue_reading = len > 0;
}
/*Send the pressed character*/
else if(len > 0) {
dev->dummy_read = true;
data->state = LV_INDEV_STATE_PRESSED;
data->key = dev->buf[0];
memmove(dev->buf, dev->buf + 1, len);
data->continue_reading = true;
}
}

Expand Down Expand Up @@ -152,7 +150,15 @@ void _lv_sdl_keyboard_handler(SDL_Event * event)
break;

}
lv_indev_read(indev);

size_t len = lv_strlen(dsc->buf);
while(len) {
lv_indev_read(indev);

/*Call again to handle dummy read in `sdl_keyboard_read`*/
lv_indev_read(indev);
len--;
}
}

/**
Expand Down

0 comments on commit e859956

Please sign in to comment.