From 3604aecf8fa6465f19475fab117336b41be5261c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20P=C3=B6chtrager?= Date: Sun, 9 Aug 2015 17:24:10 +0200 Subject: [PATCH] Minor Windows adjustments --- examples/opengl3_example/imgui_impl_glfw_gl3.cpp | 4 ++-- examples/opengl_example/imgui_impl_glfw.cpp | 4 ++-- examples/sdl_opengl_example/imgui_impl_sdl.cpp | 2 +- imgui.cpp | 16 ++++++++++++---- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp index 8b04febf..1713bd5c 100644 --- a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp +++ b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp @@ -7,7 +7,7 @@ // GL3W/GLFW #include #include -#ifdef _MSC_VER +#ifdef _WIN32 #undef APIENTRY #define GLFW_EXPOSE_NATIVE_WIN32 #define GLFW_EXPOSE_NATIVE_WGL @@ -253,7 +253,7 @@ bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks) io.RenderDrawListsFn = ImGui_ImplGlfwGL3_RenderDrawLists; io.SetClipboardTextFn = ImGui_ImplGlfwGL3_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplGlfwGL3_GetClipboardText; -#ifdef _MSC_VER +#ifdef _WIN32 io.ImeWindowHandle = glfwGetWin32Window(g_Window); #endif diff --git a/examples/opengl_example/imgui_impl_glfw.cpp b/examples/opengl_example/imgui_impl_glfw.cpp index 8338091e..331c7776 100644 --- a/examples/opengl_example/imgui_impl_glfw.cpp +++ b/examples/opengl_example/imgui_impl_glfw.cpp @@ -6,7 +6,7 @@ // GLFW #include -#ifdef _MSC_VER +#ifdef _WIN32 #undef APIENTRY #define GLFW_EXPOSE_NATIVE_WIN32 #define GLFW_EXPOSE_NATIVE_WGL @@ -198,7 +198,7 @@ bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks) io.RenderDrawListsFn = ImGui_ImplGlfw_RenderDrawLists; io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText; -#ifdef _MSC_VER +#ifdef _WIN32 io.ImeWindowHandle = glfwGetWin32Window(g_Window); #endif diff --git a/examples/sdl_opengl_example/imgui_impl_sdl.cpp b/examples/sdl_opengl_example/imgui_impl_sdl.cpp index 980b11dc..2392014f 100644 --- a/examples/sdl_opengl_example/imgui_impl_sdl.cpp +++ b/examples/sdl_opengl_example/imgui_impl_sdl.cpp @@ -198,7 +198,7 @@ bool ImGui_ImplSdl_Init(SDL_Window *window) io.SetClipboardTextFn = ImGui_ImplSdl_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplSdl_GetClipboardText; -#ifdef _MSC_VER +#ifdef _WIN32 SDL_SysWMinfo wmInfo; SDL_VERSION(&wmInfo.version); SDL_GetWindowWMInfo(window, &wmInfo); diff --git a/imgui.cpp b/imgui.cpp index 66944519..779fb584 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -725,7 +725,7 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars) #define IM_INT_MAX (2147483647) // Play it nice with Windows users. Notepad in 2015 still doesn't display text data with Unix-style \n. -#ifdef _MSC_VER +#ifdef _WIN32 #define IM_NEWLINE "\r\n" #else #define IM_NEWLINE "\n" @@ -8706,13 +8706,17 @@ void ImGui::Color(const char* prefix, unsigned int v) // PLATFORM DEPENDANT HELPERS //----------------------------------------------------------------------------- -#if defined(_MSC_VER) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) +#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) #ifndef _WINDOWS_ +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #include #endif +#ifdef _MSC_VER #pragma comment(lib, "user32") +#endif // Win32 API clipboard implementation static const char* GetClipboardTextFn_DefaultImpl() @@ -8782,14 +8786,18 @@ static void SetClipboardTextFn_DefaultImpl(const char* text) #endif -#if defined(_MSC_VER) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS) +#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS) #ifndef _WINDOWS_ +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #include #endif -#include +#include +#ifdef _MSC_VER #pragma comment(lib, "imm32") +#endif static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y) { diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 178d40ee..d8879cef 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -30,7 +30,7 @@ #endif // Play it nice with Windows users. Notepad in 2015 still doesn't display text data with Unix-style \n. -#ifdef _MSC_VER +#ifdef _WIN32 #define IM_NEWLINE "\r\n" #else #define IM_NEWLINE "\n" diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 4674cc68..275affc4 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -19,7 +19,7 @@ #include // vsnprintf, sscanf, printf #include // new (ptr) #ifndef alloca -#if defined(_MSC_VER) || defined(__MINGW32__) +#if _WIN32 #include // alloca #else #include // alloca