From 3d00e1d784bd98d2e50c5cf075001e9a4c5bb347 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sun, 8 May 2022 00:29:43 +0200 Subject: [PATCH] Fix WIN32 define timing in IGFD When the compiler hits IGFD, WIN32 is only set if standard extensions are enabled. (Why?) IGFD identifies Windows via WIN32 instead of _WIN32. (Why?) - WIN32 is needed for #ifdef-gated Windows-specific methods in the header & code files. - There's fallback code in the code file to set WIN32 if _WIN32 or __WIN32__ is set. - Which is hit *after* the header gets included, so the header doesn't expose required methods. -> Boom, error! Workaround by moving the fallback into the header. --- extern/igfd/ImGuiFileDialog.cpp | 5 +---- extern/igfd/ImGuiFileDialog.h | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/extern/igfd/ImGuiFileDialog.cpp b/extern/igfd/ImGuiFileDialog.cpp index 98d6c909a..f4641e976 100644 --- a/extern/igfd/ImGuiFileDialog.cpp +++ b/extern/igfd/ImGuiFileDialog.cpp @@ -44,10 +44,7 @@ SOFTWARE. #if defined (__EMSCRIPTEN__) // EMSCRIPTEN #include #endif // EMSCRIPTEN -#if defined(__WIN32__) || defined(_WIN32) - #ifndef WIN32 - #define WIN32 - #endif // WIN32 +#ifdef WIN32 #define stat _stat #define stricmp _stricmp #include diff --git a/extern/igfd/ImGuiFileDialog.h b/extern/igfd/ImGuiFileDialog.h index 016bd9a10..e5ba92d0c 100644 --- a/extern/igfd/ImGuiFileDialog.h +++ b/extern/igfd/ImGuiFileDialog.h @@ -581,6 +581,12 @@ ImGuiFontStudio is using also ImGuiFileDialog. #ifndef IMGUIFILEDIALOG_H #define IMGUIFILEDIALOG_H +#if defined(__WIN32__) || defined(_WIN32) + #ifndef WIN32 + #define WIN32 + #endif // WIN32 +#endif // defined(__WIN32__) || defined(_WIN32) + #define IMGUIFILEDIALOG_VERSION "v0.6.4" #ifndef CUSTOM_IMGUIFILEDIALOG_CONFIG