From c4d53e04d8acc6b1e6db5c8b458da7b2b307c173 Mon Sep 17 00:00:00 2001 From: pelya Date: Sun, 2 Apr 2017 23:16:11 +0300 Subject: [PATCH] Fixed left-button-up event handled with one second delay if the game does not redraw the screen --- src/video/sdl_v.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index e7770fb976..374be67998 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -155,7 +155,11 @@ static void CheckPaletteAnim() static void DrawSurfaceToScreen() { int n = _num_dirty_rects; +#ifdef __ANDROID__ + if (n == 0 && !_left_button_down) return; // We have to update the screen regularly to receive mouse_up event on Android +#else if (n == 0) return; +#endif static int frameskip = 0; #ifdef __ANDROID__ @@ -179,7 +183,9 @@ static void DrawSurfaceToScreen() SDL_CALL SDL_BlitSurface(_sdl_screen, &_dirty_rects[i], _sdl_realscreen, &_dirty_rects[i]); } } - SDL_CALL SDL_UpdateRects(_sdl_realscreen, n, _dirty_rects); + static SDL_Rect dummy_rect = { 0, 0, 8, 8 }; + if (n > 0) SDL_CALL SDL_UpdateRects(_sdl_realscreen, n, _dirty_rects); + else SDL_CALL SDL_UpdateRects(_sdl_realscreen, 1, &dummy_rect); } }