From 9849bfcabca0b7e14a8049f3a4c98ad2d6165117 Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Mon, 19 May 2025 16:29:28 +0200 Subject: [PATCH] Use SDL_EVENT_QUIT for window close --- ISLE/isleapp.cpp | 6 +++--- LEGO1/lego/legoomni/include/legomain.h | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index a16b6251..c85da6f6 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -416,6 +416,9 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) ); } break; + case SDL_EVENT_QUIT: + return SDL_APP_SUCCESS; + break; } if (event->user.type == g_legoSdlEvents.m_windowsMessage) { @@ -423,9 +426,6 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) case WM_ISLE_SETCURSOR: g_isle->SetupCursor((Cursor) (uintptr_t) event->user.data1); break; - case WM_QUIT: - return SDL_APP_SUCCESS; - break; case WM_TIMER: if (InputManager()) { InputManager()->QueueEvent(c_notificationTimer, (MxU8) (uintptr_t) event->user.data1, 0, 0, 0); diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 6ba6266e..adb640b2 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -8,6 +8,7 @@ #include "mxomni.h" #include +#include class Isle; class LegoAnimationManager; @@ -192,11 +193,13 @@ class LegoOmni : public MxOmni { void CloseMainWindow() { + SDL_QuitEvent quit; + quit.type = SDL_EVENT_QUIT; + quit.timestamp = SDL_GetTicksNS(); + SDL_Event event; - event.user.type = g_legoSdlEvents.m_windowsMessage; - event.user.code = WM_QUIT; - event.user.data1 = NULL; - event.user.data2 = NULL; + event.quit = quit; + SDL_PushEvent(&event); }