In an effort to better understand if we are handling quit messages, closing, and ending the game properly I reached the conclusion that this line in the Win32 event handling is useless for several reasons. In GM8.1 it is not possible for
game_end();to cause an event loop driven by functions like
io_handle();to break, the current event always finishes. If
game_isendingis true when this loop enters, meaning
game_end();was called, it can not have any effect anyway regardless of whether it posts a quit message to the loop. The only time it can possibly have any effect is when the engine's outer main loop calls it, which doesn't matter anyway because that loop is a while loop whose predicate is the same variable!
What is responsible for posting that quit message, now?
The quit message is only posted by the
WM_CLOSE event now if the setting to treat it as the Escape key is enabled. Otherwise the close button should not close the window.
If we don't post it, Win32-specific extensions can't pick up on the game ending without a hook.
Extensions do have the ability to check
enigma::game_isending but otherwise checking for WM_QUIT would not have worked before in the case that
game_end(); was called. Therefore, if we want such a hook for extensions, we either change the main loop to exit this way or we add our own hook, which was proposed in #997 by you.
@@ Coverage Diff @@ ## master #2054 +/- ## ========================================== + Coverage 30.93% 30.94% +0.01% ========================================== Files 197 197 Lines 19106 19106 ========================================== + Hits 5910 5913 +3 + Misses 13196 13193 -3
|Impacted Files||Coverage Δ|