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

fix(sdl): handle if the window_id is not set correctly in SDL (#6194)

This commit is contained in:
Gabor Kiss-Vamosi 2024-05-24 05:45:06 +02:00 committed by GitHub
parent 39382719be
commit 16f79f4f04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 7 deletions

View File

@ -115,15 +115,16 @@ void _lv_sdl_keyboard_handler(SDL_Event * event)
lv_display_t * disp = _lv_sdl_get_disp_from_win_id(win_id);
/*Find a suitable indev*/
lv_indev_t * indev = lv_indev_get_next(NULL);
while(indev) {
if(lv_indev_get_display(indev) == disp && lv_indev_get_type(indev) == LV_INDEV_TYPE_KEYPAD) {
break;
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_KEYPAD) {
/*If disp is NULL for any reason use the first indev with the correct type*/
if(disp == NULL || lv_indev_get_display(indev) == disp) break;
}
indev = lv_indev_get_next(indev);
}
if(indev == NULL) return;
lv_sdl_keyboard_t * dsc = lv_indev_get_driver_data(indev);

View File

@ -132,8 +132,9 @@ void _lv_sdl_mouse_handler(SDL_Event * event)
/*Find a suitable indev*/
lv_indev_t * indev = lv_indev_get_next(NULL);
while(indev) {
if(lv_indev_get_display(indev) == disp && lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER) {
break;
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER) {
/*If disp is NULL for any reason use the first indev with the correct type*/
if(disp == NULL || lv_indev_get_display(indev) == disp) break;
}
indev = lv_indev_get_next(indev);
}

View File

@ -104,8 +104,9 @@ void _lv_sdl_mousewheel_handler(SDL_Event * event)
/*Find a suitable indev*/
lv_indev_t * indev = lv_indev_get_next(NULL);
while(indev) {
if(lv_indev_get_display(indev) == disp && lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
break;
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
/*If disp is NULL for any reason use the first indev with the correct type*/
if(disp == NULL || lv_indev_get_display(indev) == disp) break;
}
indev = lv_indev_get_next(indev);
}