Merge branch 'master' into docking

# Conflicts:
#	backends/imgui_impl_glfw.cpp
This commit is contained in:
ocornut
2025-03-03 18:57:42 +01:00
7 changed files with 1590 additions and 1348 deletions

View File

@@ -31,9 +31,10 @@
// CHANGELOG // CHANGELOG
// (minor and older changes stripped away, please see git history for details) // (minor and older changes stripped away, please see git history for details)
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface. // 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2025-03-03: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled with asserts enabled.
// 2025-02-21: [Docking] Update monitors and work areas information every frame, as the later may change regardless of monitor changes. (#8415) // 2025-02-21: [Docking] Update monitors and work areas information every frame, as the later may change regardless of monitor changes. (#8415)
// 2024-11-05: [Docking] Added Linux workaround for spurious mouse up events emitted while dragging and creating new viewport. (#3158, #7733, #7922) // 2024-11-05: [Docking] Added Linux workaround for spurious mouse up events emitted while dragging and creating new viewport. (#3158, #7733, #7922)
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO: // 2024-08-22: Moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn // - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
// - io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn // - io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn
// - io.PlatformOpenInShellFn -> platform_io.Platform_OpenInShellFn // - io.PlatformOpenInShellFn -> platform_io.Platform_OpenInShellFn
@@ -629,8 +630,14 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
bd->Time = 0.0; bd->Time = 0.0;
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
#if GLFW_VERSION_COMBINED < 3300
platform_io.Platform_SetClipboardTextFn = [](ImGuiContext*, const char* text) { glfwSetClipboardString(ImGui_ImplGlfw_GetBackendData()->Window, text); };
platform_io.Platform_GetClipboardTextFn = [](ImGuiContext*) { return glfwGetClipboardString(ImGui_ImplGlfw_GetBackendData()->Window); };
#else
platform_io.Platform_SetClipboardTextFn = [](ImGuiContext*, const char* text) { glfwSetClipboardString(nullptr, text); }; platform_io.Platform_SetClipboardTextFn = [](ImGuiContext*, const char* text) { glfwSetClipboardString(nullptr, text); };
platform_io.Platform_GetClipboardTextFn = [](ImGuiContext*) { return glfwGetClipboardString(nullptr); }; platform_io.Platform_GetClipboardTextFn = [](ImGuiContext*) { return glfwGetClipboardString(nullptr); };
#endif
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
platform_io.Platform_OpenInShellFn = [](ImGuiContext*, const char* url) { ImGui_ImplGlfw_EmscriptenOpenURL(url); return true; }; platform_io.Platform_OpenInShellFn = [](ImGuiContext*, const char* url) { ImGui_ImplGlfw_EmscriptenOpenURL(url); return true; };
#endif #endif

View File

