Browse Source

Disabled items more consistently release active id if the active item got disabled. (#211)

pull/4347/head
ocornut 3 years ago
parent
commit
29525255f3
  1. 1
      docs/CHANGELOG.txt
  2. 4
      imgui_widgets.cpp

1
docs/CHANGELOG.txt

@ -56,6 +56,7 @@ Other Changes:
- Drag and Drop: drop target highlight doesn't try to bypass host clipping rectangle. (#4281, #3272) - Drag and Drop: drop target highlight doesn't try to bypass host clipping rectangle. (#4281, #3272)
- Menus: MenuItem() and BeginMenu() are not affected/overlapping when style.SelectableTextAlign is altered. - Menus: MenuItem() and BeginMenu() are not affected/overlapping when style.SelectableTextAlign is altered.
- Nav: Disabled items are not candidate for default focus. (#211, #787) - Nav: Disabled items are not candidate for default focus. (#211, #787)
- Disabled: disabled mode more consistently release active id if the active item got disabled. (#211)
- Fixed printf-style format checks on non-MinGW flavors. (#4183, #3592) - Fixed printf-style format checks on non-MinGW flavors. (#4183, #3592)
- Fonts: Functions with a 'float size_pixels' parameter can accept zero if it is set in ImFontSize::SizePixels. - Fonts: Functions with a 'float size_pixels' parameter can accept zero if it is set in ImFontSize::SizePixels.
- Fonts: Prefer using U+FFFD character for fallback instead of '?', if available. (#4269) - Fonts: Prefer using U+FFFD character for fallback instead of '?', if available. (#4269)

4
imgui_widgets.cpp

@ -611,6 +611,10 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
} }
} }
// Release active id if turning disabled
if (g.ActiveId == id && (g.CurrentItemFlags & ImGuiItemFlags_Disabled))
ClearActiveID();
// Process while held // Process while held
bool held = false; bool held = false;
if (g.ActiveId == id) if (g.ActiveId == id)

Loading…
Cancel
Save