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:
parent
39382719be
commit
16f79f4f04
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user