dev(sdl): release the mouse on window leave event

This commit is contained in:
Gabor Kiss-Vamosi 2023-10-04 23:27:25 +02:00
parent 9b06972104
commit f3b500179d

View File

@ -95,6 +95,9 @@ void _lv_sdl_mouse_handler(SDL_Event * event)
win_id = event->tfinger.windowID;
#endif
break;
case SDL_WINDOWEVENT:
win_id = event->window.windowID;
break;
default:
return;
}
@ -119,10 +122,18 @@ void _lv_sdl_mouse_handler(SDL_Event * event)
uint8_t zoom = lv_sdl_window_get_zoom(disp);
switch(event->type) {
case SDL_WINDOWEVENT:
if(event->window.event == SDL_WINDOWEVENT_LEAVE) {
indev_dev->left_button_down = false;
}
break;
case SDL_MOUSEBUTTONUP:
if(event->button.button == SDL_BUTTON_LEFT)
indev_dev->left_button_down = false;
break;
case SDL_WINDOWEVENT_LEAVE:
indev_dev->left_button_down = false;
break;
case SDL_MOUSEBUTTONDOWN:
if(event->button.button == SDL_BUTTON_LEFT) {
indev_dev->left_button_down = true;