From 07efd7cc2053099c2f29e65b33e03d56a4b8d53c Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 15 Jun 2022 15:58:26 +0200 Subject: [PATCH 1/9] Renamed IMGUI_DISABLE_METRICS_WINDOW to IMGUI_DISABLE_DEBUG_TOOLS. --- .github/workflows/build.yml | 4 ++-- docs/CHANGELOG.txt | 2 ++ imconfig.h | 8 ++++---- imgui.cpp | 7 ++++--- imgui.h | 10 +++++++++- imgui_demo.cpp | 11 +++++++---- imgui_tables.cpp | 4 ++-- imgui_widgets.cpp | 2 +- 8 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9611d37e1c04..2bc86106c8cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -313,12 +313,12 @@ jobs: EOF g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_METRICS_WINDOW) + - name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_DEBUG_TOOLS) run: | cat > example_single_file.cpp <<'EOF' #define IMGUI_DISABLE_DEMO_WINDOWS - #define IMGUI_DISABLE_METRICS_WINDOW + #define IMGUI_DISABLE_DEBUG_TOOLS #define IMGUI_IMPLEMENTATION #include "misc/single_file/imgui_single_file.h" #include "examples/example_null/main.cpp" diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 06619257bd0a..8f540be9060d 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -37,6 +37,8 @@ HOW TO UPDATE? Breaking changes: +- Renamed IMGUI_DISABLE_METRICS_WINDOW to IMGUI_DISABLE_DEBUG_TOOLS for correctness. + Kept support for old define (will obsolete). - Renamed CaptureMouseFromApp() and CaptureKeyboardFromApp() to SetNextFrameWantCaptureMouse() and SetNextFrameWantCaptureKeyboard() to clarify purpose, old name was too misleading. Kept inline redirection functions (will obsolete). diff --git a/imconfig.h b/imconfig.h index a01f803f4052..e3dc27f68633 100644 --- a/imconfig.h +++ b/imconfig.h @@ -30,11 +30,11 @@ //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS //#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions. -//---- Disable all of Dear ImGui or don't implement standard windows. -// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp. +//---- Disable all of Dear ImGui or don't implement standard windows/tools. +// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp. //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. -//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. -//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty. +//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. +//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88). //---- Don't implement some functions to reduce linkage requirements. //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) diff --git a/imgui.cpp b/imgui.cpp index d7ac6f6325d1..916b9c603749 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -387,6 +387,7 @@ 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. + - 2022/06/15 (1.88) - renamed IMGUI_DISABLE_METRICS_WINDOW to IMGUI_DISABLE_DEBUG_TOOLS for correctness. kept support for old define (will obsolete). - 2022/05/03 (1.88) - backends: osx: removed ImGui_ImplOSX_HandleEvent() from backend API in favor of backend automatically handling event capture. All ImGui_ImplOSX_HandleEvent() calls should be removed as they are now unnecessary. - 2022/04/05 (1.88) - inputs: renamed ImGuiKeyModFlags to ImGuiModFlags. Kept inline redirection enums (will obsolete). This was never used in public API functions but technically present in imgui.h and ImGuiIO. - 2022/01/20 (1.87) - inputs: reworded gamepad IO. @@ -7840,7 +7841,7 @@ void ImGui::SetNextFrameWantCaptureMouse(bool want_capture_mouse) g.WantCaptureMouseNextFrame = want_capture_mouse ? 1 : 0; } -#ifndef IMGUI_DISABLE_METRICS_WINDOW +#ifndef IMGUI_DISABLE_DEBUG_TOOLS static const char* GetInputSourceName(ImGuiInputSource source) { const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Nav", "Clipboard" }; @@ -12182,7 +12183,7 @@ static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport*, ImGuiPlatformImeDat // - DebugNodeWindowsListByBeginStackParent() [Internal] //----------------------------------------------------------------------------- -#ifndef IMGUI_DISABLE_METRICS_WINDOW +#ifndef IMGUI_DISABLE_DEBUG_TOOLS void ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb) { @@ -13426,7 +13427,7 @@ void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {} void ImGui::UpdateDebugToolItemPicker() {} void ImGui::UpdateDebugToolStackQueries() {} -#endif // #ifndef IMGUI_DISABLE_METRICS_WINDOW +#endif // #ifndef IMGUI_DISABLE_DEBUG_TOOLS //----------------------------------------------------------------------------- diff --git a/imgui.h b/imgui.h index ae5492bfedd3..0041170b27ac 100644 --- a/imgui.h +++ b/imgui.h @@ -65,7 +65,7 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) #define IMGUI_VERSION "1.88 WIP" -#define IMGUI_VERSION_NUM 18729 +#define IMGUI_VERSION_NUM 18730 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_TABLE @@ -3037,6 +3037,14 @@ enum ImGuiKeyModFlags_ { ImGuiKeyModFlags_None = ImGuiModFlags_None, ImGuiKeyMod #endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +// RENAMED IMGUI_DISABLE_METRICS_WINDOW > IMGUI_DISABLE_DEBUG_TOOLS in 1.88 (from June 2022) +#if defined(IMGUI_DISABLE_METRICS_WINDOW) && !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && !defined(IMGUI_DISABLE_DEBUG_TOOLS) +#define IMGUI_DISABLE_DEBUG_TOOLS +#endif +#if defined(IMGUI_DISABLE_METRICS_WINDOW) && defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) +#error IMGUI_DISABLE_METRICS_WINDOW was renamed to IMGUI_DISABLE_DEBUG_TOOLS, please use new name. +#endif + //----------------------------------------------------------------------------- #if defined(__clang__) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 7df35a7daef5..1fafb4c043f7 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -401,11 +401,14 @@ void ImGui::ShowDemoWindow(bool* p_open) if (ImGui::BeginMenu("Tools")) { IMGUI_DEMO_MARKER("Menu/Tools"); -#ifndef IMGUI_DISABLE_METRICS_WINDOW - ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics); - ImGui::MenuItem("Debug Log", NULL, &show_app_debug_log); - ImGui::MenuItem("Stack Tool", NULL, &show_app_stack_tool); +#ifndef IMGUI_DISABLE_DEBUG_TOOLS + const bool has_debug_tools = true; +#else + const bool has_debug_tools = false; #endif + ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics, has_debug_tools); + ImGui::MenuItem("Debug Log", NULL, &show_app_debug_log, has_debug_tools); + ImGui::MenuItem("Stack Tool", NULL, &show_app_stack_tool, has_debug_tools); ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor); ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about); ImGui::EndMenu(); diff --git a/imgui_tables.cpp b/imgui_tables.cpp index db5bea1bcfbb..7658e029b00b 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -3520,7 +3520,7 @@ void ImGui::TableGcCompactSettings() // - DebugNodeTable() [Internal] //------------------------------------------------------------------------- -#ifndef IMGUI_DISABLE_METRICS_WINDOW +#ifndef IMGUI_DISABLE_DEBUG_TOOLS static const char* DebugNodeTableGetSizingPolicyDesc(ImGuiTableFlags sizing_policy) { @@ -3614,7 +3614,7 @@ void ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings) TreePop(); } -#else // #ifndef IMGUI_DISABLE_METRICS_WINDOW +#else // #ifndef IMGUI_DISABLE_DEBUG_TOOLS void ImGui::DebugNodeTable(ImGuiTable*) {} void ImGui::DebugNodeTableSettings(ImGuiTableSettings*) {} diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index de8afbb886cb..d57e53e69eb6 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4863,7 +4863,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ void ImGui::DebugNodeInputTextState(ImGuiInputTextState* state) { -#ifndef IMGUI_DISABLE_METRICS_WINDOW +#ifndef IMGUI_DISABLE_DEBUG_TOOLS ImGuiContext& g = *GImGui; ImStb::STB_TexteditState* stb_state = &state->Stb; ImStb::StbUndoState* undo_state = &stb_state->undostate; From 37a07858a913be5b4e932fcb38857566f24ff47a Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Fri, 17 Jun 2022 11:14:16 +0300 Subject: [PATCH 2/9] Nav: Fixed inability to cancel nav in modal popups. (#5400) --- docs/CHANGELOG.txt | 1 + imgui.cpp | 5 ++--- imgui.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 8f540be9060d..f6674d8aecf6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -87,6 +87,7 @@ Other Changes: - Nav: Fixed issues with nav request being transferred to another window when calling SetKeyboardFocusHere() and simultaneous changing window focus. (#4449) - Nav: Changed SetKeyboardFocusHere() to not behave if a drag or window moving is in progress. +- Nav: Fixed inability to cancel nav in modal popups. (#5400) [@rokups] - IsItemHovered(): added ImGuiHoveredFlags_NoNavOverride to disable the behavior where the return value is overriden by focus when gamepad/keyboard navigation is active. - InputText: Fixed pressing Tab emitting two tabs characters because of dual Keys/Chars events being diff --git a/imgui.cpp b/imgui.cpp index 916b9c603749..ceb589d2043b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -10630,11 +10630,10 @@ static void ImGui::NavUpdateCancelRequest() SetNavID(child_window->ChildId, ImGuiNavLayer_Main, 0, WindowRectAbsToRel(parent_window, child_rect)); NavRestoreHighlightAfterMove(); } - else if (g.OpenPopupStack.Size > 0) + else if (g.OpenPopupStack.Size > 0 && !(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal)) { // Close open popup/menu - if (!(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal)) - ClosePopupToLevel(g.OpenPopupStack.Size - 1, true); + ClosePopupToLevel(g.OpenPopupStack.Size - 1, true); } else { diff --git a/imgui.h b/imgui.h index 0041170b27ac..0265f833f93b 100644 --- a/imgui.h +++ b/imgui.h @@ -65,7 +65,7 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) #define IMGUI_VERSION "1.88 WIP" -#define IMGUI_VERSION_NUM 18730 +#define IMGUI_VERSION_NUM 18731 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_TABLE From 90e8404a7724096152e1c4427cb760645b3d0922 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 20 Jun 2022 15:35:48 +0200 Subject: [PATCH 3/9] Update README.md --- docs/README.md | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/docs/README.md b/docs/README.md index 305466a46d49..bd679fffdeae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -16,7 +16,7 @@ Individuals: support continued development and maintenance [here](https://www.pa | [The Pitch](#the-pitch) - [Usage](#usage) - [How it works](#how-it-works) - [Releases & Changelogs](#releases--changelogs) - [Demo](#demo) - [Integration](#integration) | :----------------------------------------------------------: | -| [Upcoming changes](#upcoming-changes) - [Gallery](#gallery) - [Support, FAQ](#support-frequently-asked-questions-faq) - [How to help](#how-to-help) - [Sponsors](#sponsors) - [Credits](#credits) - [License](#license) | +| [Upcoming changes](#upcoming-changes) - [Gallery](#gallery) - [Support, FAQ](#support-frequently-asked-questions-faq) - [How to help](#how-to-help) - [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors) - [Credits](#credits) - [License](#license) | | [Wiki](https://github.com/ocornut/imgui/wiki) - [Languages & frameworks backends/bindings](https://github.com/ocornut/imgui/wiki/Bindings) - [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) - [User quotes](https://github.com/ocornut/imgui/wiki/Quotes) | ### The Pitch @@ -27,12 +27,12 @@ Dear ImGui is designed to **enable fast iterations** and to **empower programmer Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard. + - Minimize state synchronization. + - Minimize state storage on user side. + - Minimize setup and maintenance. - Easy to use to create code-driven and data-driven tools. - Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools. - Easy to hack and improve. - - Minimize setup and maintenance. - - Minimize state storage on user side. - - Minimize state synchronization. - Portable, minimize dependencies, run on target (consoles, phones, etc.). - Efficient runtime and memory consumption. - Battle-tested, used by many major actors in the game industry. @@ -182,7 +182,7 @@ Private support is available for paying business customers (E-mail: _contact @ d **Which version should I get?** -We occasionally tag [Releases](https://github.com/ocornut/imgui/releases) but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported. +We occasionally tag [Releases](https://github.com/ocornut/imgui/releases) (with nice releases notes) but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported. Advanced users may want to use the `docking` branch with [Multi-Viewport](https://github.com/ocornut/imgui/issues/1542) and [Docking](https://github.com/ocornut/imgui/issues/2109) features. This branch is kept in sync with master regularly. @@ -198,31 +198,14 @@ How to help - See [GitHub Forum/issues](https://github.com/ocornut/imgui/issues) and [Github Discussions](https://github.com/ocornut/imgui/discussions). - You may help with development and submit pull requests! Please understand that by submitting a PR you are also submitting a request for the maintainer to review your code and then take over its maintenance forever. PR should be crafted both in the interest in the end-users and also to ease the maintainer into understanding and accepting it. - See [Help wanted](https://github.com/ocornut/imgui/wiki/Help-Wanted) on the [Wiki](https://github.com/ocornut/imgui/wiki/) for some more ideas. -- Have your company financially support this project (please reach by e-mail) - -**How can I help financing further development of Dear ImGui?** - -See [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors) page. +- Have your company financially support this project (please reach by e-mail to say hi!). Sponsors -------- -Ongoing Dear ImGui development is currently financially supported in 2021-2022 by users and private sponsors: - -*Platinum-chocolate sponsors* -- [Blizzard](https://careers.blizzard.com/en-us/openings/engineering/all/all/all/1) - -*Double-chocolate sponsors* -- [Ubisoft](https://montreal.ubisoft.com/en/ubisoft-sponsors-user-interface-library-for-c-dear-imgui), [Supercell](https://supercell.com) - -*Chocolate sponsors* -- [Adobe](https://www.adobe.com/products/medium.html), [Aras Pranckevičius](https://aras-p.info), [Epic](https://www.unrealengine.com/en-US/megagrants), [G3Dvu](). - -*Salty-caramel sponsors* -- [Kylotonn](https://www.kylotonn.com), [O-Net Communications (USA)](http://en.o-netcom.com), [Wonderland Engine](https://wonderlandengine.com/). - -Please see [detailed list of current and past Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors) for more. -From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations. +Ongoing Dear ImGui development is and has been financially supported by users and private sponsors. +
Please see **[detailed list of current and past Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors)** for details. +
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations. **THANK YOU to all past and present supporters for helping to keep this project alive and thriving!** From f27af1b20ae50de916d35d4fe9bbe1b255582df4 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 20 Jun 2022 16:44:49 +0200 Subject: [PATCH 4/9] Internals: SliderBehaviorT: Minor refactor, clearer 0.0/1.0 early out. Should be no-op from user's point of view. ScaleValueFromRatioT() had early 0.0/1.0 ratio tests, shifting most of function by one indent. --- imgui_widgets.cpp | 103 +++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 56 deletions(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index d57e53e69eb6..d552bec4f658 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -2615,7 +2615,6 @@ float ImGui::ScaleRatioFromValueT(ImGuiDataType data_type, TYPE v, TYPE v_min, T v_max_fudged = -logarithmic_zero_epsilon; float result; - if (v_clamped <= v_min_fudged) result = 0.0f; // Workaround for values that are in-range but below our fudge else if (v_clamped >= v_max_fudged) @@ -2639,91 +2638,81 @@ float ImGui::ScaleRatioFromValueT(ImGuiDataType data_type, TYPE v, TYPE v_min, T return flipped ? (1.0f - result) : result; } - - // Linear slider - return (float)((FLOATTYPE)(SIGNEDTYPE)(v_clamped - v_min) / (FLOATTYPE)(SIGNEDTYPE)(v_max - v_min)); + else + { + // Linear slider + return (float)((FLOATTYPE)(SIGNEDTYPE)(v_clamped - v_min) / (FLOATTYPE)(SIGNEDTYPE)(v_max - v_min)); + } } // Convert a parametric position on a slider into a value v in the output space (the logical opposite of ScaleRatioFromValueT) template TYPE ImGui::ScaleValueFromRatioT(ImGuiDataType data_type, float t, TYPE v_min, TYPE v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_halfsize) { - if (v_min == v_max) + // We special-case the extents because otherwise our logarithmic fudging can lead to "mathematically correct" + // but non-intuitive behaviors like a fully-left slider not actually reaching the minimum value. Also generally simpler. + if (t <= 0.0f || v_min == v_max) return v_min; - const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); + if (t >= 1.0f) + return v_max; - TYPE result; + TYPE result = (TYPE)0; if (is_logarithmic) { - // We special-case the extents because otherwise our fudging can lead to "mathematically correct" but non-intuitive behaviors like a fully-left slider not actually reaching the minimum value - if (t <= 0.0f) - result = v_min; - else if (t >= 1.0f) - result = v_max; - else - { - bool flipped = v_max < v_min; // Check if range is "backwards" - - // Fudge min/max to avoid getting silly results close to zero - FLOATTYPE v_min_fudged = (ImAbs((FLOATTYPE)v_min) < logarithmic_zero_epsilon) ? ((v_min < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_min; - FLOATTYPE v_max_fudged = (ImAbs((FLOATTYPE)v_max) < logarithmic_zero_epsilon) ? ((v_max < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_max; + // Fudge min/max to avoid getting silly results close to zero + FLOATTYPE v_min_fudged = (ImAbs((FLOATTYPE)v_min) < logarithmic_zero_epsilon) ? ((v_min < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_min; + FLOATTYPE v_max_fudged = (ImAbs((FLOATTYPE)v_max) < logarithmic_zero_epsilon) ? ((v_max < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_max; - if (flipped) - ImSwap(v_min_fudged, v_max_fudged); + const bool flipped = v_max < v_min; // Check if range is "backwards" + if (flipped) + ImSwap(v_min_fudged, v_max_fudged); - // Awkward special case - we need ranges of the form (-100 .. 0) to convert to (-100 .. -epsilon), not (-100 .. epsilon) - if ((v_max == 0.0f) && (v_min < 0.0f)) - v_max_fudged = -logarithmic_zero_epsilon; + // Awkward special case - we need ranges of the form (-100 .. 0) to convert to (-100 .. -epsilon), not (-100 .. epsilon) + if ((v_max == 0.0f) && (v_min < 0.0f)) + v_max_fudged = -logarithmic_zero_epsilon; - float t_with_flip = flipped ? (1.0f - t) : t; // t, but flipped if necessary to account for us flipping the range + float t_with_flip = flipped ? (1.0f - t) : t; // t, but flipped if necessary to account for us flipping the range - if ((v_min * v_max) < 0.0f) // Range crosses zero, so we have to do this in two parts - { - float zero_point_center = (-(float)ImMin(v_min, v_max)) / ImAbs((float)v_max - (float)v_min); // The zero point in parametric space - float zero_point_snap_L = zero_point_center - zero_deadzone_halfsize; - float zero_point_snap_R = zero_point_center + zero_deadzone_halfsize; - if (t_with_flip >= zero_point_snap_L && t_with_flip <= zero_point_snap_R) - result = (TYPE)0.0f; // Special case to make getting exactly zero possible (the epsilon prevents it otherwise) - else if (t_with_flip < zero_point_center) - result = (TYPE)-(logarithmic_zero_epsilon * ImPow(-v_min_fudged / logarithmic_zero_epsilon, (FLOATTYPE)(1.0f - (t_with_flip / zero_point_snap_L)))); - else - result = (TYPE)(logarithmic_zero_epsilon * ImPow(v_max_fudged / logarithmic_zero_epsilon, (FLOATTYPE)((t_with_flip - zero_point_snap_R) / (1.0f - zero_point_snap_R)))); - } - else if ((v_min < 0.0f) || (v_max < 0.0f)) // Entirely negative slider - result = (TYPE)-(-v_max_fudged * ImPow(-v_min_fudged / -v_max_fudged, (FLOATTYPE)(1.0f - t_with_flip))); + if ((v_min * v_max) < 0.0f) // Range crosses zero, so we have to do this in two parts + { + float zero_point_center = (-(float)ImMin(v_min, v_max)) / ImAbs((float)v_max - (float)v_min); // The zero point in parametric space + float zero_point_snap_L = zero_point_center - zero_deadzone_halfsize; + float zero_point_snap_R = zero_point_center + zero_deadzone_halfsize; + if (t_with_flip >= zero_point_snap_L && t_with_flip <= zero_point_snap_R) + result = (TYPE)0.0f; // Special case to make getting exactly zero possible (the epsilon prevents it otherwise) + else if (t_with_flip < zero_point_center) + result = (TYPE)-(logarithmic_zero_epsilon * ImPow(-v_min_fudged / logarithmic_zero_epsilon, (FLOATTYPE)(1.0f - (t_with_flip / zero_point_snap_L)))); else - result = (TYPE)(v_min_fudged * ImPow(v_max_fudged / v_min_fudged, (FLOATTYPE)t_with_flip)); + result = (TYPE)(logarithmic_zero_epsilon * ImPow(v_max_fudged / logarithmic_zero_epsilon, (FLOATTYPE)((t_with_flip - zero_point_snap_R) / (1.0f - zero_point_snap_R)))); } + else if ((v_min < 0.0f) || (v_max < 0.0f)) // Entirely negative slider + result = (TYPE)-(-v_max_fudged * ImPow(-v_min_fudged / -v_max_fudged, (FLOATTYPE)(1.0f - t_with_flip))); + else + result = (TYPE)(v_min_fudged * ImPow(v_max_fudged / v_min_fudged, (FLOATTYPE)t_with_flip)); } else { // Linear slider + const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); if (is_floating_point) { result = ImLerp(v_min, v_max, t); } - else + else if (t < 1.0) { // - For integer values we want the clicking position to match the grab box so we round above // This code is carefully tuned to work with large values (e.g. high ranges of U64) while preserving this property.. // - Not doing a *1.0 multiply at the end of a range as it tends to be lossy. While absolute aiming at a large s64/u64 // range is going to be imprecise anyway, with this check we at least make the edge values matches expected limits. - if (t < 1.0) - { - FLOATTYPE v_new_off_f = (SIGNEDTYPE)(v_max - v_min) * t; - result = (TYPE)((SIGNEDTYPE)v_min + (SIGNEDTYPE)(v_new_off_f + (FLOATTYPE)(v_min > v_max ? -0.5 : 0.5))); - } - else - { - result = v_max; - } + FLOATTYPE v_new_off_f = (SIGNEDTYPE)(v_max - v_min) * t; + result = (TYPE)((SIGNEDTYPE)v_min + (SIGNEDTYPE)(v_new_off_f + (FLOATTYPE)(v_min > v_max ? -0.5 : 0.5))); } } return result; } -// FIXME: Move more of the code into SliderBehavior() +// FIXME: Try to move more of the code into shared SliderBehavior() template bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, TYPE* v, const TYPE v_min, const TYPE v_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb) { @@ -2733,13 +2722,14 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ const ImGuiAxis axis = (flags & ImGuiSliderFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X; const bool is_logarithmic = (flags & ImGuiSliderFlags_Logarithmic) != 0; const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); + const SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max); - const float grab_padding = 2.0f; + // Calculate bounds + const float grab_padding = 2.0f; // FIXME: Should be part of style. const float slider_sz = (bb.Max[axis] - bb.Min[axis]) - grab_padding * 2.0f; float grab_sz = style.GrabMinSize; - SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max); - if (!is_floating_point && v_range >= 0) // v_range < 0 may happen on integer overflows - grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit + if (!is_floating_point && v_range >= 0) // v_range < 0 may happen on integer overflows + grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit grab_sz = ImMin(grab_sz, slider_sz); const float slider_usable_sz = slider_sz - grab_sz; const float slider_usable_pos_min = bb.Min[axis] + grab_padding + grab_sz * 0.5f; @@ -2770,7 +2760,8 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ else { const float mouse_abs_pos = g.IO.MousePos[axis]; - clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f; + if (slider_usable_sz > 0.0f) + clicked_t = ImSaturate((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz); if (axis == ImGuiAxis_Y) clicked_t = 1.0f - clicked_t; set_new_value = true; From d3fd2630b77967e326b3a1e8759087e19788bd21 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 20 Jun 2022 18:06:34 +0200 Subject: [PATCH 5/9] Sliders: An initial click within the knob/grab doesn't shift its position. (#1946, #5328) + Adjust default GrabMinSize. --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 2 +- imgui.h | 2 +- imgui_internal.h | 2 ++ imgui_widgets.cpp | 11 ++++++++++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index f6674d8aecf6..27e8022eb87b 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -78,6 +78,7 @@ Other Changes: - Layout: Fixed mixing up SameLine() and SetCursorPos() together from creating situations where line height would be emitted from the wrong location (e.g. 'ItemA+SameLine()+SetCursorPos()+ItemB' would emit ItemA worth of height from the position of ItemB, which is not necessarily aligned with ItemA). +- Sliders: An initial click within the knob/grab doesn't shift its position. (#1946, #5328) - Sliders, Drags: Fixed dragging when using hexadecimal display format string. (#5165, #3133) - Sliders, Drags: Fixed manual input when using hexadecimal display format string. (#5165, #3133) - InputScalar: Fixed manual input when using %03d style width in display format string. (#5165, #3133) @@ -109,6 +110,7 @@ Other Changes: level of a popup with a child menu opened. - Menus: Menus emitted from the main/scrolling layer are not part of the same menuset as menus emitted from the menu-bar, avoiding accidental hovering from one to the other. (#3496, #4797) [@rokups] +- Style: Adjust default value of GrabMinSize from 10.0f to 12.0f. - Stack Tool: Added option to copy item path to clipboard. (#4631) - Settings: Fixed out-of-bounds read when .ini file on disk is empty. (#5351) [@quantum5] - Settings: Fixed some SetNextWindowPos/SetNextWindowSize API calls not marking settings as dirty. diff --git a/imgui.cpp b/imgui.cpp index ceb589d2043b..44337360533d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1062,7 +1062,7 @@ ImGuiStyle::ImGuiStyle() ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). ScrollbarSize = 14.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar - GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar + GrabMinSize = 12.0f; // Minimum width/height of a grab box for slider/scrollbar GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. TabRounding = 4.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. diff --git a/imgui.h b/imgui.h index 0265f833f93b..c923f1564270 100644 --- a/imgui.h +++ b/imgui.h @@ -65,7 +65,7 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) #define IMGUI_VERSION "1.88 WIP" -#define IMGUI_VERSION_NUM 18731 +#define IMGUI_VERSION_NUM 18732 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_TABLE diff --git a/imgui_internal.h b/imgui_internal.h index 555022cf8fd3..26d1a8f469b5 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1773,6 +1773,7 @@ struct ImGuiContext ImU32 ColorEditLastColor; // RGB value with alpha set to 0. ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker. ImGuiComboPreviewData ComboPreviewData; + float SliderGrabClickOffset; float SliderCurrentAccum; // Accumulated slider delta when using navigation controls. bool SliderCurrentAccumDirty; // Has the accumulated slider delta changed since last time we tried to apply it? bool DragCurrentAccumDirty; @@ -1944,6 +1945,7 @@ struct ImGuiContext ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_; ColorEditLastHue = ColorEditLastSat = 0.0f; ColorEditLastColor = 0; + SliderGrabClickOffset = 0.0f; SliderCurrentAccum = 0.0f; SliderCurrentAccumDirty = false; DragCurrentAccumDirty = false; diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index d552bec4f658..d07df3abbe94 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -2760,8 +2760,17 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ else { const float mouse_abs_pos = g.IO.MousePos[axis]; + if (g.ActiveIdIsJustActivated) + { + float grab_t = ScaleRatioFromValueT(data_type, *v, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize); + if (axis == ImGuiAxis_Y) + grab_t = 1.0f - grab_t; + const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t); + const bool clicked_around_grab = (mouse_abs_pos >= grab_pos - grab_sz * 0.5f - 1.0f) && (mouse_abs_pos <= grab_pos + grab_sz * 0.5f + 1.0f); // No harm being extra generous here. + g.SliderGrabClickOffset = (clicked_around_grab && is_floating_point) ? mouse_abs_pos - grab_pos : 0.0f; + } if (slider_usable_sz > 0.0f) - clicked_t = ImSaturate((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz); + clicked_t = ImSaturate((mouse_abs_pos - g.SliderGrabClickOffset - slider_usable_pos_min) / slider_usable_sz); if (axis == ImGuiAxis_Y) clicked_t = 1.0f - clicked_t; set_new_value = true; From 4b972961482b24f856a71bdc10a8e6a81a00ac1e Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 21 Jun 2022 16:20:01 +0200 Subject: [PATCH 6/9] TabBar: TabItem() now reacts to SetNextItemWidth() and SetNextItemOpen(true). (#5262) --- docs/CHANGELOG.txt | 1 + imgui_internal.h | 1 + imgui_widgets.cpp | 40 ++++++++++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 27e8022eb87b..e005264db3ec 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -105,6 +105,7 @@ Other Changes: merging drawcall of the last column didn't always work (regression since 1.87). (#4843, #4844) [@rokups] - Inputs: Fixed IsMouseClicked() repeat mode rate being half of keyboard repeat rate. - ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label. +- TabBar: TabItem() now reacts to SetNextItemWidth() and SetNextItemOpen(true). (#5262) - Menus: Adjusted BeginMenu() closing logic so hovering void or non-MenuItem() in parent window always lead to menu closure. Fixes using items that are not MenuItem() or BeginItem() at the root level of a popup with a child menu opened. diff --git a/imgui_internal.h b/imgui_internal.h index 26d1a8f469b5..a7a3b9f112c0 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2184,6 +2184,7 @@ struct ImGuiTabItem float Offset; // Position relative to beginning of tab float Width; // Width currently displayed float ContentWidth; // Width of label, stored during BeginTabItem() call + float RequestedWidth; // Width optionally requested by caller, -1.0f is unused ImS32 NameOffset; // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames ImS16 BeginOrder; // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable ImS16 IndexDuringLayout; // Index only used during TabBarLayout() diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index d07df3abbe94..c70e7d37e512 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7548,7 +7548,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) // and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window. const char* tab_name = tab_bar->GetTabName(tab); const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true; - tab->ContentWidth = TabItemCalcSize(tab_name, has_close_button).x; + tab->ContentWidth = (tab->RequestedWidth > 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button).x; int section_n = TabItemGetSectionIdx(tab); ImGuiTabBarSection* section = §ions[section_n]; @@ -8029,10 +8029,13 @@ bool ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags) bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags) { // Layout whole tab bar if not already done + ImGuiContext& g = *GImGui; if (tab_bar->WantLayout) + { + ImGuiNextItemData backup_next_item_data = g.NextItemData; TabBarLayout(tab_bar); - - ImGuiContext& g = *GImGui; + g.NextItemData = backup_next_item_data; + } ImGuiWindow* window = g.CurrentWindow; if (window->SkipItems) return false; @@ -8058,9 +8061,6 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, else if (p_open == NULL) flags |= ImGuiTabItemFlags_NoCloseButton; - // Calculate tab contents size - ImVec2 size = TabItemCalcSize(label, p_open != NULL); - // Acquire tab data ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, id); bool tab_is_new = false; @@ -8069,11 +8069,17 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, tab_bar->Tabs.push_back(ImGuiTabItem()); tab = &tab_bar->Tabs.back(); tab->ID = id; - tab->Width = size.x; - tab_bar->TabsAddedNew = true; - tab_is_new = true; + tab_bar->TabsAddedNew = tab_is_new = true; } tab_bar->LastTabItemIdx = (ImS16)tab_bar->Tabs.index_from_ptr(tab); + + // Calculate tab contents size + ImVec2 size = TabItemCalcSize(label, p_open != NULL); + tab->RequestedWidth = -1.0f; + if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth) + size.x = tab->RequestedWidth = g.NextItemData.Width; + if (tab_is_new) + tab->Width = size.x; tab->ContentWidth = size.x; tab->BeginOrder = tab_bar->TabsActiveCount++; @@ -8089,13 +8095,19 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, tab_bar->TabsNames.append(label, label + strlen(label) + 1); // Update selected tab - if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0) - if (!tab_bar_appearing || tab_bar->SelectedTabId == 0) - if (!is_tab_button) + if (!is_tab_button) + { + if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0) + if (!tab_bar_appearing || tab_bar->SelectedTabId == 0) tab_bar->NextSelectedTabId = id; // New tabs gets activated - if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // SetSelected can only be passed on explicit tab bar - if (!is_tab_button) + if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // _SetSelected can only be passed on explicit tab bar tab_bar->NextSelectedTabId = id; + if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasOpen) + { + IM_ASSERT(g.NextItemData.OpenVal == true && g.NextItemData.OpenCond == ImGuiCond_Always); // SetNextItemOpen(true, ImGuiCond_Always) is supported but other combinations are not. + tab_bar->NextSelectedTabId = id; + } + } // Lock visibility // (Note: tab_contents_visible != tab_selected... because CTRL+TAB operations may preview some tabs without selecting them!) From c4b91017599e222d538c917930d70f7fe0a04de1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 21 Jun 2022 17:11:51 +0200 Subject: [PATCH 7/9] TabBar: Tweak shrinking policy so that while resizing tabs that don't need shrinking keep their initial width more precisely. Has been the case before but adding support for SetNextItemWidth() #5262 made this more noticeable. --- docs/CHANGELOG.txt | 2 ++ imgui_internal.h | 1 + imgui_widgets.cpp | 15 +++++++++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e005264db3ec..339e5c0b44c6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -106,6 +106,8 @@ Other Changes: - Inputs: Fixed IsMouseClicked() repeat mode rate being half of keyboard repeat rate. - ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label. - TabBar: TabItem() now reacts to SetNextItemWidth() and SetNextItemOpen(true). (#5262) +- TabBar: Tweak shrinking policy so that while resizing tabs that don't need shrinking keep their + initial width more precisely (without the occasional +1 worth of width). - Menus: Adjusted BeginMenu() closing logic so hovering void or non-MenuItem() in parent window always lead to menu closure. Fixes using items that are not MenuItem() or BeginItem() at the root level of a popup with a child menu opened. diff --git a/imgui_internal.h b/imgui_internal.h index a7a3b9f112c0..602066a8f935 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1150,6 +1150,7 @@ struct ImGuiShrinkWidthItem { int Index; float Width; + float InitialWidth; }; struct ImGuiPtrOrIndex diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index c70e7d37e512..ac1d47d70b79 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1540,7 +1540,7 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc width_excess -= width_to_remove_per_item * count_same_width; } - // Round width and redistribute remainder left-to-right (could make it an option of the function?) + // Round width and redistribute remainder // Ensure that e.g. the right-most tab of a shrunk tab-bar always reaches exactly at the same distance from the right-most edge of the tab bar separator. width_excess = 0.0f; for (int n = 0; n < count; n++) @@ -1549,10 +1549,13 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc width_excess += items[n].Width - width_rounded; items[n].Width = width_rounded; } - if (width_excess > 0.0f) + while (width_excess > 0.0f) for (int n = 0; n < count; n++) - if (items[n].Index < (int)(width_excess + 0.01f)) + if (items[n].Width + 1.0f <= items[n].InitialWidth) + { items[n].Width += 1.0f; + width_excess -= 1.0f; + } } //------------------------------------------------------------------------- @@ -7557,9 +7560,9 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) // Store data so we can build an array sorted by width if we need to shrink tabs down IM_MSVC_WARNING_SUPPRESS(6385); - int shrink_buffer_index = shrink_buffer_indexes[section_n]++; - g.ShrinkWidthBuffer[shrink_buffer_index].Index = tab_n; - g.ShrinkWidthBuffer[shrink_buffer_index].Width = tab->ContentWidth; + ImGuiShrinkWidthItem* shrink_width_item = &g.ShrinkWidthBuffer[shrink_buffer_indexes[section_n]++]; + shrink_width_item->Index = tab_n; + shrink_width_item->Width = shrink_width_item->InitialWidth = tab->ContentWidth; IM_ASSERT(tab->ContentWidth > 0.0f); tab->Width = tab->ContentWidth; From d51e5d28985a52bc0cd7061710bc180afeecb360 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 21 Jun 2022 17:20:06 +0200 Subject: [PATCH 8/9] TabItem: revert support for SetNextItemOpen(true) at it creates too much ambiguity with p_open/close button vs Selected state. (#5262) Revert a small part of 4b97296. --- docs/CHANGELOG.txt | 2 +- imgui_widgets.cpp | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 339e5c0b44c6..1fec90da5f4d 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -105,7 +105,7 @@ Other Changes: merging drawcall of the last column didn't always work (regression since 1.87). (#4843, #4844) [@rokups] - Inputs: Fixed IsMouseClicked() repeat mode rate being half of keyboard repeat rate. - ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label. -- TabBar: TabItem() now reacts to SetNextItemWidth() and SetNextItemOpen(true). (#5262) +- TabBar: TabItem() now reacts to SetNextItemWidth(). (#5262) - TabBar: Tweak shrinking policy so that while resizing tabs that don't need shrinking keep their initial width more precisely (without the occasional +1 worth of width). - Menus: Adjusted BeginMenu() closing logic so hovering void or non-MenuItem() in parent window diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index ac1d47d70b79..98fec844b58b 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -8105,11 +8105,6 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, tab_bar->NextSelectedTabId = id; // New tabs gets activated if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // _SetSelected can only be passed on explicit tab bar tab_bar->NextSelectedTabId = id; - if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasOpen) - { - IM_ASSERT(g.NextItemData.OpenVal == true && g.NextItemData.OpenCond == ImGuiCond_Always); // SetNextItemOpen(true, ImGuiCond_Always) is supported but other combinations are not. - tab_bar->NextSelectedTabId = id; - } } // Lock visibility From 9aae45eb4a05a5a1f96be1ef37eb503a12ceb889 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 21 Jun 2022 17:38:27 +0200 Subject: [PATCH 9/9] Version 1.88 (fix "Show Debug Log" checkbox in Metrics window) --- docs/CHANGELOG.txt | 112 +++++++++++++++++++++++---------------------- imgui.cpp | 5 +- imgui.h | 6 +-- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- imgui_internal.h | 2 +- imgui_tables.cpp | 2 +- imgui_widgets.cpp | 2 +- 8 files changed, 69 insertions(+), 64 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 1fec90da5f4d..386b0573a0fd 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -32,9 +32,11 @@ HOW TO UPDATE? ----------------------------------------------------------------------- - VERSION 1.88 WIP (In Progress) + VERSION 1.88 (Released 2022-06-21) ----------------------------------------------------------------------- +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.88 + Breaking changes: - Renamed IMGUI_DISABLE_METRICS_WINDOW to IMGUI_DISABLE_DEBUG_TOOLS for correctness. @@ -48,8 +50,8 @@ Breaking changes: automatically handling event capture. Examples that are using the OSX backend have removed all the now-unnecessary calls to ImGui_ImplOSX_HandleEvent(), applications can do as well. [@stuartcarnie] (#4821) -- Internals: calling ButtonBehavior() without calling ItemAdd() now requires a KeepAliveID(). - This is because the KeepAliveID() call was moved from GetID() to ItemAdd()). (#5181) +- Internals: calling ButtonBehavior() without calling ItemAdd() now requires a KeepAliveID() + call. This is because the KeepAliveID() call was moved from GetID() to ItemAdd(). (#5181) Other Changes: @@ -62,7 +64,7 @@ Other Changes: In particular, using the input system for fast game-like actions (e.g. WASD camera move) would typically have been impacted, as well as holding a key while dragging mouse. Constraints have been lifted and are now only happening when e.g. an InputText() widget is active. (#4921, #4858) - Not that even thought you shouldn't need to disable io.ConfigInputTrickleEventQueue, you can + Note that even thought you shouldn't need to disable io.ConfigInputTrickleEventQueue, you can technically dynamically change its setting based on the context (e.g. disable only when hovering or interacting with a game/3D view). - IO: Fixed input queue trickling of mouse wheel events: multiple wheel events are merged, while @@ -90,7 +92,7 @@ Other Changes: - Nav: Changed SetKeyboardFocusHere() to not behave if a drag or window moving is in progress. - Nav: Fixed inability to cancel nav in modal popups. (#5400) [@rokups] - IsItemHovered(): added ImGuiHoveredFlags_NoNavOverride to disable the behavior where the - return value is overriden by focus when gamepad/keyboard navigation is active. + return value is overridden by focus when gamepad/keyboard navigation is active. - InputText: Fixed pressing Tab emitting two tabs characters because of dual Keys/Chars events being trickled with the new input queue (happened on some backends only). (#2467, #1336) - InputText: Fixed a one-frame display glitch where pressing Escape to revert after a deletion @@ -101,17 +103,17 @@ Other Changes: - Tables: Fixed incorrect border height used for logic when resizing one of several synchronized instance of a same table ID, when instances have a different height. (#3955). - Tables: Fixed incorrect auto-fit of parent windows when using non-resizable weighted columns. (#5276) -- Tables: Fixed drawcall merging of last column. Depending on some unrelated settings (e.g. BorderH) - merging drawcall of the last column didn't always work (regression since 1.87). (#4843, #4844) [@rokups] +- Tables: Fixed draw-call merging of last column. Depending on some unrelated settings (e.g. BorderH) + merging draw-call of the last column didn't always work (regression since 1.87). (#4843, #4844) [@rokups] - Inputs: Fixed IsMouseClicked() repeat mode rate being half of keyboard repeat rate. - ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label. -- TabBar: TabItem() now reacts to SetNextItemWidth(). (#5262) +- TabBar: BeginTabItem() now reacts to SetNextItemWidth(). (#5262) - TabBar: Tweak shrinking policy so that while resizing tabs that don't need shrinking keep their initial width more precisely (without the occasional +1 worth of width). - Menus: Adjusted BeginMenu() closing logic so hovering void or non-MenuItem() in parent window always lead to menu closure. Fixes using items that are not MenuItem() or BeginItem() at the root level of a popup with a child menu opened. -- Menus: Menus emitted from the main/scrolling layer are not part of the same menuset as menus emitted +- Menus: Menus emitted from the main/scrolling layer are not part of the same menu-set as menus emitted from the menu-bar, avoiding accidental hovering from one to the other. (#3496, #4797) [@rokups] - Style: Adjust default value of GrabMinSize from 10.0f to 12.0f. - Stack Tool: Added option to copy item path to clipboard. (#4631) @@ -167,7 +169,7 @@ Other Changes: VERSION 1.87 (Released 2022-02-07) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.87 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.87 Breaking Changes: @@ -309,7 +311,7 @@ Other Changes: VERSION 1.86 (Released 2021-12-22) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.86 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.86 Breaking Changes: @@ -407,7 +409,7 @@ Other Changes: VERSION 1.85 (Released 2021-10-12) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.85 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.85 This is the last release officially supporting C++03 and Visual Studio 2008/2010. (#4537) We expect that the next release will require a subset of the C++11 language (VS 2012~, GCC 4.8.1, Clang 3.3). @@ -498,7 +500,7 @@ Other Changes: VERSION 1.84.2 (Released 2021-08-23) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84.2 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.84.2 - Disabled: Fixed nested BeginDisabled()/EndDisabled() calls. (#211, #4452, #4453, #4462) [@Legulysse] - Backends: OpenGL3: OpenGL: Fixed ES 3.0 shader ("#version 300 es") to use normal precision @@ -509,7 +511,7 @@ Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84.2 VERSION 1.84.1 (Released 2021-08-20) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84.1 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.84.1 - Disabled: Fixed BeginDisabled(false) - BeginDisabled(true) was working. (#211, #4452, #4453) @@ -518,7 +520,7 @@ Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84.1 VERSION 1.84 (Released 2021-08-20) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.84 Breaking Changes: @@ -634,7 +636,7 @@ Other Changes: VERSION 1.83 (Released 2021-05-24) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.83 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.83 Breaking Changes: @@ -718,7 +720,7 @@ Other Changes: VERSION 1.82 (Released 2021-02-15) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.82 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.82 Breaking Changes: @@ -813,7 +815,7 @@ Other Changes: VERSION 1.81 (Released 2021-02-10) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.81 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.81 Breaking Changes: @@ -894,7 +896,7 @@ Other Changes: VERSION 1.80 (Released 2021-01-21) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.80 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.80 Breaking Changes: @@ -1013,7 +1015,7 @@ Other Changes: VERSION 1.79 (Released 2020-10-08) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.79 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.79 Breaking Changes: @@ -1107,7 +1109,7 @@ Other Changes: VERSION 1.78 (Released 2020-08-18) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.78 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.78 Breaking Changes: @@ -1208,7 +1210,7 @@ Other Changes: VERSION 1.77 (Released 2020-06-29) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.77 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.77 Breaking Changes: @@ -1299,7 +1301,7 @@ Other Changes: VERSION 1.76 (Released 2020-04-12) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.76 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.76 Other Changes: @@ -1371,7 +1373,7 @@ Other Changes: VERSION 1.75 (Released 2020-02-10) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.75 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.75 Breaking Changes: @@ -1469,7 +1471,7 @@ Other Changes: VERSION 1.74 (Released 2019-11-25) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.74 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.74 Breaking Changes: @@ -1548,7 +1550,7 @@ Other Changes: VERSION 1.73 (Released 2019-09-24) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.73 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.73 Other Changes: @@ -1610,7 +1612,7 @@ Other Changes: VERSION 1.72b (Released 2019-07-31) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.72b +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.72b Other Changes: @@ -1627,7 +1629,7 @@ Other Changes: VERSION 1.72 (Released 2019-07-27) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.72 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.72 Breaking Changes: @@ -1712,7 +1714,7 @@ Other Changes: VERSION 1.71 (Released 2019-06-12) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.71 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.71 Breaking Changes: @@ -1796,7 +1798,7 @@ Other Changes: VERSION 1.70 (Released 2019-05-06) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.70 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.70 Breaking Changes: @@ -1887,7 +1889,7 @@ Other Changes: VERSION 1.69 (Released 2019-03-13) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.69 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.69 Breaking Changes: @@ -1965,7 +1967,7 @@ Other Changes: VERSION 1.68 (Released 2019-02-19) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.68 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.68 Breaking Changes: @@ -2035,7 +2037,7 @@ Other Changes: VERSION 1.67 (Released 2019-01-14) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.67 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.67 Breaking Changes: @@ -2100,7 +2102,7 @@ Other Changes: VERSION 1.66b (Released 2018-12-01) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.66b +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.66b Other Changes: @@ -2119,7 +2121,7 @@ Other Changes: VERSION 1.66 (Released 2018-11-22) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.66 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.66 Breaking Changes: @@ -2180,7 +2182,7 @@ Other Changes: VERSION 1.65 (Released 2018-09-06) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.65 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.65 Breaking Changes: @@ -2206,7 +2208,7 @@ Other Changes: VERSION 1.64 (Released 2018-08-31) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.64 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.64 Changes: @@ -2230,7 +2232,7 @@ Changes: VERSION 1.63 (Released 2018-08-29) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.63 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.63 Breaking Changes: @@ -2324,7 +2326,7 @@ Other Changes: VERSION 1.62 (Released 2018-06-22) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.62 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.62 Breaking Changes: @@ -2405,7 +2407,7 @@ Other Changes: VERSION 1.61 (Released 2018-05-14) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.61 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.61 Breaking Changes: @@ -2481,7 +2483,7 @@ Other Changes: VERSION 1.60 (Released 2018-04-07) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.60 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.60 The gamepad/keyboard navigation branch (which has been in the work since July 2016) has been merged. Gamepad/keyboard navigation is still marked as Beta and has to be enabled explicitly. @@ -2647,7 +2649,7 @@ Other Changes: VERSION 1.53 (Released 2017-12-25) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.53 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.53 Breaking Changes: @@ -2786,7 +2788,7 @@ Other Changes: VERSION 1.52 (2017-10-27) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.52 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.52 Breaking Changes: @@ -2892,7 +2894,7 @@ Beta Navigation Branch: VERSION 1.51 (2017-08-24) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.51 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.51 Breaking Changes: @@ -2956,7 +2958,7 @@ Other Changes: VERSION 1.50 (2017-06-02) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.50 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.50 Breaking Changes: @@ -3052,7 +3054,7 @@ Other Changes: VERSION 1.49 (2016-05-09) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.49 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.49 Breaking Changes: @@ -3130,7 +3132,7 @@ Other changes: VERSION 1.48 (2016-04-09) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.48 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.48 Breaking Changes: @@ -3200,7 +3202,7 @@ Other Changes: VERSION 1.47 (2015-12-25) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.47 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.47 Changes: @@ -3253,7 +3255,7 @@ Changes: VERSION 1.46 (2015-10-18) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.46 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.46 Changes: @@ -3305,7 +3307,7 @@ Changes: VERSION 1.45 (2015-09-01) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.45 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.45 Breaking Changes: @@ -3365,7 +3367,7 @@ Other Changes: VERSION 1.44 (2015-08-08) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.44 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.44 Breaking Changes: @@ -3409,7 +3411,7 @@ Other Changes: VERSION 1.43 (2015-07-17) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.43 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.43 Breaking Changes: @@ -3481,7 +3483,7 @@ Other Changes: VERSION 1.42 (2015-07-08) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.42 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.42 Breaking Changes: @@ -3526,7 +3528,7 @@ Other Changes: VERSION 1.41 (2015-06-26) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.41 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.41 Breaking Changes: @@ -3570,7 +3572,7 @@ Other Changes: VERSION 1.40 (2015-05-31) ----------------------------------------------------------------------- -Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.40 +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.40 Breaking Changes: diff --git a/imgui.cpp b/imgui.cpp index 44337360533d..b979938d45cf 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, 1.88 WIP +// dear imgui, v1.88 // (main code and documentation) // Help: @@ -399,6 +399,7 @@ CODE - Backend writing to io.MouseWheel -> backend should call io.AddMouseWheelEvent() - Backend writing to io.MouseHoveredViewport -> backend should call io.AddMouseViewportEvent() [Docking branch w/ multi-viewports only] note: for all calls to IO new functions, the Dear ImGui context should be bound/current. + read https://github.com/ocornut/imgui/issues/4921 for details. - 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details. - IsKeyPressed(MY_NATIVE_KEY_XXX) -> use IsKeyPressed(ImGuiKey_XXX) - IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX) @@ -12309,6 +12310,8 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGuiContext& g = *GImGui; ImGuiIO& io = g.IO; ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; + if (cfg->ShowDebugLog) + ShowDebugLogWindow(&cfg->ShowDebugLog); if (cfg->ShowStackTool) ShowStackToolWindow(&cfg->ShowStackTool); diff --git a/imgui.h b/imgui.h index c923f1564270..bc5fbd61a0c9 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.88 WIP +// dear imgui, v1.88 // (headers) // Help: @@ -64,8 +64,8 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) -#define IMGUI_VERSION "1.88 WIP" -#define IMGUI_VERSION_NUM 18732 +#define IMGUI_VERSION "1.88" +#define IMGUI_VERSION_NUM 18800 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_TABLE diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 1fafb4c043f7..4a12dd4df412 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.88 WIP +// dear imgui, v1.88 // (demo code) // Help: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 0823b01e0ed2..fcdb9dfe8845 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.88 WIP +// dear imgui, v1.88 // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index 602066a8f935..81d41fd7b38f 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.88 WIP +// dear imgui, v1.88 // (internal structures/api) // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 7658e029b00b..c3e24af35b42 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.88 WIP +// dear imgui, v1.88 // (tables and columns code) /* diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 98fec844b58b..ef91630f236c 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.88 WIP +// dear imgui, v1.88 // (widgets code) /*