mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Fixed PushID() from keeping alive the new ID Stack top value (if a previously active widget shared the ID it would be erroneously kept alive) (drag and drop demo could soft-lock the UI until pressing Escape!)
This commit is contained in:
parent
7e1678ff00
commit
65b46f62ef
@ -59,6 +59,7 @@ Other Changes:
|
||||
- Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut]
|
||||
- Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors.
|
||||
- Made assertion more clear when trying to call Begin() outside of the NewFrame()..EndFrame() scope. (#1987)
|
||||
- Fixed PushID() from keeping alive the new ID Stack top value (if a previously active widget shared the ID it would be erroneously kept alive).
|
||||
- Fixed horizontal mouse wheel not forwarding the request to the parent window if ImGuiWindowFlags_NoScrollWithMouse is set. (#1463, #1380, #1502)
|
||||
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
||||
- OS/Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
||||
|
14
imgui.cpp
14
imgui.cpp
@ -2194,6 +2194,12 @@ ImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end)
|
||||
return ImHash(str, str_end ? (int)(str_end - str) : 0, seed);
|
||||
}
|
||||
|
||||
ImGuiID ImGuiWindow::GetIDNoKeepAlive(const void* ptr)
|
||||
{
|
||||
ImGuiID seed = IDStack.back();
|
||||
return ImHash(&ptr, sizeof(void*), seed);
|
||||
}
|
||||
|
||||
// This is only used in rare/specific situations to manufacture an ID out of nowhere.
|
||||
ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
||||
{
|
||||
@ -8929,26 +8935,26 @@ void ImGui::SetNextTreeNodeOpen(bool is_open, ImGuiCond cond)
|
||||
void ImGui::PushID(const char* str_id)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
window->IDStack.push_back(window->GetID(str_id));
|
||||
window->IDStack.push_back(window->GetIDNoKeepAlive(str_id));
|
||||
}
|
||||
|
||||
void ImGui::PushID(const char* str_id_begin, const char* str_id_end)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
window->IDStack.push_back(window->GetID(str_id_begin, str_id_end));
|
||||
window->IDStack.push_back(window->GetIDNoKeepAlive(str_id_begin, str_id_end));
|
||||
}
|
||||
|
||||
void ImGui::PushID(const void* ptr_id)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
window->IDStack.push_back(window->GetID(ptr_id));
|
||||
window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id));
|
||||
}
|
||||
|
||||
void ImGui::PushID(int int_id)
|
||||
{
|
||||
const void* ptr_id = (void*)(intptr_t)int_id;
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
window->IDStack.push_back(window->GetID(ptr_id));
|
||||
window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id));
|
||||
}
|
||||
|
||||
void ImGui::PopID()
|
||||
|
@ -1045,6 +1045,7 @@ public:
|
||||
ImGuiID GetID(const char* str, const char* str_end = NULL);
|
||||
ImGuiID GetID(const void* ptr);
|
||||
ImGuiID GetIDNoKeepAlive(const char* str, const char* str_end = NULL);
|
||||
ImGuiID GetIDNoKeepAlive(const void* ptr);
|
||||
ImGuiID GetIDFromRectangle(const ImRect& r_abs);
|
||||
|
||||
// We don't use g.FontSize because the window may be != g.CurrentWidow.
|
||||
|
Loading…
Reference in New Issue
Block a user