mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-27 04:00:51 +00:00
Misc: Fixed calling GetID("label") _before_ a widget emitting this item inside a group (such as InputInt()) from causing an assertion when closing the group. (#5181).
This commit is contained in:
parent
937d073328
commit
90386780e3
@ -75,6 +75,8 @@ Other Changes:
|
||||
- Stack Tool: Added option to copy item path to clipboard. (#4631)
|
||||
- Drawlist: Fixed PathArcTo() emitting terminating vertices too close to arc vertices. (#4993) [@thedmd]
|
||||
- DrawList: Fixed texture-based anti-aliasing path with RGBA textures (#5132, #3245) [@cfillion]
|
||||
- Misc: Fixed calling GetID("label") _before_ a widget emitting this item inside a group (such as InputInt())
|
||||
from causing an assertion when closing the group. (#5181).
|
||||
- Misc: Fixed IsAnyItemHovered() returning false when using navigation.
|
||||
- Misc: Added IMGUI_STB_SPRINTF_FILENAME to support custom path to stb_sprintf. (#5068, #2954) [@jakubtomsu]
|
||||
- Misc: Added constexpr to ImVec2/ImVec4 inline constructors. (#4995) [@Myriachan]
|
||||
|
14
imgui.cpp
14
imgui.cpp
@ -3268,7 +3268,6 @@ ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end)
|
||||
{
|
||||
ImGuiID seed = IDStack.back();
|
||||
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
||||
ImGui::KeepAliveID(id);
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.DebugHookIdInfo == id)
|
||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
||||
@ -3279,7 +3278,6 @@ ImGuiID ImGuiWindow::GetID(const void* ptr)
|
||||
{
|
||||
ImGuiID seed = IDStack.back();
|
||||
ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);
|
||||
ImGui::KeepAliveID(id);
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.DebugHookIdInfo == id)
|
||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL);
|
||||
@ -3290,7 +3288,6 @@ ImGuiID ImGuiWindow::GetID(int n)
|
||||
{
|
||||
ImGuiID seed = IDStack.back();
|
||||
ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
||||
ImGui::KeepAliveID(id);
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.DebugHookIdInfo == id)
|
||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
||||
@ -3333,7 +3330,6 @@ ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
||||
ImGuiID seed = IDStack.back();
|
||||
ImRect r_rel = ImGui::WindowRectAbsToRel(this, r_abs);
|
||||
ImGuiID id = ImHashData(&r_rel, sizeof(r_rel), seed);
|
||||
ImGui::KeepAliveID(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -3436,6 +3432,8 @@ ImGuiID ImGui::GetHoveredID()
|
||||
return g.HoveredId ? g.HoveredId : g.HoveredIdPreviousFrame;
|
||||
}
|
||||
|
||||
// This is called by ItemAdd().
|
||||
// Code not using ItemAdd() may need to call this manually otherwise ActiveId will be cleared. In IMGUI_VERSION_NUM < 18717 this was called by GetID().
|
||||
void ImGui::KeepAliveID(ImGuiID id)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@ -5625,6 +5623,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
||||
if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x);
|
||||
if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y);
|
||||
ImGuiID resize_grip_id = window->GetID(resize_grip_n); // == GetWindowResizeCornerID()
|
||||
KeepAliveID(resize_grip_id);
|
||||
ButtonBehavior(resize_rect, resize_grip_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus);
|
||||
//GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));
|
||||
if (hovered || held)
|
||||
@ -5660,6 +5659,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
||||
bool hovered, held;
|
||||
ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, WINDOWS_HOVER_PADDING);
|
||||
ImGuiID border_id = window->GetID(border_n + 4); // == GetWindowResizeBorderID()
|
||||
KeepAliveID(border_id);
|
||||
ButtonBehavior(border_rect, border_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus);
|
||||
//GetForegroundDrawLists(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255));
|
||||
if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held)
|
||||
@ -8282,6 +8282,8 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
|
||||
// Directional navigation processing
|
||||
if (id != 0)
|
||||
{
|
||||
KeepAliveID(id);
|
||||
|
||||
// Runs prior to clipping early-out
|
||||
// (a) So that NavInitRequest can be honored, for newly opened windows to select a default widget
|
||||
// (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests
|
||||
@ -11046,6 +11048,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
||||
// We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.
|
||||
// Rely on keeping other window->LastItemXXX fields intact.
|
||||
source_id = g.LastItemData.ID = window->GetIDFromRectangle(g.LastItemData.Rect);
|
||||
KeepAliveID(source_id);
|
||||
bool is_hovered = ItemHoverable(g.LastItemData.Rect, source_id);
|
||||
if (is_hovered && g.IO.MouseClicked[mouse_button])
|
||||
{
|
||||
@ -11212,7 +11215,10 @@ bool ImGui::BeginDragDropTarget()
|
||||
const ImRect& display_rect = (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasDisplayRect) ? g.LastItemData.DisplayRect : g.LastItemData.Rect;
|
||||
ImGuiID id = g.LastItemData.ID;
|
||||
if (id == 0)
|
||||
{
|
||||
id = window->GetIDFromRectangle(display_rect);
|
||||
KeepAliveID(id);
|
||||
}
|
||||
if (g.DragDropPayload.SourceId == id)
|
||||
return false;
|
||||
|
||||
|
2
imgui.h
2
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 18716
|
||||
#define IMGUI_VERSION_NUM 18717
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user