# HG changeset patch # User Mike Becker # Date 1699387150 -3600 # Node ID 6ad1a4213954e50e0cfb6336e80e3676031d7055 # Parent 756b49205a2908ef233d74a3ff9a5049b51d86f6 use the context flag to quit the application diff -r 756b49205a29 -r 6ad1a4213954 src/ascension/window.h --- a/src/ascension/window.h Tue Nov 07 20:24:08 2023 +0100 +++ b/src/ascension/window.h Tue Nov 07 20:59:10 2023 +0100 @@ -63,7 +63,7 @@ /** * Dispatches events and synchronizes all initialized windows. * - * @return false, if one of the events is a QUIT event, true otherwise + * @return false, if the application wants to quit, true otherwise */ bool asc_loop_next(void); diff -r 756b49205a29 -r 6ad1a4213954 src/window.c --- a/src/window.c Tue Nov 07 20:24:08 2023 +0100 +++ b/src/window.c Tue Nov 07 20:59:10 2023 +0100 @@ -28,6 +28,7 @@ #include "ascension/window.h" #include "ascension/context.h" #include "ascension/error.h" +#include "ascension/utils.h" #include #include @@ -66,7 +67,9 @@ SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { - case SDL_QUIT:return false; + case SDL_QUIT: + asc_set_flag(&asc_context.flags, ASC_FLAG_QUIT); + break; case SDL_WINDOWEVENT: { if (event.window.type == SDL_WINDOWEVENT_RESIZED) asc_event_window_resized( @@ -93,7 +96,8 @@ asc_window_sync(&asc_context.windows[i]); } } - return true; + + return !asc_test_flag(asc_context.flags, ASC_FLAG_QUIT); } void asc_window_settings_init_defaults(AscWindowSettings* settings) {