@@ -99,14 +99,22 @@ Other changes:
- Default for unselected tabs: TabCloseButtonMinWidthUnselected = 0.0f (visible when hovered) - Default for unselected tabs: TabCloseButtonMinWidthUnselected = 0.0f (visible when hovered)
- Tabs: fixed middle-mouse-button to close tab not checking that close button - Tabs: fixed middle-mouse-button to close tab not checking that close button
is hovered, merely it's visibility. (#8399, #8387) [@nicovanbentum] is hovered, merely it's visibility. (#8399, #8387) [@nicovanbentum]
- TextLink(), TextLinkOpenURL(): fixed honoring text baseline alignment.
(#8451, #7660) [@achabense]
- TextLinkOpenURL(): fixed default Win32 io.PlatformOpenInShellFn handler to - TextLinkOpenURL(): fixed default Win32 io.PlatformOpenInShellFn handler to
handle UTF-8 regardless of system regional settings. (#7660) [@achabense] handle UTF-8 regardless of system regional settings. (#7660) [@achabense]
- Clipper: Fixed an issue where passing an out of bound index to IncludeItemByIndex()
could incorrectly offset the final cursor, even if that index was not iterated through.
One case where it would manifest was calling Combo() with an out of range index. (#8450)
- Debug Tools: Added io.ConfigDebugHighlightIdConflictsShowItemPicker (defaults to true) - Debug Tools: Added io.ConfigDebugHighlightIdConflictsShowItemPicker (defaults to true)
to allow disabled Item Picker suggestion in user facing builds. (#7961, #7669) to allow disabled Item Picker suggestion in user facing builds. (#7961, #7669)
- Misc: Added ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress mouse cursors - Misc: Added ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress mouse cursors
(busy/wait/hourglass shape, with or without an arrow cursor). (busy/wait/hourglass shape, with or without an arrow cursor).
- Demo: Reorganized "Widgets" section to be alphabetically ordered and split in more functions.
- Demo: Combos: demonstrate a very simple way to add a filter to a combo, - Demo: Combos: demonstrate a very simple way to add a filter to a combo,
by showing the filter inside the combo contents. (#718) by showing the filter inside the combo contents. (#718)
- Backends: GLFW: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled
with asserts enabled. (#8452)
- Backends: SDL2, SDL3: Using SDL_OpenURL() in platform_io.Platform_OpenInShellFn - Backends: SDL2, SDL3: Using SDL_OpenURL() in platform_io.Platform_OpenInShellFn
handler. (#7660) [@achabense] handler. (#7660) [@achabense]
- Backends: SDL2, SDL3: Use display bounds when SDL_GetDisplayUsableBounds() - Backends: SDL2, SDL3: Use display bounds when SDL_GetDisplayUsableBounds()

View File

@@ -3318,11 +3318,11 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper)
{ {
clipper->DisplayStart = ImMax(data->Ranges[data->StepNo].Min, already_submitted); clipper->DisplayStart = ImMax(data->Ranges[data->StepNo].Min, already_submitted);
clipper->DisplayEnd = ImMin(data->Ranges[data->StepNo].Max, clipper->ItemsCount); clipper->DisplayEnd = ImMin(data->Ranges[data->StepNo].Max, clipper->ItemsCount);
if (clipper->DisplayStart > already_submitted) //-V1051
clipper->SeekCursorForItem(clipper->DisplayStart);
data->StepNo++; data->StepNo++;
if (clipper->DisplayStart == clipper->DisplayEnd && data->StepNo < data->Ranges.Size) if (clipper->DisplayStart >= clipper->DisplayEnd)
continue; continue;
if (clipper->DisplayStart > already_submitted)
clipper->SeekCursorForItem(clipper->DisplayStart);
return true; return true;
} }
@@ -3339,7 +3339,7 @@ bool ImGuiListClipper::Step()
ImGuiContext& g = *Ctx; ImGuiContext& g = *Ctx;
bool need_items_height = (ItemsHeight <= 0.0f); bool need_items_height = (ItemsHeight <= 0.0f);
bool ret = ImGuiListClipper_StepInternal(this); bool ret = ImGuiListClipper_StepInternal(this);
if (ret && (DisplayStart == DisplayEnd)) if (ret && (DisplayStart >= DisplayEnd))
ret = false; ret = false;
if (g.CurrentTable && g.CurrentTable->IsUnfrozenRows == false) if (g.CurrentTable && g.CurrentTable->IsUnfrozenRows == false)
IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): inside frozen table row.\n"); IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): inside frozen table row.\n");
@@ -21089,10 +21089,7 @@ void ImGui::ShowFontAtlas(ImFontAtlas* atlas)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
PushStyleVar(ImGuiStyleVar_ImageBorderSize, ImMax(1.0f, g.Style.ImageBorderSize)); PushStyleVar(ImGuiStyleVar_ImageBorderSize, ImMax(1.0f, g.Style.ImageBorderSize));
ImVec2 image_pos = GetCursorScreenPos(); ImageWithBg(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), ImVec4(0.0f, 0.0f, 0.0f, 1.0f));
ImVec2 image_size((float)atlas->TexWidth, (float)atlas->TexHeight);
GetWindowDrawList()->AddRectFilled(image_pos, image_pos + image_size + ImVec2(g.Style.ImageBorderSize, g.Style.ImageBorderSize), IM_COL32(0, 0, 0, 255));
Image(atlas->TexID, image_size);
PopStyleVar(); PopStyleVar();
TreePop(); TreePop();
} }

View File

@@ -29,7 +29,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.91.9 WIP" #define IMGUI_VERSION "1.91.9 WIP"
#define IMGUI_VERSION_NUM 19185 #define IMGUI_VERSION_NUM 19186
#define IMGUI_HAS_TABLE #define IMGUI_HAS_TABLE
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch #define IMGUI_HAS_VIEWPORT // Viewport WIP branch
#define IMGUI_HAS_DOCK // Docking WIP branch #define IMGUI_HAS_DOCK // Docking WIP branch
@@ -935,7 +935,7 @@ namespace ImGui
IMGUI_API void PopClipRect(); IMGUI_API void PopClipRect();
// Focus, Activation // Focus, Activation
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of of a newly appearing window. IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a newly appearing window.
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.
// Keyboard/Gamepad Navigation // Keyboard/Gamepad Navigation

File diff suppressed because it is too large Load Diff

View File

@@ -3178,7 +3178,7 @@ struct IMGUI_API ImGuiTableTempData
ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; } ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; }
}; };
// sizeof() ~ 12 // sizeof() ~ 16
struct ImGuiTableColumnSettings struct ImGuiTableColumnSettings
{ {
float WidthOrWeight; float WidthOrWeight;

View File

@@ -1450,7 +1450,7 @@ bool ImGui::TextLink(const char* label)
const ImGuiID id = window->GetID(label); const ImGuiID id = window->GetID(label);
const char* label_end = FindRenderedTextEnd(label); const char* label_end = FindRenderedTextEnd(label);
ImVec2 pos = window->DC.CursorPos; ImVec2 pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
ImVec2 size = CalcTextSize(label, label_end, true); ImVec2 size = CalcTextSize(label, label_end, true);
ImRect bb(pos, pos + size); ImRect bb(pos, pos + size);
ItemSize(size, 0.0f); ItemSize(size, 0.0f);