Don't generate SDL events on Atlas shutdown

WX may still generate mouse events after calling CVideoMode::Shutdown(),
so don't create SDL events triggering assertions.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2026-07-14 15:17:21 +02:00
parent 63629195ba
commit 6244d25f90
3 changed files with 18 additions and 0 deletions
+5
View File
@@ -963,6 +963,11 @@ SDL_Window* CVideoMode::GetWindow()
return m_Window;
}
bool CVideoMode::IsInitialized() const
{
return m_IsInitialised;
}
void CVideoMode::SetWindowIcon()
{
// The window icon should be kept outside of art/textures/, or else it will be converted
+1
View File
@@ -95,6 +95,7 @@ public:
int GetBPP() const;
bool IsVSyncEnabled() const;
bool IsInitialized() const;
int GetDesktopXRes() const;
int GetDesktopYRes() const;
@@ -118,6 +118,9 @@ MESSAGEHANDLER(GuiSwitchPage)
MESSAGEHANDLER(GuiMouseButtonEvent)
{
if (!g_VideoMode.IsInitialized())
return;
SDL_Event ev{};
ev.type = msg->pressed ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP;
ev.button.button = msg->button;
@@ -132,6 +135,9 @@ MESSAGEHANDLER(GuiMouseButtonEvent)
MESSAGEHANDLER(GuiMouseMotionEvent)
{
if (!g_VideoMode.IsInitialized())
return;
SDL_Event ev{};
ev.type = SDL_MOUSEMOTION;
float x, y;
@@ -143,6 +149,9 @@ MESSAGEHANDLER(GuiMouseMotionEvent)
MESSAGEHANDLER(GuiKeyEvent)
{
if (!g_VideoMode.IsInitialized())
return;
SDL_Event ev{};
ev.type = msg->pressed ? SDL_KEYDOWN : SDL_KEYUP;
ev.key.keysym.sym = static_cast<SDL_Keycode>(static_cast<int>(msg->sdlkey));
@@ -152,6 +161,9 @@ MESSAGEHANDLER(GuiKeyEvent)
MESSAGEHANDLER(GuiCharEvent)
{
if (!g_VideoMode.IsInitialized())
return;
// Simulate special 'text input' events in the SDL
// This isn't quite compatible with WXWidget's handling,
// so to avoid trouble we only send 'letter-like' ASCII input.