mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-28 17:14:36 +00:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_glfw.cpp # backends/imgui_impl_glfw.h # backends/imgui_impl_opengl3.cpp # imgui.cpp
This commit is contained in:
41
imgui.cpp
41
imgui.cpp
@@ -402,6 +402,12 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
||||
- likewise io.MousePos and GetMousePos() will use OS coordinates.
|
||||
If you query mouse positions to interact with non-imgui coordinates you will need to offset them, e.g. subtract GetWindowViewport()->Pos.
|
||||
|
||||
- 2025/11/24 (1.92.6) - Fonts: Fixed handling of `ImFontConfig::FontDataOwnedByAtlas = false` which did erroneously make a copy of the font data, essentially defeating the purpose of this flag and wasting memory.
|
||||
(trivia: undetected since July 2015, this is perhaps the oldest bug in Dear ImGui history, albeit for a rarely used feature, see #9086)
|
||||
HOWEVER, fixing this bug is likely to surface bugs in user code using `FontDataOwnedByAtlas = false`.
|
||||
- Prior to 1.92, font data only needed to be available during the atlas->AddFontXXX() call.
|
||||
- Since 1.92, font data needs to available until atlas->RemoveFont(), or more typically until a shutdown of the owning context or font atlas.
|
||||
- The fact that handling of `FontDataOwnedByAtlas = false` was broken bypassed the issue altogether.
|
||||
- 2025/11/06 (1.92.5) - BeginChild: commented out some legacy names which were obsoleted in 1.90.0 (Nov 2023), 1.90.9 (July 2024), 1.91.1 (August 2024):
|
||||
- ImGuiChildFlags_Border --> ImGuiChildFlags_Borders
|
||||
- ImGuiWindowFlags_NavFlattened --> ImGuiChildFlags_NavFlattened (moved to ImGuiChildFlags). BeginChild(name, size, 0, ImGuiWindowFlags_NavFlattened) --> BeginChild(name, size, ImGuiChildFlags_NavFlattened, 0)
|
||||
@@ -2429,11 +2435,8 @@ ImGuiID ImHashData(const void* data_p, size_t data_size, ImGuiID seed)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Zero-terminated string hash, with support for ### to reset back to seed value
|
||||
// We support a syntax of "label###id" where only "###id" is included in the hash, and only "label" gets displayed.
|
||||
// Because this syntax is rarely used we are optimizing for the common case.
|
||||
// - If we reach ### in the string we discard the hash so far and reset to the seed.
|
||||
// - We don't do 'current += 2; continue;' after handling ### to keep the code smaller/faster (measured ~10% diff in Debug build)
|
||||
// Zero-terminated string hash, with support for ### to reset back to seed value.
|
||||
// e.g. "label###id" outputs the same hash as "id" (and "label" is generally displayed by the UI functions)
|
||||
// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
|
||||
ImGuiID ImHashStr(const char* data_p, size_t data_size, ImGuiID seed)
|
||||
{
|
||||
@@ -2445,11 +2448,16 @@ ImGuiID ImHashStr(const char* data_p, size_t data_size, ImGuiID seed)
|
||||
#endif
|
||||
if (data_size != 0)
|
||||
{
|
||||
while (data_size-- != 0)
|
||||
while (data_size-- > 0)
|
||||
{
|
||||
unsigned char c = *data++;
|
||||
if (c == '#' && data_size >= 2 && data[0] == '#' && data[1] == '#')
|
||||
{
|
||||
crc = seed;
|
||||
data += 2;
|
||||
data_size -= 2;
|
||||
continue;
|
||||
}
|
||||
#ifndef IMGUI_ENABLE_SSE4_2_CRC
|
||||
crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
|
||||
#else
|
||||
@@ -2462,7 +2470,11 @@ ImGuiID ImHashStr(const char* data_p, size_t data_size, ImGuiID seed)
|
||||
while (unsigned char c = *data++)
|
||||
{
|
||||
if (c == '#' && data[0] == '#' && data[1] == '#')
|
||||
{
|
||||
crc = seed;
|
||||
data += 2;
|
||||
continue;
|
||||
}
|
||||
#ifndef IMGUI_ENABLE_SSE4_2_CRC
|
||||
crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
|
||||
#else
|
||||
@@ -2480,7 +2492,7 @@ const char* ImHashSkipUncontributingPrefix(const char* label)
|
||||
const char* result = label;
|
||||
while (unsigned char c = *label++)
|
||||
if (c == '#' && label[0] == '#' && label[1] == '#')
|
||||
result = label - 1;
|
||||
result = label + 2;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4000,16 +4012,13 @@ void ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding)
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Might move those to style if there is a real need.
|
||||
static const ImU32 GColorMarkers[4] = { IM_COL32(240,20,20,255), IM_COL32(20,240,20,255), IM_COL32(20,20,240,255), IM_COL32(140,140,140,255) };
|
||||
|
||||
void ImGui::RenderColorComponentMarker(int component_idx, const ImRect& bb, float rounding)
|
||||
void ImGui::RenderColorComponentMarker(const ImRect& bb, ImU32 col, float rounding)
|
||||
{
|
||||
if (!(component_idx >= 0 && component_idx < 4) || (bb.Min.x + 1 >= bb.Max.x))
|
||||
if (bb.Min.x + 1 >= bb.Max.x)
|
||||
return;
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
RenderRectFilledInRangeH(window->DrawList, bb, GetColorU32(GColorMarkers[component_idx]), bb.Min.x, ImMin(bb.Min.x + g.Style.ColorMarkerSize, bb.Max.x), rounding);
|
||||
RenderRectFilledInRangeH(window->DrawList, bb, col, bb.Min.x, ImMin(bb.Min.x + g.Style.ColorMarkerSize, bb.Max.x), rounding);
|
||||
}
|
||||
|
||||
void ImGui::RenderNavCursor(const ImRect& bb, ImGuiID id, ImGuiNavRenderCursorFlags flags)
|
||||
@@ -7943,11 +7952,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
bool window_title_visible_elsewhere = false;
|
||||
if ((window->Viewport && window->Viewport->Window == window) || (window->DockIsActive))
|
||||
window_title_visible_elsewhere = true;
|
||||
else if (g.NavWindowingListWindow != NULL && (flags & ImGuiWindowFlags_NoNavFocus) == 0) // Window titles visible when using Ctrl+Tab
|
||||
else if (g.NavWindowingListWindow != NULL && g.NavWindowingListWindow->WasActive && (flags & ImGuiWindowFlags_NoNavFocus) == 0) // Window titles visible when using Ctrl+Tab
|
||||
window_title_visible_elsewhere = true;
|
||||
else if (flags & ImGuiWindowFlags_ChildMenu)
|
||||
window_title_visible_elsewhere = true;
|
||||
if (window_title_visible_elsewhere && !window_just_created && strcmp(name, window->Name) != 0)
|
||||
if ((window_title_visible_elsewhere || window_just_activated_by_user) && !window_just_created && strcmp(name, window->Name) != 0)
|
||||
{
|
||||
size_t buf_len = (size_t)window->NameBufLen;
|
||||
window->Name = ImStrdupcpy(window->Name, &buf_len, name);
|
||||
@@ -15955,7 +15964,7 @@ void ImGui::LogButtons()
|
||||
const bool log_to_file = Button("Log To File"); SameLine();
|
||||
const bool log_to_clipboard = Button("Log To Clipboard"); SameLine();
|
||||
PushItemFlag(ImGuiItemFlags_NoTabStop, true);
|
||||
SetNextItemWidth(80.0f);
|
||||
SetNextItemWidth(CalcTextSize("999").x);
|
||||
SliderInt("Default Depth", &g.LogDepthToExpandDefault, 0, 9, NULL);
|
||||
PopItemFlag();
|
||||
PopID();
|
||||
|
||||
Reference in New Issue
Block a user