From d84e409715b7f4e826493a693fa5db09f4d5a108 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 20 Aug 2021 23:50:55 +0200 Subject: [PATCH] Fix BeginDisabled(false), again, (#211, #4452, #4453) Version 1.84b # Conflicts: # docs/CHANGELOG.txt --- docs/CHANGELOG.txt | 11 +++++++++++ imgui.cpp | 8 ++++---- imgui.h | 7 ++++--- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- imgui_internal.h | 2 +- imgui_tables.cpp | 2 +- imgui_widgets.cpp | 2 +- 8 files changed, 24 insertions(+), 12 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 772928d36bfe..db6717577dea 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -99,6 +99,17 @@ Other changes: Note that Linux/Mac still have inconsistent support for multi-viewports. If you want to help see https://github.com/ocornut/imgui/issues/2117. +----------------------------------------------------------------------- + VERSION 1.84b (Released 2021-08-20) +----------------------------------------------------------------------- + +Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84b + +Other Changes: + +- Fixed BeginDisabled(false) - BeginDisabled(true) was working. (#211, #4452, #4453) + + ----------------------------------------------------------------------- VERSION 1.84 (Released 2021-08-20) ----------------------------------------------------------------------- diff --git a/imgui.cpp b/imgui.cpp index e484e96cd851..212742c923ac 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.84 +// dear imgui, v1.84b // (main code and documentation) // Help: @@ -7165,7 +7165,7 @@ void ImGui::PopItemFlag() // - Those can be nested but this cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep things disabled) // - Visually this is currently altering alpha, but it is expected that in a future styling system this would work differently. // - Feedback welcome at https://github.com/ocornut/imgui/issues/211 -// - BeginDisabled(false) essentially does nothing but is provided to facilitate use of boolean expressions +// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it. // - Optimized shortcuts instead of PushStyleVar() + PushItemFlag() void ImGui::BeginDisabled(bool disabled) { @@ -7174,8 +7174,8 @@ void ImGui::BeginDisabled(bool disabled) g.DisabledAlphaBackup = g.Style.Alpha; if (!was_disabled && disabled) g.Style.Alpha *= g.Style.DisabledAlpha; // PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * g.Style.DisabledAlpha); - //PushItemFlag(ImGuiItemFlags_Disabled, was_disabled || disabled); - g.CurrentItemFlags |= ImGuiItemFlags_Disabled; + if (was_disabled || disabled) + g.CurrentItemFlags |= ImGuiItemFlags_Disabled; g.ItemFlagsStack.push_back(g.CurrentItemFlags); } diff --git a/imgui.h b/imgui.h index 8c77e2209b5f..101238a2d582 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.84 +// dear imgui, v1.84b // (headers) // Help: @@ -61,8 +61,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.84" -#define IMGUI_VERSION_NUM 18401 +#define IMGUI_VERSION "1.84b" +#define IMGUI_VERSION_NUM 18402 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_TABLE #define IMGUI_HAS_VIEWPORT // Viewport WIP branch @@ -831,6 +831,7 @@ namespace ImGui // Disabling [BETA API] // - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors) + // - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it. IMGUI_API void BeginDisabled(bool disabled = true); IMGUI_API void EndDisabled(); diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 10f72839a3e9..b6697b7ccfcb 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.84 +// dear imgui, v1.84b // (demo code) // Help: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index dbcf57fd900a..da22807d7d91 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.84 +// dear imgui, v1.84b // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index 28a5b458e49a..f07053afe0a5 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.84 +// dear imgui, v1.84b // (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 71ac00f6aad6..f8b024610868 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.84 +// dear imgui, v1.84b // (tables and columns code) /* diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index f8d13bcdab03..4c4a260f1ebb 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.84 +// dear imgui, v1.84b // (widgets code) /*