From 6ca1556d029c9db8ccca30249f41fa1cca2a3445 Mon Sep 17 00:00:00 2001 From: domgho Date: Sun, 29 Sep 2019 12:29:48 +0200 Subject: [PATCH 1/6] Nav: Fixed SetItemDefaultFocus() from not scrolling when item is partially visible. (#2814, #2812) --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index a51c91bb..e4638cc5 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -64,6 +64,8 @@ Other changes: - Nav: Fixed an issue with Gamepad navigation when the movement lead to a scroll and frame time > repeat rate. Triggering a new move request on the same frame as a move result lead to an incorrect calculation and loss of navigation id. (#6171) +- Nav: Fixed SetItemDefaultFocus() from not scrolling when item is partially visible. + (#2814, #2812) [@DomGries] - IO: Lifted constraint to call io.AddEventXXX functions from current context. (#4921, #5856, #6199) - InputText: Fixed not being able to use CTRL+Tab while an InputText() using Tab for completion or textinput is active (regresion from 1.89). diff --git a/imgui.cpp b/imgui.cpp index 8507c560..075adddd 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7505,7 +7505,7 @@ void ImGui::SetItemDefaultFocus() NavUpdateAnyRequestFlag(); // Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll) - if (!IsItemVisible()) + if (!window->ClipRect.Contains(g.LastItemData.Rect)) ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags_None); } From c426e322470f4e1577b620150c8aa865fb5c1632 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 13 Mar 2023 16:23:45 +0100 Subject: [PATCH 2/6] Tables: Fixed an issue where user's Y cursor movement within a hidden column would have side-effects. - Afaik the "to allow ImGuiListClipper to function" was added early during Tables development (prior to commit 55) and later replaced by support in ImGuiListCipper, it seems unnecessary. - Also removed RowPosY2 being accted in TableEndCell(). + Comments about 2bb9e35 + fix example bb224c8 --- docs/CHANGELOG.txt | 8 ++++++++ examples/example_emscripten_wgpu/main.cpp | 2 ++ imgui.h | 2 +- imgui_tables.cpp | 7 ++----- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e4638cc5..7b5aeff4 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -55,6 +55,12 @@ Other changes: - Nav: Tabbing now cycles through all items when ImGuiConfigFlags_NavEnableKeyboard is set. (#3092, #5759, #787) + While this was generally desired and requested by many, note that its addition means + that some types of UI may become more fastidious to use TAB key with, if the navigation + cursor cycles through too many items. You can mark items items as not tab-spottable: + - Public API: PushTabStop(false) / PopTabStop() + - Internal: PushItemFlag(ImGuiItemFlags_NoTabStop, true); + - Internal: Directly pass ImGuiItemFlags_NoTabStop to ItemAdd() for custom widgets. - Nav: Tabbing/Shift-Tabbing can more reliably be used to step out of an item that is not tab-stoppable. (#3092, #5759, #787) - Nav: Made Enter key submit the same type of Activation event as Space key, @@ -66,6 +72,8 @@ Other changes: result lead to an incorrect calculation and loss of navigation id. (#6171) - Nav: Fixed SetItemDefaultFocus() from not scrolling when item is partially visible. (#2814, #2812) [@DomGries] +- Tables: Fixed an issue where user's Y cursor movement within a hidden column would + have side-effects. - IO: Lifted constraint to call io.AddEventXXX functions from current context. (#4921, #5856, #6199) - InputText: Fixed not being able to use CTRL+Tab while an InputText() using Tab for completion or textinput is active (regresion from 1.89). diff --git a/examples/example_emscripten_wgpu/main.cpp b/examples/example_emscripten_wgpu/main.cpp index 265e84dc..729e759d 100644 --- a/examples/example_emscripten_wgpu/main.cpp +++ b/examples/example_emscripten_wgpu/main.cpp @@ -127,6 +127,8 @@ static bool InitWGPU() static void MainLoopStep(void* window) { + ImGuiIO& io = ImGui::GetIO(); + glfwPollEvents(); int width, height; diff --git a/imgui.h b/imgui.h index 66fda139..0fd3ce28 100644 --- a/imgui.h +++ b/imgui.h @@ -23,7 +23,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345') #define IMGUI_VERSION "1.89.4 WIP" -#define IMGUI_VERSION_NUM 18936 +#define IMGUI_VERSION_NUM 18937 #define IMGUI_HAS_TABLE /* diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 7b2671c0..0c247fa0 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1999,10 +1999,6 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n) window->WorkRect.Max.x = column->WorkMaxX; window->DC.ItemWidth = column->ItemWidth; - // To allow ImGuiListClipper to function we propagate our row height - if (!column->IsEnabled) - window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2); - window->SkipItems = column->IsSkipItems; if (column->IsSkipItems) { @@ -2049,7 +2045,8 @@ void ImGui::TableEndCell(ImGuiTable* table) else p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen; *p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x); - table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY); + if (column->IsEnabled) + table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY); column->ItemWidth = window->DC.ItemWidth; // Propagate text baseline for the entire row From 552969e33e043b05cf20161e8879e838f02c8bcf Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 14 Mar 2023 14:28:41 +0100 Subject: [PATCH 3/6] BeginTooltip: correctly testing return value of BeginTooltipEx() even though it always return true in current code. Amend 3b2f617 --- imgui.cpp | 3 ++- imgui_widgets.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 075adddd..823ad2fb 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9942,7 +9942,8 @@ void ImGui::EndTooltip() void ImGui::SetTooltipV(const char* fmt, va_list args) { - BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None); + if (!BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None)) + return; TextV(fmt, args); EndTooltip(); } diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 0279df23..8e5f5b75 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -5759,7 +5759,8 @@ void ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags { ImGuiContext& g = *GImGui; - BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None); + if (!BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None)) + return; const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text; if (text_end > text) { From cc2177de15d98c2b1f23ebc9de779639fad09030 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 14 Mar 2023 15:24:16 +0100 Subject: [PATCH 4/6] Debug Tools: Added io.ConfigDebugBeginReturnValueOnce / io.ConfigDebugBeginReturnValueLoop options. --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 24 ++++++++++++++++++++++++ imgui.h | 8 ++++++++ imgui_demo.cpp | 9 +++++++++ imgui_internal.h | 2 ++ 5 files changed, 45 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 7b5aeff4..a974e47e 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -81,6 +81,8 @@ Other changes: before and can accept the same data type. (#6183). - Drag and Drop: Clear drag and drop state as soon as delivery is accepted in order to avoid inteferences. (#5817, #6183) [@DimaKoltun] +- Debug Tools: Added io.ConfigDebugBeginReturnValueOnce / io.ConfigDebugBeginReturnValueLoop + options to simulate Begin/BeginChild returning false to facilitate debugging user behavior. - Backends: OpenGL3: Fixed restoration of a potentially deleted OpenGL program. If an active program was pending deletion, attempting to restore it would error. (#6220, #6224) [@Cyphall] - Backends: Win32: Use WM_NCMOUSEMOVE / WM_NCMOUSELEAVE to track mouse positions over diff --git a/imgui.cpp b/imgui.cpp index 823ad2fb..08106b90 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1230,6 +1230,8 @@ ImGuiIO::ImGuiIO() ConfigWindowsResizeFromEdges = true; ConfigWindowsMoveFromTitleBarOnly = false; ConfigMemoryCompactTimer = 60.0f; + ConfigDebugBeginReturnValueOnce = false; + ConfigDebugBeginReturnValueLoop = false; // Platform Functions // Note: Initialize() will setup default clipboard/ime handlers. @@ -4601,6 +4603,13 @@ void ImGui::NewFrame() Begin("Debug##Default"); IM_ASSERT(g.CurrentWindow->IsFallbackWindow == true); + // [DEBUG] When io.ConfigDebugBeginReturnValue is set, we make Begin()/BeginChild() return false at different level of the window-stack, + // allowing to validate correct Begin/End behavior in user code. + if (g.IO.ConfigDebugBeginReturnValueLoop) + g.DebugBeginReturnValueCullDepth = (g.DebugBeginReturnValueCullDepth == -1) ? 0 : ((g.DebugBeginReturnValueCullDepth + ((g.FrameCount % 4) == 0 ? 1 : 0)) % 10); + else + g.DebugBeginReturnValueCullDepth = -1; + CallContextHooks(&g, ImGuiContextHookType_NewFramePost); } @@ -6735,6 +6744,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->SkipItems = skip_items; } + // [DEBUG] io.ConfigDebugBeginReturnValue override return value to test Begin/End and BeginChild/EndChild behaviors. + // (The implicit fallback window is NOT automatically ended allowing it to always be able to receive commands without crashing) + if (!window->IsFallbackWindow && ((g.IO.ConfigDebugBeginReturnValueOnce && window_just_created) || (g.IO.ConfigDebugBeginReturnValueLoop && g.DebugBeginReturnValueCullDepth == g.CurrentWindowStack.Size))) + { + if (window->AutoFitFramesX > 0) { window->AutoFitFramesX++; } + if (window->AutoFitFramesY > 0) { window->AutoFitFramesY++; } + return false; + } + return !window->SkipItems; } @@ -8994,7 +9012,9 @@ static void ImGui::ErrorCheckEndFrameSanityChecks() { if (g.CurrentWindowStack.Size > 1) { + ImGuiWindow* window = g.CurrentWindowStack.back().Window; // <-- This window was not Ended! IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?"); + IM_UNUSED(window); while (g.CurrentWindowStack.Size > 1) End(); } @@ -13460,6 +13480,10 @@ void ImGui::ShowMetricsWindow(bool* p_open) } } + Checkbox("Debug Begin/BeginChild return value", &io.ConfigDebugBeginReturnValueLoop); + SameLine(); + MetricsHelpMarker("Some calls to Begin()/BeginChild() will return false.\n\nWill cycle through window depths then repeat. Windows should be flickering while running."); + TreePop(); } diff --git a/imgui.h b/imgui.h index 0fd3ce28..3dd3936d 100644 --- a/imgui.h +++ b/imgui.h @@ -1941,6 +1941,14 @@ struct ImGuiIO bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. float ConfigMemoryCompactTimer; // = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable. + // Debug options + // - tools to test correct Begin/End and BeginChild/EndChild behaviors. + // - presently Begn()/End() and BeginChild()EndChild() needs to ALWAYS be called in tandem, regardless of return value of BeginXXX() + // this is inconsistent with other BeginXXX functions and create confusion for many users. + // - we expect to update the API eventually. In the meanwhile we provided tools to facilitate checking user-code behavior. + bool ConfigDebugBeginReturnValueOnce; // = false // First-time calls to Begin()/BeginChild() will return false. NEEDS TO BE SET AT APPLICATION BOOT TIME if you don't want to miss windows. + bool ConfigDebugBeginReturnValueLoop; // = false // Some calls to Begin()/BeginChild() will return false. Will cycle through window depths then repeat. Suggested use: add "io.ConfigDebugBeginReturnValue = io.KeyShift" in your main loop then occasionally press SHIFT. Windows should be flickering while running. + //------------------------------------------------------------------ // Platform Functions // (the imgui_impl_xxxx backend files are setting those up for you) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 50082d74..cf3f59dc 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -463,6 +463,15 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly); ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors); ImGui::Text("Also see Style->Rendering for rendering options."); + + ImGui::SeparatorText("Debug"); + ImGui::BeginDisabled(); + ImGui::Checkbox("io.ConfigDebugBeginReturnValueOnce", &io.ConfigDebugBeginReturnValueOnce); // . + ImGui::EndDisabled(); + ImGui::SameLine(); HelpMarker("First calls to Begin()/BeginChild() will return false.\n\nTHIS OPTION IS DISABLED because it needs to be set at application boot-time to make sense. Showing the disabled option is a way to make this feature easier to discover"); + ImGui::Checkbox("io.ConfigDebugBeginReturnValueLoop", &io.ConfigDebugBeginReturnValueLoop); + ImGui::SameLine(); HelpMarker("Some calls to Begin()/BeginChild() will return false.\n\nWill cycle through window depths then repeat. Windows should be flickering while running."); + ImGui::TreePop(); ImGui::Spacing(); } diff --git a/imgui_internal.h b/imgui_internal.h index dd152192..c11286dd 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1996,6 +1996,7 @@ struct ImGuiContext ImGuiTextIndex DebugLogIndex; ImU8 DebugLogClipperAutoDisableFrames; ImU8 DebugLocateFrames; // For DebugLocateItemOnHover(). This is used together with DebugLocateId which is in a hot/cached spot above. + ImS8 DebugBeginReturnValueCullDepth; // Cycle between 0..9 then wrap around. bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker()) ImU8 DebugItemPickerMouseButton; ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID @@ -2169,6 +2170,7 @@ struct ImGuiContext DebugLocateId = 0; DebugLogClipperAutoDisableFrames = 0; DebugLocateFrames = 0; + DebugBeginReturnValueCullDepth = -1; DebugItemPickerActive = false; DebugItemPickerMouseButton = ImGuiMouseButton_Left; DebugItemPickerBreakId = 0; From e39c2552ac8521328caa77df20cf39a1bf14e0d4 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 14 Mar 2023 15:56:38 +0100 Subject: [PATCH 5/6] Backends: GLFW: Avoid using glfwGetError() and glfwGetGamepadState() on Emscripten. (#6240) --- backends/imgui_impl_glfw.cpp | 8 +++++--- docs/CHANGELOG.txt | 4 +++- examples/example_apple_opengl2/main.mm | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/backends/imgui_impl_glfw.cpp b/backends/imgui_impl_glfw.cpp index f0e70a6d..29d502b0 100644 --- a/backends/imgui_impl_glfw.cpp +++ b/backends/imgui_impl_glfw.cpp @@ -16,6 +16,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2023-03-14: Emscripten: Avoid using glfwGetError() and glfwGetGamepadState() which are not correctly implemented in Emscripten emulation. (#6240) // 2023-02-03: Emscripten: Registering custom low-level mouse wheel handler to get more accurate scrolling impulses on Emscripten. (#4019, #6096) // 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty. // 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908) @@ -95,6 +96,7 @@ #endif #define GLFW_HAS_GAMEPAD_API (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwGetGamepadState() new api #define GLFW_HAS_GETKEYNAME (GLFW_VERSION_COMBINED >= 3200) // 3.2+ glfwGetKeyName() +#define GLFW_HAS_GETERROR (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwGetError() // GLFW data enum GlfwClientApi @@ -323,7 +325,7 @@ static int ImGui_ImplGlfw_TranslateUntranslatedKey(int key, int scancode) GLFWerrorfun prev_error_callback = glfwSetErrorCallback(nullptr); const char* key_name = glfwGetKeyName(key, scancode); glfwSetErrorCallback(prev_error_callback); -#if (GLFW_VERSION_COMBINED >= 3300) // Eat errors (see #5908) +#if GLFW_HAS_GETERROR && !defined(__EMSCRIPTEN__) // Eat errors (see #5908) (void)glfwGetError(NULL); #endif if (key_name && key_name[0] != 0 && key_name[1] == 0) @@ -536,7 +538,7 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); #endif glfwSetErrorCallback(prev_error_callback); -#if (GLFW_VERSION_COMBINED >= 3300) // Eat errors (see #5785) +#if GLFW_HAS_GETERROR && !defined(__EMSCRIPTEN__) // Eat errors (see #5908) (void)glfwGetError(NULL); #endif @@ -669,7 +671,7 @@ static void ImGui_ImplGlfw_UpdateGamepads() return; io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad; -#if GLFW_HAS_GAMEPAD_API +#if GLFW_HAS_GAMEPAD_API && !defined(__EMSCRIPTEN__) GLFWgamepadstate gamepad; if (!glfwGetGamepadState(GLFW_JOYSTICK_1, &gamepad)) return; diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index a974e47e..24e369d5 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -87,8 +87,10 @@ Other changes: program was pending deletion, attempting to restore it would error. (#6220, #6224) [@Cyphall] - Backends: Win32: Use WM_NCMOUSEMOVE / WM_NCMOUSELEAVE to track mouse positions over non-client area (e.g. OS decorations) when app is not focused. (#6045, #6162) -- Backends: SDL2, SDL3: Accept SDL_GetPerformanceCounter() not returning a monotonically +- Backends: SDL2, SDL3: Accept SDL_GetPerformanceCounter() not returning a monotonically increasing value. (#6189, #6114, #3644) [@adamkewley] +- Backends: GLFW: Avoid using glfwGetError() and glfwGetGamepadState() on Emscripten, which + recently updated its GLFW emulation layer to GLFW 3.3 without supporting those. (#6240) - Examples: Android: Fixed example build for Gradle 8. (#6229, #6227) [@duddel] - Examples: Updated all examples application to enable ImGuiConfigFlags_NavEnableKeyboard and ImGuiConfigFlags_NavEnableGamepad by default. (#787) diff --git a/examples/example_apple_opengl2/main.mm b/examples/example_apple_opengl2/main.mm index 11b5bf40..38739ff6 100644 --- a/examples/example_apple_opengl2/main.mm +++ b/examples/example_apple_opengl2/main.mm @@ -72,6 +72,7 @@ -(void)updateAndDrawDemoView { // Start the Dear ImGui frame + ImGuiIO& io = ImGui::GetIO(); ImGui_ImplOpenGL2_NewFrame(); ImGui_ImplOSX_NewFrame(self); ImGui::NewFrame(); From f3f6295d532b98e322691afb8ef418209d963786 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 14 Mar 2023 16:08:31 +0100 Subject: [PATCH 6/6] Version 1.89.4 Commented out obsolete enums/functions names: ImGuiSliderFlags_ClampOnInput, ImGuiInputTextFlags_AlwaysInsertMode, ImDrawList::AddBezierCurve(), ImDrawList::PathBezierCurveTo()() --- docs/CHANGELOG.txt | 16 +++++++++++----- imgui.cpp | 7 ++++++- imgui.h | 29 ++++++++++++----------------- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- imgui_internal.h | 2 +- imgui_tables.cpp | 2 +- imgui_widgets.cpp | 2 +- 8 files changed, 34 insertions(+), 28 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 24e369d5..c5b4e319 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -32,7 +32,7 @@ HOW TO UPDATE? ----------------------------------------------------------------------- - VERSION 1.89.4 WIP (In Progress) + VERSION 1.89.4 (Released 2023-03-14) ----------------------------------------------------------------------- Breaking Changes: @@ -42,7 +42,7 @@ Breaking Changes: - Moved the optional "courtesy maths operators" implementation from imgui_internal.h in imgui.h. Even though we encourage using your own maths types and operators by setting up IM_VEC2_CLASS_EXTRA, it has been frequently requested by people to use our own. We had an opt-in define which was - previously fulfilled in imgui_internal.h. It is now fulfilled in imgui.h. (#6164, #6137, #5966, #2832) + previously fulfilled by imgui_internal.h. It is now fulfilled by imgui.h. (#6164, #6137, #5966, #2832) OK: #define IMGUI_DEFINE_MATH_OPERATORS / #include "imgui.h" / #include "imgui_internal.h" Error: #include "imgui.h" / #define IMGUI_DEFINE_MATH_OPERATORS / #include "imgui_internal.h" Added a dedicated compile-time check message to help diagnose this. @@ -50,6 +50,11 @@ Breaking Changes: Please only submit contents and call EndTooltip() if BeginTooltip() returns true. In reality the function will _currently_ always return true, but further changes down the line may change this, best to clarify API sooner. Updated demo code accordingly. +- Commented out redirecting enums/functions names that were marked obsolete two years ago: + - ImGuiSliderFlags_ClampOnInput -> use ImGuiSliderFlags_AlwaysClamp + - ImGuiInputTextFlags_AlwaysInsertMode -> use ImGuiInputTextFlags_AlwaysOverwrite + - ImDrawList::AddBezierCurve() -> use ImDrawList::AddBezierCubic() + - ImDrawList::PathBezierCurveTo() -> use ImDrawList::PathBezierCubicCurveTo() Other changes: @@ -76,13 +81,14 @@ Other changes: have side-effects. - IO: Lifted constraint to call io.AddEventXXX functions from current context. (#4921, #5856, #6199) - InputText: Fixed not being able to use CTRL+Tab while an InputText() using Tab - for completion or textinput is active (regresion from 1.89). + for completion or text data is active (regression from 1.89). - Drag and Drop: Fixed handling of overlapping targets when smaller one is submitted before and can accept the same data type. (#6183). - Drag and Drop: Clear drag and drop state as soon as delivery is accepted in order to - avoid inteferences. (#5817, #6183) [@DimaKoltun] + avoid interferences. (#5817, #6183) [@DimaKoltun] - Debug Tools: Added io.ConfigDebugBeginReturnValueOnce / io.ConfigDebugBeginReturnValueLoop options to simulate Begin/BeginChild returning false to facilitate debugging user behavior. +- Demo: Updated to test return value of BeginTooltip(). - Backends: OpenGL3: Fixed restoration of a potentially deleted OpenGL program. If an active program was pending deletion, attempting to restore it would error. (#6220, #6224) [@Cyphall] - Backends: Win32: Use WM_NCMOUSEMOVE / WM_NCMOUSELEAVE to track mouse positions over @@ -94,7 +100,7 @@ Other changes: - Examples: Android: Fixed example build for Gradle 8. (#6229, #6227) [@duddel] - Examples: Updated all examples application to enable ImGuiConfigFlags_NavEnableKeyboard and ImGuiConfigFlags_NavEnableGamepad by default. (#787) -- Demo: Updated to test return value of BeginTooltip(). +- Internals: Misc tweaks to facilitate applying an explicit-context patch. (#5856) [@Dragnalith] ----------------------------------------------------------------------- diff --git a/imgui.cpp b/imgui.cpp index 08106b90..fa8580cd 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.4 WIP +// dear imgui, v1.89.4 // (main code and documentation) // Help: @@ -397,6 +397,11 @@ CODE When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. You can read releases logs https://github.com/ocornut/imgui/releases for more details. + - 2023/03/14 (1.89.4) - commented out redirecting enums/functions names that were marked obsolete two years ago: + - ImGuiSliderFlags_ClampOnInput -> use ImGuiSliderFlags_AlwaysClamp + - ImGuiInputTextFlags_AlwaysInsertMode -> use ImGuiInputTextFlags_AlwaysOverwrite + - ImDrawList::AddBezierCurve() -> use ImDrawList::AddBezierCubic() + - ImDrawList::PathBezierCurveTo() -> use ImDrawList::PathBezierCubicCurveTo() - 2023/03/09 (1.89.4) - renamed PushAllowKeyboardFocus()/PopAllowKeyboardFocus() to PushTabStop()/PopTabStop(). Kept inline redirection functions (will obsolete). - 2023/03/09 (1.89.4) - tooltips: Added 'bool' return value to BeginTooltip() for API consistency. Please only submit contents and call EndTooltip() if BeginTooltip() returns true. In reality the function will _currently_ always return true, but further changes down the line may change this, best to clarify API sooner. - 2023/02/15 (1.89.4) - moved the optional "courtesy maths operators" implementation from imgui_internal.h in imgui.h. diff --git a/imgui.h b/imgui.h index 3dd3936d..beb4feb1 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.89.4 WIP +// dear imgui, v1.89.4 // (headers) // Help: @@ -22,8 +22,8 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345') -#define IMGUI_VERSION "1.89.4 WIP" -#define IMGUI_VERSION_NUM 18937 +#define IMGUI_VERSION "1.89.4" +#define IMGUI_VERSION_NUM 18940 #define IMGUI_HAS_TABLE /* @@ -1015,10 +1015,8 @@ enum ImGuiInputTextFlags_ ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (contrast to default behavior of Escape to revert) - // Obsolete names (will be removed soon) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior -#endif + // Obsolete names + //ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior }; // Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() @@ -1670,8 +1668,8 @@ enum ImGuiColorEditFlags_ ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar, ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV, - // Obsolete names (will be removed) - // ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69] + // Obsolete names + //ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69] }; // Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc. @@ -1686,10 +1684,8 @@ enum ImGuiSliderFlags_ ImGuiSliderFlags_NoInput = 1 << 7, // Disable CTRL+Click or Enter key allowing to input text directly into the widget ImGuiSliderFlags_InvalidMask_ = 0x7000000F, // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed. - // Obsolete names (will be removed) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp, // [renamed in 1.79] -#endif + // Obsolete names + //ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp, // [renamed in 1.79] }; // Identify a mouse button. @@ -2649,10 +2645,9 @@ struct ImDrawList inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); } // OBSOLETED in 1.80 (Jan 2021) - inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segments); } // OBSOLETED in 1.80 (Jan 2021) -#endif + // Obsolete names + //inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); } // OBSOLETED in 1.80 (Jan 2021) + //inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segments); } // OBSOLETED in 1.80 (Jan 2021) // [Internal helpers] IMGUI_API void _ResetForNewFrame(); diff --git a/imgui_demo.cpp b/imgui_demo.cpp index cf3f59dc..6f6e73d4 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.4 WIP +// dear imgui, v1.89.4 // (demo code) // Help: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index be2058ee..031c3e7d 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.4 WIP +// dear imgui, v1.89.4 // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index c11286dd..20494ab4 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.89.4 WIP +// dear imgui, v1.89.4 // (internal structures/api) // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility. diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 0c247fa0..3bacc34a 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.4 WIP +// dear imgui, v1.89.4 // (tables and columns code) /* diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 8e5f5b75..ab43ac05 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.4 WIP +// dear imgui, v1.89.4 // (widgets code) /*