mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-21 09:47:29 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user