diff --git a/imgui.cpp b/imgui.cpp index 4490177..740dc34 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -158,7 +158,6 @@ #include "imgui.h" #include // toupper -#include // INT_MAX #include // sqrt #include // intptr_t #include // vsnprintf @@ -292,6 +291,12 @@ #undef PI const float PI = 3.14159265358979323846f; +#ifdef INT_MAX +#define IM_INT_MAX INT_MAX +#else +#define IM_INT_MAX 2147483647 +#endif + // Math bits // We are keeping those static in the .cpp file so as not to leak them outside, in the case the user has implicit cast operators between ImVec2 and its own types. static inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x*rhs, lhs.y*rhs); } @@ -907,8 +912,8 @@ AutoFitFrames = 3; FocusIdxCounter = -1; - FocusIdxRequestCurrent = INT_MAX; - FocusIdxRequestNext = INT_MAX; + FocusIdxRequestCurrent = IM_INT_MAX; + FocusIdxRequestNext = IM_INT_MAX; DrawList = new ImDrawList(); } @@ -949,7 +954,7 @@ return false; // Process input at this point: TAB, Shift-TAB switch focus - if (FocusIdxRequestNext == INT_MAX && is_active && ImGui::IsKeyPressedMap(ImGuiKey_Tab)) + if (FocusIdxRequestNext == IM_INT_MAX && is_active && ImGui::IsKeyPressedMap(ImGuiKey_Tab)) { // Modulo on index will be applied at the end of frame once we've got the total counter of items. FocusIdxRequestNext = FocusIdxCounter + (g.IO.KeyShift ? -1 : +1); @@ -1826,9 +1831,9 @@ window->ItemWidthDefault = (float)(int)(window->Size.x > 0.0f ? window->Size.x * 0.65f : 250.0f); // Prepare for focus requests - if (window->FocusIdxRequestNext == INT_MAX || window->FocusIdxCounter == -1) + if (window->FocusIdxRequestNext == IM_INT_MAX || window->FocusIdxCounter == -1) { - window->FocusIdxRequestCurrent = INT_MAX; + window->FocusIdxRequestCurrent = IM_INT_MAX; } else { @@ -1836,7 +1841,7 @@ window->FocusIdxRequestCurrent = (window->FocusIdxRequestNext + mod) % mod; } window->FocusIdxCounter = -1; - window->FocusIdxRequestNext = INT_MAX; + window->FocusIdxRequestNext = IM_INT_MAX; ImGuiAabb title_bar_aabb = window->TitleBarAabb();