From 86ec5c83429887bc700a7e4fbf54023d65d4e12c Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 19 Aug 2025 15:15:41 +0200 Subject: [PATCH 1/8] Version 1.92.3 WIP --- docs/CHANGELOG.txt | 11 ++++++++++- imgui.cpp | 2 +- imgui.h | 6 +++--- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- imgui_internal.h | 2 +- imgui_tables.cpp | 2 +- imgui_widgets.cpp | 2 +- 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 257071ae0..e009fd5d4 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -35,6 +35,15 @@ HOW TO UPDATE? and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users. - Please report any issue! +----------------------------------------------------------------------- + VERSION 1.92.3 WIP (In Progress) +----------------------------------------------------------------------- + +Breaking Changes: + +Other Changes: + + ----------------------------------------------------------------------- VERSION 1.92.2b (Released 2025-08-13) ----------------------------------------------------------------------- @@ -50,7 +59,7 @@ Changes: leak between items when the window cannot be moved. - Backends: Allegro5: Fixed texture format setup which didn't work on all setups/drivers. (#8770, #8465) -- Backends: Allegro5: Added ImGui_ImplAllegro5_SetDisplay() function to +- Backends: Allegro5: Added ImGui_ImplAllegro5_SetDisplay() function to change current ALLEGRO_DISPLAY, as Allegro applications often need to do that. - Backends: Allegro5: Fixed missing support for ImGuiKey_PrintScreen under Windows, as raw Allegro 5 does not receive it. diff --git a/imgui.cpp b/imgui.cpp index 286171463..2705d8b70 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.92.2b +// dear imgui, v1.92.3 WIP // (main code and documentation) // Help: diff --git a/imgui.h b/imgui.h index 81fb65819..0df769352 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.92.2b +// dear imgui, v1.92.3 WIP // (headers) // Help: @@ -28,8 +28,8 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') -#define IMGUI_VERSION "1.92.2b" -#define IMGUI_VERSION_NUM 19222 +#define IMGUI_VERSION "1.92.3 WIP" +#define IMGUI_VERSION_NUM 19223 #define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000 #define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198 diff --git a/imgui_demo.cpp b/imgui_demo.cpp index a8c2536f8..68f8eec9c 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.92.2b +// dear imgui, v1.92.3 WIP // (demo code) // Help: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 34a967a99..0941783a8 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.92.2b +// dear imgui, v1.92.3 WIP // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index a11d4e409..d7d17cd45 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.92.2b +// dear imgui, v1.92.3 WIP // (internal structures/api) // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility. diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 370d8f6ad..8824534e7 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.92.2b +// dear imgui, v1.92.3 WIP // (tables and columns code) /* diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 23ebf5dcd..ce9ccd9f8 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.92.2b +// dear imgui, v1.92.3 WIP // (widgets code) /* From 361e370fe02fe2e42550f896571b90e823c37d0d Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 16 Aug 2025 18:34:02 +0200 Subject: [PATCH 2/8] Examples: Android+OpenGL3: update Gradle project (#8888, #8878) --- docs/CHANGELOG.txt | 2 ++ .../android/.gitignore | 10 ++++--- .../android/app/build.gradle | 29 +++++++------------ .../android/app/src/main/AndroidManifest.xml | 3 +- .../android/build.gradle | 27 +++-------------- .../android/settings.gradle | 21 ++++++++++++++ 6 files changed, 45 insertions(+), 47 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e009fd5d4..e1aaef37a 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -43,6 +43,8 @@ Breaking Changes: Other Changes: +- Examples: Android: Android+OpenGL3: update Gradle project (#8888, #8878) [@scribam] + ----------------------------------------------------------------------- VERSION 1.92.2b (Released 2025-08-13) diff --git a/examples/example_android_opengl3/android/.gitignore b/examples/example_android_opengl3/android/.gitignore index 3c7a61910..41afcd57c 100644 --- a/examples/example_android_opengl3/android/.gitignore +++ b/examples/example_android_opengl3/android/.gitignore @@ -1,12 +1,14 @@ -.cxx -.externalNativeBuild build/ *.iml - -.idea .gradle +.idea +.DS_Store +/captures +.externalNativeBuild +.cxx local.properties # Android Studio puts a Gradle wrapper here, that we don't want: gradle/ +!gradle/libs.versions.toml gradlew* diff --git a/examples/example_android_opengl3/android/app/build.gradle b/examples/example_android_opengl3/android/app/build.gradle index 3a68c8371..e142f1917 100644 --- a/examples/example_android_opengl3/android/app/build.gradle +++ b/examples/example_android_opengl3/android/app/build.gradle @@ -1,16 +1,16 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) +} android { - compileSdkVersion 33 - buildToolsVersion "33.0.2" - ndkVersion "25.2.9519653" + namespace 'imgui.example.android' + compileSdk 36 defaultConfig { applicationId "imgui.example.android" - namespace "imgui.example.android" - minSdkVersion 24 - targetSdkVersion 33 + minSdk 24 + targetSdk 36 versionCode 1 versionName "1.0" } @@ -21,26 +21,17 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') } } - compileOptions { sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } - kotlinOptions { - jvmTarget="11" + jvmTarget = '11' } - externalNativeBuild { cmake { - path "../../CMakeLists.txt" + path file('../../CMakeLists.txt') version '3.22.1' } } } -repositories { - mavenCentral() -} -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" -} diff --git a/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml b/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml index 5a1e2d9e5..6410b5a13 100644 --- a/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml +++ b/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ - + Date: Sat, 16 Aug 2025 18:34:02 +0200 Subject: [PATCH 3/8] Examples: Android+OpenGL3: update Gradle project, amend. (#8888, #8878) --- .../android/gradle/libs.versions.toml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 examples/example_android_opengl3/android/gradle/libs.versions.toml diff --git a/examples/example_android_opengl3/android/gradle/libs.versions.toml b/examples/example_android_opengl3/android/gradle/libs.versions.toml new file mode 100644 index 000000000..82971810b --- /dev/null +++ b/examples/example_android_opengl3/android/gradle/libs.versions.toml @@ -0,0 +1,8 @@ +[versions] +agp = "8.12.0" +kotlin = "2.0.21" + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } + From 321e9eb919685bf589a301ed566bf69e948959d0 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 19 Aug 2025 15:32:12 +0200 Subject: [PATCH 4/8] Fixes for printing out ImTextureID value when it is typedef to other types. (#8889) --- imgui_draw.cpp | 6 +++--- imgui_internal.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 0941783a8..4b089286f 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -4516,16 +4516,16 @@ void ImFontAtlasDebugLogTextureRequests(ImFontAtlas* atlas) if (tex->Status == ImTextureStatus_WantCreate) IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: create %dx%d\n", tex->UniqueID, tex->Width, tex->Height); else if (tex->Status == ImTextureStatus_WantDestroy) - IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: destroy %dx%d, texid=0x%" IM_PRIX64 ", backend_data=%p\n", tex->UniqueID, tex->Width, tex->Height, tex->TexID, tex->BackendUserData); + IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: destroy %dx%d, texid=0x%" IM_PRIX64 ", backend_data=%p\n", tex->UniqueID, tex->Width, tex->Height, IM_TEXTUREID_TO_U64(tex->TexID), tex->BackendUserData); else if (tex->Status == ImTextureStatus_WantUpdates) { - IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update %d regions, texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, tex->Updates.Size, tex->TexID, (ImU64)(intptr_t)tex->BackendUserData); + IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update %d regions, texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, tex->Updates.Size, IM_TEXTUREID_TO_U64(tex->TexID), (ImU64)(intptr_t)tex->BackendUserData); for (const ImTextureRect& r : tex->Updates) { IM_UNUSED(r); IM_ASSERT(r.x >= 0 && r.y >= 0); IM_ASSERT(r.x + r.w <= tex->Width && r.y + r.h <= tex->Height); // In theory should subtract PackPadding but it's currently part of atlas and mid-frame change would wreck assert. - //IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update (% 4d..%-4d)->(% 4d..%-4d), texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, r.x, r.y, r.x + r.w, r.y + r.h, tex->TexID, (ImU64)(intptr_t)tex->BackendUserData); + //IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update (% 4d..%-4d)->(% 4d..%-4d), texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, r.x, r.y, r.x + r.w, r.y + r.h, IM_TEXTUREID_TO_U64(tex->TexID), (ImU64)(intptr_t)tex->BackendUserData); } } } diff --git a/imgui_internal.h b/imgui_internal.h index d7d17cd45..b2a675e8d 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -335,6 +335,7 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer #define IM_PRIu64 "llu" #define IM_PRIX64 "llX" #endif +#define IM_TEXTUREID_TO_U64(_TEXID) ((ImU64)(intptr_t)(_TEXID)) //----------------------------------------------------------------------------- // [SECTION] Generic helpers From 720e94f3daae98094196e8f27701ac8285469376 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 19 Aug 2025 15:32:38 +0200 Subject: [PATCH 5/8] Rework FormatTextureIDForDebugDisplay() ImDrawCmd version as FormatTextureRefForDebugDisplay(). --- imgui.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 2705d8b70..bc19d1aeb 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -15940,12 +15940,12 @@ static const char* FormatTextureIDForDebugDisplay(char* buf, int buf_size, ImTex return buf; } -static const char* FormatTextureIDForDebugDisplay(char* buf, int buf_size, const ImDrawCmd* cmd) +static const char* FormatTextureRefForDebugDisplay(char* buf, int buf_size, ImTextureRef tex_ref) { char* buf_end = buf + buf_size; - if (cmd->TexRef._TexData != NULL) - buf += ImFormatString(buf, buf_end - buf, "#%03d: ", cmd->TexRef._TexData->UniqueID); - return FormatTextureIDForDebugDisplay(buf, (int)(buf_end - buf), cmd->TexRef.GetTexID()); // Calling TexRef::GetTexID() to avoid assert of cmd->GetTexID() + if (tex_ref._TexData != NULL) + buf += ImFormatString(buf, buf_end - buf, "#%03d: ", tex_ref._TexData->UniqueID); + return FormatTextureIDForDebugDisplay(buf, (int)(buf_end - buf), tex_ref.GetTexID()); // Calling TexRef::GetTexID() to avoid assert of cmd->GetTexID() } #ifdef IMGUI_ENABLE_FREETYPE @@ -16133,7 +16133,7 @@ void ImGui::DebugNodeTexture(ImTextureData* tex, int int_id, const ImFontAtlasRe char texid_desc[30]; Text("Status = %s (%d), Format = %s (%d), UseColors = %d", ImTextureDataGetStatusName(tex->Status), tex->Status, ImTextureDataGetFormatName(tex->Format), tex->Format, tex->UseColors); - Text("TexID = %s, BackendUserData = %p", FormatTextureIDForDebugDisplay(texid_desc, IM_ARRAYSIZE(texid_desc), tex->TexID), tex->BackendUserData); + Text("TexID = %s, BackendUserData = %p", FormatTextureRefForDebugDisplay(texid_desc, IM_ARRAYSIZE(texid_desc), tex->GetTexRef()), tex->BackendUserData); TreePop(); } PopID(); @@ -16834,7 +16834,7 @@ void ImGui::DebugNodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, con } char texid_desc[30]; - FormatTextureIDForDebugDisplay(texid_desc, IM_ARRAYSIZE(texid_desc), pcmd); + FormatTextureRefForDebugDisplay(texid_desc, IM_ARRAYSIZE(texid_desc), pcmd->TexRef); char buf[300]; ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd:%5d tris, Tex %s, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)", pcmd->ElemCount / 3, texid_desc, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w); From 0c4f50090aa9ec3d9ea7d0159a801dd2cea5df83 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 20 Aug 2025 17:48:03 +0200 Subject: [PATCH 6/8] DrawList: fixed CloneOutput() taking a copy of the ImDrawListSharedData pointer. (#8894, #1860) Amend b82e99c032 --- imgui.h | 2 +- imgui_draw.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/imgui.h b/imgui.h index 0df769352..95c70c71b 100644 --- a/imgui.h +++ b/imgui.h @@ -3316,7 +3316,7 @@ struct ImDrawList // Advanced: Miscellaneous IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible - IMGUI_API ImDrawList* CloneOutput() const; // Create a clone of the CmdBuffer/IdxBuffer/VtxBuffer. + IMGUI_API ImDrawList* CloneOutput() const; // Create a clone of the CmdBuffer/IdxBuffer/VtxBuffer. For multi-threaded rendering, consider using `imgui_threaded_rendering` from https://github.com/ocornut/imgui_club instead. // Advanced: Channels // - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 4b089286f..0426d4a2e 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -478,9 +478,10 @@ void ImDrawList::_ClearFreeMemory() _Splitter.ClearFreeMemory(); } +// Note: For multi-threaded rendering, consider using `imgui_threaded_rendering` from https://github.com/ocornut/imgui_club ImDrawList* ImDrawList::CloneOutput() const { - ImDrawList* dst = IM_NEW(ImDrawList(_Data)); + ImDrawList* dst = IM_NEW(ImDrawList(NULL)); dst->CmdBuffer = CmdBuffer; dst->IdxBuffer = IdxBuffer; dst->VtxBuffer = VtxBuffer; From 89b7fc906a993228edc120fc13092c016663794c Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 20 Aug 2025 17:57:06 +0200 Subject: [PATCH 7/8] DrawList: fixed CloneOutput() taking a copy of the ImDrawListSharedData pointer. Missing Changelog. (#8894, #1860) --- docs/CHANGELOG.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e1aaef37a..02858c4c6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -43,6 +43,8 @@ Breaking Changes: Other Changes: +- DrawList: Fixed CloneOutput() unnecessarily taking a copy of the ImDrawListSharedData + pointer, which could to issue when deleting the cloned list. (#8894, #1860) - Examples: Android: Android+OpenGL3: update Gradle project (#8888, #8878) [@scribam] From 42656b3aa197f57e32b94ceb00cf6bf309992436 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 20 Aug 2025 18:27:35 +0200 Subject: [PATCH 8/8] Scrollbar, Style: added style.ScrollbarPadding, ImGuiStyleVar_ScrollbarPadding. (#8895) --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 3 +++ imgui.h | 2 ++ imgui_demo.cpp | 7 +++++-- imgui_widgets.cpp | 3 ++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 02858c4c6..b126e5f15 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -43,6 +43,8 @@ Breaking Changes: Other Changes: +- Scrollbar, Style: added configurable style.ScrollbarPadding value and corresponding + ImGuiStyleVar_ScrollbarPadding enum, instead of hardcoded computed default. (#8895) - DrawList: Fixed CloneOutput() unnecessarily taking a copy of the ImDrawListSharedData pointer, which could to issue when deleting the cloned list. (#8894, #1860) - Examples: Android: Android+OpenGL3: update Gradle project (#8888, #8878) [@scribam] diff --git a/imgui.cpp b/imgui.cpp index bc19d1aeb..8b201ee76 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1413,6 +1413,7 @@ ImGuiStyle::ImGuiStyle() ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). ScrollbarSize = 14.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar + ScrollbarPadding = 2.0f; // Padding of scrollbar grab within its frame (same for both axises) GrabMinSize = 12.0f; // Minimum width/height of a grab box for slider/scrollbar GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. @@ -1482,6 +1483,7 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor) ColumnsMinSpacing = ImTrunc(ColumnsMinSpacing * scale_factor); ScrollbarSize = ImTrunc(ScrollbarSize * scale_factor); ScrollbarRounding = ImTrunc(ScrollbarRounding * scale_factor); + ScrollbarPadding = ImTrunc(ScrollbarPadding * scale_factor); GrabMinSize = ImTrunc(GrabMinSize * scale_factor); GrabRounding = ImTrunc(GrabRounding * scale_factor); LogSliderDeadzone = ImTrunc(LogSliderDeadzone * scale_factor); @@ -3503,6 +3505,7 @@ static const ImGuiStyleVarInfo GStyleVarsInfo[] = { 2, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, CellPadding) }, // ImGuiStyleVar_CellPadding { 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarSize) }, // ImGuiStyleVar_ScrollbarSize { 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarRounding) }, // ImGuiStyleVar_ScrollbarRounding + { 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ScrollbarPadding) }, // ImGuiStyleVar_ScrollbarPadding { 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize { 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding { 1, ImGuiDataType_Float, (ImU32)offsetof(ImGuiStyle, ImageBorderSize) }, // ImGuiStyleVar_ImageBorderSize diff --git a/imgui.h b/imgui.h index 95c70c71b..6b35f8403 100644 --- a/imgui.h +++ b/imgui.h @@ -1805,6 +1805,7 @@ enum ImGuiStyleVar_ ImGuiStyleVar_CellPadding, // ImVec2 CellPadding ImGuiStyleVar_ScrollbarSize, // float ScrollbarSize ImGuiStyleVar_ScrollbarRounding, // float ScrollbarRounding + ImGuiStyleVar_ScrollbarPadding, // float ScrollbarPadding ImGuiStyleVar_GrabMinSize, // float GrabMinSize ImGuiStyleVar_GrabRounding, // float GrabRounding ImGuiStyleVar_ImageBorderSize, // float ImageBorderSize @@ -2271,6 +2272,7 @@ struct ImGuiStyle float ColumnsMinSpacing; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). float ScrollbarSize; // Width of the vertical scrollbar, Height of the horizontal scrollbar. float ScrollbarRounding; // Radius of grab corners for scrollbar. + float ScrollbarPadding; // Padding of scrollbar grab within its frame (same for both axises). float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar. float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 68f8eec9c..be1698bdd 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -8325,7 +8325,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f"); SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f"); SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f"); - SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); SeparatorText("Borders"); @@ -8339,9 +8338,13 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 12.0f, "%.0f"); SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"); SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f"); - SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f"); SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f"); + SeparatorText("Scrollbar"); + SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); + SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f"); + SliderFloat("ScrollbarPadding", &style.ScrollbarPadding, 0.0f, 10.0f, "%.0f"); + SeparatorText("Tabs"); SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f"); SliderFloat("TabBarBorderSize", &style.TabBarBorderSize, 0.0f, 2.0f, "%.0f"); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index ce9ccd9f8..4a64b2c21 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1026,7 +1026,8 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6 const bool allow_interaction = (alpha >= 1.0f); ImRect bb = bb_frame; - bb.Expand(ImVec2(-ImClamp(IM_TRUNC((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_TRUNC((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f))); + float padding = IM_TRUNC(ImMin(style.ScrollbarPadding, ImMin(bb_frame_width, bb_frame_height) * 0.5f)); + bb.Expand(-padding); // V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar) const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();