From: Holger Schemel Date: Wed, 15 Nov 2017 20:09:05 +0000 (+0100) Subject: added fix to prevent Windows from complaining about program not responding X-Git-Tag: 4.0.1.1~28 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ca78975abfe7b2517a7c090a06abfdad065475b7;p=rocksndiamonds.git added fix to prevent Windows from complaining about program not responding --- diff --git a/src/init.c b/src/init.c index 2a5807a4..884ee541 100644 --- a/src/init.c +++ b/src/init.c @@ -97,6 +97,9 @@ void DrawInitAnim() int sync_frame = FrameCounter; int x, y; + /* prevent OS (Windows) from complaining about program not responding */ + CheckQuitEvent(); + if (game_status != GAME_MODE_LOADING) return; diff --git a/src/libgame/system.c b/src/libgame/system.c index 4f90a2d1..6d2b222a 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -1507,6 +1507,12 @@ void PeekEvent(Event *event) #endif } +void CheckQuitEvent(void) +{ + if (SDL_QuitRequested()) + program.exit_function(0); +} + Key GetEventKey(KeyEvent *event, boolean with_modifiers) { #if defined(TARGET_SDL2) diff --git a/src/libgame/system.h b/src/libgame/system.h index b2187d78..216ca6a6 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1546,6 +1546,7 @@ void SetAudioMode(boolean); boolean PendingEvent(void); void NextEvent(Event *event); void PeekEvent(Event *event); +void CheckQuitEvent(void); Key GetEventKey(KeyEvent *, boolean); KeyMod HandleKeyModState(Key, int); KeyMod GetKeyModState(); diff --git a/src/tools.c b/src/tools.c index 324bd45b..327d8843 100644 --- a/src/tools.c +++ b/src/tools.c @@ -4866,6 +4866,9 @@ unsigned int MoveDoor(unsigned int door_state) SkipUntilDelayReached(&door_delay, door_delay_value, &k, last_frame); current_move_delay += max_step_delay; + + /* prevent OS (Windows) from complaining about program not responding */ + CheckQuitEvent(); } if (door_part_done_all)