Fallback to X11 message box implementation when SDL fails

This commit is contained in:
2024-07-28 17:49:12 +03:00
committed by Ari Vuollet
parent 9bfa652567
commit ae77a6e579
3 changed files with 21 additions and 3 deletions

View File

@@ -475,7 +475,15 @@ DialogResult MessageBox::Show(Window* parent, const StringView& text, const Stri
int result = -1;
if (SDL_ShowMessageBox(&data, &result) != 0)
{
LOG(Error, "Failed to show message box: {0}", String(SDL_GetError()));
#if PLATFORM_LINUX
// Fallback to native messagebox implementation in case some system fonts are missing
if (SDLPlatform::UsesX11())
{
LOG(Warning, "Failed to show SDL message box: {0}", String(SDL_GetError()));
return ShowFallback(parent, text, caption, buttons, icon);
}
#endif
LOG(Error, "Failed to show SDL message box: {0}", String(SDL_GetError()));
return DialogResult::Abort;
}
if (result < 0)