added pumping events when waiting for screen redraw
authorHolger Schemel <info@artsoft.org>
Mon, 22 Apr 2019 10:47:58 +0000 (12:47 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 22 Apr 2019 10:47:58 +0000 (12:47 +0200)
This is required for executing event filter to update mouse position
during actions without event handling (like fading screens).

src/libgame/sdl.c
src/libgame/system.c
src/libgame/system.h

index fca1e8b9f3e357c06f8ac4818344ed4f30efbaf0..f18b97b47afee8a1db1fc0e380b7b178a2f4397f 100644 (file)
@@ -224,6 +224,8 @@ static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay)
 
 static void UpdateScreen_WithFrameDelay(SDL_Rect *rect)
 {
+  PumpEvents();                // execute event filter actions while waiting
+
   UpdateScreenExt(rect, TRUE);
 }
 
index 8c8b7d5ac8515121bc647aec0ecb59b71c14924e..d6ede9ffd169ed8808177c144864940f957fe260 100644 (file)
@@ -1665,6 +1665,11 @@ void PeekEvent(Event *event)
   SDL_PeepEvents(event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
 }
 
+void PumpEvents(void)
+{
+  SDL_PumpEvents();
+}
+
 void CheckQuitEvent(void)
 {
   if (SDL_QuitRequested())
index 30b37544c32519abbc73f06692c4bb5511bdf0c2..6c0490f327e00c3ab1fd821cec9a46ec0ed20388 100644 (file)
@@ -1863,6 +1863,7 @@ void InitEventFilter(EventFilter);
 boolean PendingEvent(void);
 void WaitEvent(Event *event);
 void PeekEvent(Event *event);
+void PumpEvents(void);
 void CheckQuitEvent(void);
 Key GetEventKey(KeyEvent *, boolean);
 KeyMod HandleKeyModState(Key, int);