src/window.c

changeset 9
6ad1a4213954
parent 7
9dd76cbd6c90
child 12
d89e0ebc76d2
     1.1 --- a/src/window.c	Tue Nov 07 20:24:08 2023 +0100
     1.2 +++ b/src/window.c	Tue Nov 07 20:59:10 2023 +0100
     1.3 @@ -28,6 +28,7 @@
     1.4  #include "ascension/window.h"
     1.5  #include "ascension/context.h"
     1.6  #include "ascension/error.h"
     1.7 +#include "ascension/utils.h"
     1.8  
     1.9  #include <cx/linked_list.h>
    1.10  #include <cx/printf.h>
    1.11 @@ -66,7 +67,9 @@
    1.12      SDL_Event event;
    1.13      while (SDL_PollEvent(&event)) {
    1.14          switch (event.type) {
    1.15 -        case SDL_QUIT:return false;
    1.16 +        case SDL_QUIT:
    1.17 +            asc_set_flag(&asc_context.flags, ASC_FLAG_QUIT);
    1.18 +            break;
    1.19          case SDL_WINDOWEVENT: {
    1.20              if (event.window.type == SDL_WINDOWEVENT_RESIZED)
    1.21                  asc_event_window_resized(
    1.22 @@ -93,7 +96,8 @@
    1.23              asc_window_sync(&asc_context.windows[i]);
    1.24          }
    1.25      }
    1.26 -    return true;
    1.27 +
    1.28 +    return !asc_test_flag(asc_context.flags, ASC_FLAG_QUIT);
    1.29  }
    1.30  
    1.31  void asc_window_settings_init_defaults(AscWindowSettings* settings) {

mercurial