Skip to content

Commit

Permalink
Fixed nested BeginDisabled()/EndDisabled() calls. (ocornut#211, ocorn…
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut authored and AnClark committed Aug 30, 2021
1 parent 130ae51 commit a63e5ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
13 changes: 10 additions & 3 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,22 @@ HOW TO UPDATE?
- Please report any issue!


-----------------------------------------------------------------------
VERSION 1.84.2 (Released 2021-08-23)
-----------------------------------------------------------------------

Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84.2

- Disabled: Fixed nested BeginDisabled()/EndDisabled() calls. (#211, #4452, #4453, #4462) [@Legulysse]


-----------------------------------------------------------------------
VERSION 1.84.1 (Released 2021-08-20)
-----------------------------------------------------------------------

Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84.1

Other Changes:

- Fixed BeginDisabled(false) - BeginDisabled(true) was working. (#211, #4452, #4453)
- Disabled: Fixed BeginDisabled(false) - BeginDisabled(true) was working. (#211, #4452, #4453)


-----------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6627,9 +6627,11 @@ void ImGui::BeginDisabled(bool disabled)
{
ImGuiContext& g = *GImGui;
bool was_disabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;
g.DisabledAlphaBackup = g.Style.Alpha;
if (!was_disabled && disabled)
{
g.DisabledAlphaBackup = g.Style.Alpha;
g.Style.Alpha *= g.Style.DisabledAlpha; // PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * g.Style.DisabledAlpha);
}
if (was_disabled || disabled)
g.CurrentItemFlags |= ImGuiItemFlags_Disabled;
g.ItemFlagsStack.push_back(g.CurrentItemFlags);
Expand All @@ -6641,7 +6643,7 @@ void ImGui::EndDisabled()
bool was_disabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;
//PopItemFlag();
g.ItemFlagsStack.pop_back();
g.CurrentItemFlags &= ~ImGuiItemFlags_Disabled;
g.CurrentItemFlags = g.ItemFlagsStack.back();
if (was_disabled && (g.CurrentItemFlags & ImGuiItemFlags_Disabled) == 0)
g.Style.Alpha = g.DisabledAlphaBackup; //PopStyleVar();
}
Expand Down
4 changes: 2 additions & 2 deletions imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,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.1"
#define IMGUI_VERSION_NUM 18404
#define IMGUI_VERSION "1.84.2"
#define IMGUI_VERSION_NUM 18405
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
#define IMGUI_HAS_TABLE

Expand Down

0 comments on commit a63e5ec

Please sign in to comment.