mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
ButtonBehavior: Fixed an edge case where changing widget type/behavior while active and using same id could lead to an assert. (#6304)
+ Demo: use BeginDisabled() block in BackendFlags section. I'd still consider this undefined behavior as some combination may not work properly, but let's fix things while we can as we encounter them.
This commit is contained in:
parent
c9fe7ebc7b
commit
47a07d8476
@ -56,6 +56,8 @@ Other changes:
|
|||||||
horizontal mouse-wheel (or Shift + WheelY). (#2702)
|
horizontal mouse-wheel (or Shift + WheelY). (#2702)
|
||||||
- Rendering: Using adaptative tesselation for: RadioButton, ColorEdit preview circles,
|
- Rendering: Using adaptative tesselation for: RadioButton, ColorEdit preview circles,
|
||||||
Windows Close and Collapse Buttons.
|
Windows Close and Collapse Buttons.
|
||||||
|
- ButtonBehavior: Fixed an edge case where changing widget type/behavior while active
|
||||||
|
and using same id could lead to an assert. (#6304)
|
||||||
- Misc: Fixed ImVec2 operator[] violating aliasing rules causing issue with Intel C++
|
- Misc: Fixed ImVec2 operator[] violating aliasing rules causing issue with Intel C++
|
||||||
compiler. (#6272) [@BayesBug]
|
compiler. (#6272) [@BayesBug]
|
||||||
- IO: Input queue trickling adjustment for touch screens. (#2702, #4921)
|
- IO: Input queue trickling adjustment for touch screens. (#2702, #4921)
|
||||||
|
2
imgui.h
2
imgui.h
@ -23,7 +23,7 @@
|
|||||||
// Library Version
|
// Library Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345')
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345')
|
||||||
#define IMGUI_VERSION "1.89.5 WIP"
|
#define IMGUI_VERSION "1.89.5 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18948
|
#define IMGUI_VERSION_NUM 18949
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -483,13 +483,13 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
"Those flags are set by the backends (imgui_impl_xxx files) to specify their capabilities.\n"
|
"Those flags are set by the backends (imgui_impl_xxx files) to specify their capabilities.\n"
|
||||||
"Here we expose them as read-only fields to avoid breaking interactions with your backend.");
|
"Here we expose them as read-only fields to avoid breaking interactions with your backend.");
|
||||||
|
|
||||||
// Make a local copy to avoid modifying actual backend flags.
|
// FIXME: Maybe we need a BeginReadonly() equivalent to keep label bright?
|
||||||
// FIXME: We don't use BeginDisabled() to keep label bright, maybe we need a BeginReadonly() equivalent..
|
ImGui::BeginDisabled();
|
||||||
ImGuiBackendFlags backend_flags = io.BackendFlags;
|
ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", &io.BackendFlags, ImGuiBackendFlags_HasGamepad);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", &backend_flags, ImGuiBackendFlags_HasGamepad);
|
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &io.BackendFlags, ImGuiBackendFlags_HasMouseCursors);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &backend_flags, ImGuiBackendFlags_HasMouseCursors);
|
ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", &io.BackendFlags, ImGuiBackendFlags_HasSetMousePos);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", &backend_flags, ImGuiBackendFlags_HasSetMousePos);
|
ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", &io.BackendFlags, ImGuiBackendFlags_RendererHasVtxOffset);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", &backend_flags, ImGuiBackendFlags_RendererHasVtxOffset);
|
ImGui::EndDisabled();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
}
|
}
|
||||||
|
@ -638,7 +638,12 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
g.ActiveIdClickOffset = g.IO.MousePos - bb.Min;
|
g.ActiveIdClickOffset = g.IO.MousePos - bb.Min;
|
||||||
|
|
||||||
const int mouse_button = g.ActiveIdMouseButton;
|
const int mouse_button = g.ActiveIdMouseButton;
|
||||||
if (IsMouseDown(mouse_button, test_owner_id))
|
if (mouse_button == -1)
|
||||||
|
{
|
||||||
|
// Fallback for the rare situation were g.ActiveId was set programmatically or from another widget (e.g. #6304).
|
||||||
|
ClearActiveID();
|
||||||
|
}
|
||||||
|
else if (IsMouseDown(mouse_button, test_owner_id))
|
||||||
{
|
{
|
||||||
held = true;
|
held = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user