From: Holger Schemel Date: Mon, 22 Apr 2019 10:47:58 +0000 (+0200) Subject: added pumping events when waiting for screen redraw X-Git-Tag: 4.1.3.0~10 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ed7934511c4ad252316e32e00af2ce89a40c5609;p=rocksndiamonds.git added pumping events when waiting for screen redraw This is required for executing event filter to update mouse position during actions without event handling (like fading screens). --- diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index fca1e8b9..f18b97b4 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -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); } diff --git a/src/libgame/system.c b/src/libgame/system.c index 8c8b7d5a..d6ede9ff 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -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()) diff --git a/src/libgame/system.h b/src/libgame/system.h index 30b37544..6c0490f3 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -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);