From 3a2fcc96049048788762184ac7ceb103f3cca622 Mon Sep 17 00:00:00 2001 From: David Chavez Date: Sun, 25 Sep 2022 18:12:38 +0200 Subject: [PATCH] Handle window closing event to stop SoH (#1556) * Handle window closing event to stop app * Address PR comments --- libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index fa657e40c..9de508a3f 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -304,6 +304,10 @@ static void gfx_sdl_handle_events(void) { #else SDL_GL_GetDrawableSize(wnd, &window_width, &window_height); #endif + } else if (event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(wnd)) { + // We listen specifically for main window close because closing main window + // on macOS does not trigger SDL_Quit. + is_running = false; } break; case SDL_DROPFILE: