Merge branch 'master' into docking # Conflicts: # backends/imgui_impl_sdl2.cpp # backends/imgui_impl_sdl3.cpp # imgui.h # imgui_demo.cpp # imgui_internal.h
diff --git a/backends/imgui_impl_dx12.h b/backends/imgui_impl_dx12.h index 37a8722..97dcc0f 100644 --- a/backends/imgui_impl_dx12.h +++ b/backends/imgui_impl_dx12.h
@@ -25,6 +25,12 @@ #include <dxgiformat.h> // DXGI_FORMAT #include <d3d12.h> // D3D12_CPU_DESCRIPTOR_HANDLE +// Clang/GCC warnings with -Weverything +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast +#endif + // Initialization data, for ImGui_ImplDX12_Init() struct ImGui_ImplDX12_InitInfo { @@ -45,7 +51,7 @@ D3D12_GPU_DESCRIPTOR_HANDLE LegacySingleSrvGpuDescriptor; #endif - ImGui_ImplDX12_InitInfo() { memset(this, 0, sizeof(*this)); } + ImGui_ImplDX12_InitInfo() { memset((void*)this, 0, sizeof(*this)); } }; // Follow "Getting Started" link and check examples/ folder to learn about using backends! @@ -77,4 +83,8 @@ ID3D12GraphicsCommandList* CommandList; }; +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + #endif // #ifndef IMGUI_DISABLE
diff --git a/backends/imgui_impl_sdl2.cpp b/backends/imgui_impl_sdl2.cpp index 1a3d4e8..a8387d8 100644 --- a/backends/imgui_impl_sdl2.cpp +++ b/backends/imgui_impl_sdl2.cpp
@@ -26,6 +26,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) // 2026-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface. +// 2026-02-13: Inputs: systems other than X11 are back to starting mouse capture on mouse down (reverts 2025-02-26 change). Only X11 requires waiting for a drag by default (not ideal, but a better default for X11 users). Added ImGui_ImplSDL2_SetMouseCaptureMode() for X11 debugger users. (#3650, #6410, #9235) // 2026-01-15: Changed GetClipboardText() handler to return nullptr on error aka clipboard contents is not text. Consistent with other backends. (#9168) // 2025-09-24: Skip using the SDL_GetGlobalMouseState() state when one of our window is hovered, as the SDL_MOUSEMOTION data is reliable. Fix macOS notch mouse coordinates issue in fullscreen mode + better perf on X11. (#7919, #7786) // 2025-09-18: Call platform_io.ClearPlatformHandlers() on shutdown. @@ -37,7 +38,7 @@ // 2025-04-09: Don't attempt to call SDL_CaptureMouse() on drivers where we don't call SDL_GetGlobalMouseState(). (#8561) // 2025-03-21: Fill gamepad inputs and set ImGuiBackendFlags_HasGamepad regardless of ImGuiConfigFlags_NavEnableGamepad being set. // 2025-03-10: When dealing with OEM keys, use scancodes instead of translated keycodes to choose ImGuiKey values. (#7136, #7201, #7206, #7306, #7670, #7672, #8468) -// 2025-02-26: Only start SDL_CaptureMouse() when mouse is being dragged, to mitigate issues with e.g.Linux debuggers not claiming capture back. (#6410, #3650) +// 2025-02-26: Only start SDL_CaptureMouse() when mouse is being dragged, to mitigate issues with e.g. Linux debuggers not claiming capture back. (#6410, #3650) // 2025-02-25: [Docking] Revert to use SDL_GetDisplayBounds() for WorkPos/WorkRect if SDL_GetDisplayUsableBounds() failed. // 2025-02-24: Avoid calling SDL_GetGlobalMouseState() when mouse is in relative mode. // 2025-02-21: [Docking] Update monitors and work areas information every frame, as the later may change regardless of monitor changes. (#8415) @@ -173,8 +174,8 @@ SDL_Cursor* MouseLastCursor; int MouseLastLeaveFrame; bool MouseCanUseGlobalState; - bool MouseCanUseCapture; bool MouseCanReportHoveredViewport; // This is hard to use/unreliable on SDL so we'll set ImGuiBackendFlags_HasMouseHoveredViewport dynamically based on state. + ImGui_ImplSDL2_MouseCaptureMode MouseCaptureMode; // Gamepad handling ImVector<SDL_GameController*> Gamepads; @@ -574,13 +575,16 @@ // Check and store if we are on a SDL backend that supports SDL_GetGlobalMouseState() and SDL_CaptureMouse() // ("wayland" and "rpi" don't support it, but we chose to use a white-list instead of a black-list) bd->MouseCanUseGlobalState = false; - bd->MouseCanUseCapture = false; + bd->MouseCaptureMode = ImGui_ImplSDL2_MouseCaptureMode_Disabled; #if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE const char* sdl_backend = SDL_GetCurrentVideoDriver(); const char* capture_and_global_state_whitelist[] = { "windows", "cocoa", "x11", "DIVE", "VMAN" }; for (const char* item : capture_and_global_state_whitelist) if (strncmp(sdl_backend, item, strlen(item)) == 0) - bd->MouseCanUseGlobalState = bd->MouseCanUseCapture = true; + { + bd->MouseCanUseGlobalState = true; + bd->MouseCaptureMode = (strcmp(item, "x11") == 0) ? ImGui_ImplSDL2_MouseCaptureMode_EnabledAfterDrag : ImGui_ImplSDL2_MouseCaptureMode_Enabled; + } #endif if (bd->MouseCanUseGlobalState) io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform side (optional) @@ -724,7 +728,15 @@ IM_DELETE(bd); } -// This code is incredibly messy because some of the functions we need for full viewport support are not available in SDL < 2.0.4. +void ImGui_ImplSDL2_SetMouseCaptureMode(ImGui_ImplSDL2_MouseCaptureMode mode) +{ + ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData(); + if (mode == ImGui_ImplSDL2_MouseCaptureMode_Disabled && bd->MouseCaptureMode != ImGui_ImplSDL2_MouseCaptureMode_Disabled) + SDL_CaptureMouse(SDL_FALSE); + bd->MouseCaptureMode = mode; +} + +// This code is rather messy because some of the functions we need for full viewport support are not available in SDL < 2.0.4. static void ImGui_ImplSDL2_UpdateMouseData() { ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData(); @@ -733,8 +745,12 @@ // We forward mouse input when hovered or captured (via SDL_MOUSEMOTION) or when focused (below) #if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE // - SDL_CaptureMouse() let the OS know e.g. that our drags can extend outside of parent boundaries (we want updated position) and shouldn't trigger other operations outside. - // - Debuggers under Linux tends to leave captured mouse on break, which may be very inconvenient, so to mitigate the issue we wait until mouse has moved to begin capture. - if (bd->MouseCanUseCapture) + // - Debuggers under Linux tends to leave captured mouse on break, which may be very inconvenient, so to mitigate the issue on X11 we we wait until mouse has moved to begin capture. + if (bd->MouseCaptureMode == ImGui_ImplSDL2_MouseCaptureMode_Enabled) + { + SDL_CaptureMouse((bd->MouseButtonsDown != 0) ? SDL_TRUE : SDL_FALSE); + } + else if (bd->MouseCaptureMode == ImGui_ImplSDL2_MouseCaptureMode_EnabledAfterDrag) { bool want_capture = false; for (int button_n = 0; button_n < ImGuiMouseButton_COUNT && !want_capture; button_n++)
diff --git a/backends/imgui_impl_sdl2.h b/backends/imgui_impl_sdl2.h index 1ad8365..e091ba3 100644 --- a/backends/imgui_impl_sdl2.h +++ b/backends/imgui_impl_sdl2.h
@@ -51,4 +51,11 @@ enum ImGui_ImplSDL2_GamepadMode { ImGui_ImplSDL2_GamepadMode_AutoFirst, ImGui_ImplSDL2_GamepadMode_AutoAll, ImGui_ImplSDL2_GamepadMode_Manual }; IMGUI_IMPL_API void ImGui_ImplSDL2_SetGamepadMode(ImGui_ImplSDL2_GamepadMode mode, struct _SDL_GameController** manual_gamepads_array = nullptr, int manual_gamepads_count = -1); +// (Advanced, for X11 users) Override Mouse Capture mode. Mouse capture allows receiving updated mouse position after clicking inside our window and dragging outside it. +// Having this 'Enabled' is in theory always better. But, on X11 if you crash/break to debugger while capture is active you may temporarily lose access to your mouse. +// The best solution is to setup your debugger to automatically release capture, e.g. 'setxkbmap -option grab:break_actions && xdotool key XF86Ungrab' or via a GDB script. See #3650. +// But you may independently decide on X11, when a debugger is attached, to set this value to ImGui_ImplSDL2_MouseCaptureMode_Disabled. +enum ImGui_ImplSDL2_MouseCaptureMode { ImGui_ImplSDL2_MouseCaptureMode_Enabled, ImGui_ImplSDL2_MouseCaptureMode_EnabledAfterDrag, ImGui_ImplSDL2_MouseCaptureMode_Disabled }; +IMGUI_IMPL_API void ImGui_ImplSDL2_SetMouseCaptureMode(ImGui_ImplSDL2_MouseCaptureMode mode); + #endif // #ifndef IMGUI_DISABLE
diff --git a/backends/imgui_impl_sdl3.cpp b/backends/imgui_impl_sdl3.cpp index 368f261..5ca8166 100644 --- a/backends/imgui_impl_sdl3.cpp +++ b/backends/imgui_impl_sdl3.cpp
@@ -24,6 +24,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) // 2026-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface. +// 2026-02-13: Inputs: systems other than X11 are back to starting mouse capture on mouse down (reverts 2025-02-26 change). Only X11 requires waiting for a drag by default (not ideal, but a better default for X11 users). Added ImGui_ImplSDL3_SetMouseCaptureMode() for X11 debugger users. (#3650, #6410, #9235) // 2026-01-15: Changed GetClipboardText() handler to return nullptr on error aka clipboard contents is not text. Consistent with other backends. (#9168) // 2025-11-05: Fixed an issue with missing characters events when an already active text field changes viewports. (#9054) // 2025-10-22: Fixed Platform_OpenInShellFn() return value (unused in core). @@ -39,7 +40,7 @@ // 2025-03-30: Update for SDL3 api changes: Revert SDL_GetClipboardText() memory ownership change. (#8530, #7801) // 2025-03-21: Fill gamepad inputs and set ImGuiBackendFlags_HasGamepad regardless of ImGuiConfigFlags_NavEnableGamepad being set. // 2025-03-10: When dealing with OEM keys, use scancodes instead of translated keycodes to choose ImGuiKey values. (#7136, #7201, #7206, #7306, #7670, #7672, #8468) -// 2025-02-26: Only start SDL_CaptureMouse() when mouse is being dragged, to mitigate issues with e.g.Linux debuggers not claiming capture back. (#6410, #3650) +// 2025-02-26: Only start SDL_CaptureMouse() when mouse is being dragged, to mitigate issues with e.g. Linux debuggers not claiming capture back. (#6410, #3650) // 2025-02-25: [Docking] Revert to use SDL_GetDisplayBounds() for WorkPos/WorkRect if SDL_GetDisplayUsableBounds() failed. // 2025-02-24: Avoid calling SDL_GetGlobalMouseState() when mouse is in relative mode. // 2025-02-21: [Docking] Update monitors and work areas information every frame, as the later may change regardless of monitor changes. (#8415) @@ -136,8 +137,8 @@ SDL_Cursor* MouseLastCursor; int MousePendingLeaveFrame; bool MouseCanUseGlobalState; - bool MouseCanUseCapture; bool MouseCanReportHoveredViewport; // This is hard to use/unreliable on SDL so we'll set ImGuiBackendFlags_HasMouseHoveredViewport dynamically based on state. + ImGui_ImplSDL3_MouseCaptureMode MouseCaptureMode; // Gamepad handling ImVector<SDL_Gamepad*> Gamepads; @@ -580,13 +581,16 @@ // Check and store if we are on a SDL backend that supports SDL_GetGlobalMouseState() and SDL_CaptureMouse() // ("wayland" and "rpi" don't support it, but we chose to use a white-list instead of a black-list) bd->MouseCanUseGlobalState = false; - bd->MouseCanUseCapture = false; + bd->MouseCaptureMode = ImGui_ImplSDL3_MouseCaptureMode_Disabled; #if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE const char* sdl_backend = SDL_GetCurrentVideoDriver(); const char* capture_and_global_state_whitelist[] = { "windows", "cocoa", "x11", "DIVE", "VMAN" }; for (const char* item : capture_and_global_state_whitelist) if (strncmp(sdl_backend, item, strlen(item)) == 0) - bd->MouseCanUseGlobalState = bd->MouseCanUseCapture = true; + { + bd->MouseCanUseGlobalState = true; + bd->MouseCaptureMode = (strcmp(item, "x11") == 0) ? ImGui_ImplSDL3_MouseCaptureMode_EnabledAfterDrag : ImGui_ImplSDL3_MouseCaptureMode_Enabled; + } #endif if (bd->MouseCanUseGlobalState) { @@ -712,7 +716,14 @@ IM_DELETE(bd); } -// This code is incredibly messy because some of the functions we need for full viewport support are not available in SDL < 2.0.4. +void ImGui_ImplSDL3_SetMouseCaptureMode(ImGui_ImplSDL3_MouseCaptureMode mode) +{ + ImGui_ImplSDL3_Data* bd = ImGui_ImplSDL3_GetBackendData(); + if (mode == ImGui_ImplSDL3_MouseCaptureMode_Disabled && bd->MouseCaptureMode != ImGui_ImplSDL3_MouseCaptureMode_Disabled) + SDL_CaptureMouse(false); + bd->MouseCaptureMode = mode; +} + static void ImGui_ImplSDL3_UpdateMouseData() { ImGui_ImplSDL3_Data* bd = ImGui_ImplSDL3_GetBackendData(); @@ -721,8 +732,12 @@ // We forward mouse input when hovered or captured (via SDL_EVENT_MOUSE_MOTION) or when focused (below) #if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE // - SDL_CaptureMouse() let the OS know e.g. that our drags can extend outside of parent boundaries (we want updated position) and shouldn't trigger other operations outside. - // - Debuggers under Linux tends to leave captured mouse on break, which may be very inconvenient, so to mitigate the issue we wait until mouse has moved to begin capture. - if (bd->MouseCanUseCapture) + // - Debuggers under Linux tends to leave captured mouse on break, which may be very inconvenient, so to mitigate the issue on X11 we we wait until mouse has moved to begin capture. + if (bd->MouseCaptureMode == ImGui_ImplSDL3_MouseCaptureMode_Enabled) + { + SDL_CaptureMouse(bd->MouseButtonsDown != 0); + } + else if (bd->MouseCaptureMode == ImGui_ImplSDL3_MouseCaptureMode_EnabledAfterDrag) { bool want_capture = false; for (int button_n = 0; button_n < ImGuiMouseButton_COUNT && !want_capture; button_n++)
diff --git a/backends/imgui_impl_sdl3.h b/backends/imgui_impl_sdl3.h index 31f43aa..7e57913 100644 --- a/backends/imgui_impl_sdl3.h +++ b/backends/imgui_impl_sdl3.h
@@ -47,4 +47,11 @@ enum ImGui_ImplSDL3_GamepadMode { ImGui_ImplSDL3_GamepadMode_AutoFirst, ImGui_ImplSDL3_GamepadMode_AutoAll, ImGui_ImplSDL3_GamepadMode_Manual }; IMGUI_IMPL_API void ImGui_ImplSDL3_SetGamepadMode(ImGui_ImplSDL3_GamepadMode mode, SDL_Gamepad** manual_gamepads_array = nullptr, int manual_gamepads_count = -1); +// (Advanced, for X11 users) Override Mouse Capture mode. Mouse capture allows receiving updated mouse position after clicking inside our window and dragging outside it. +// Having this 'Enabled' is in theory always better. But, on X11 if you crash/break to debugger while capture is active you may temporarily lose access to your mouse. +// The best solution is to setup your debugger to automatically release capture, e.g. 'setxkbmap -option grab:break_actions && xdotool key XF86Ungrab' or via a GDB script. See #3650. +// But you may independently decide on X11, when a debugger is attached, to set this value to ImGui_ImplSDL3_MouseCaptureMode_Disabled. +enum ImGui_ImplSDL3_MouseCaptureMode { ImGui_ImplSDL3_MouseCaptureMode_Enabled, ImGui_ImplSDL3_MouseCaptureMode_EnabledAfterDrag, ImGui_ImplSDL3_MouseCaptureMode_Disabled }; +IMGUI_IMPL_API void ImGui_ImplSDL3_SetMouseCaptureMode(ImGui_ImplSDL3_MouseCaptureMode mode); + #endif // #ifndef IMGUI_DISABLE
diff --git a/backends/imgui_impl_vulkan.cpp b/backends/imgui_impl_vulkan.cpp index 8c1afaa..0e4fb48 100644 --- a/backends/imgui_impl_vulkan.cpp +++ b/backends/imgui_impl_vulkan.cpp
@@ -120,6 +120,14 @@ #pragma warning (disable: 4127) // condition expression is constant #endif +// Clang/GCC warnings with -Weverything +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast +#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness +#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision +#pragma clang diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types (for loader) +#endif + // Forward Declarations struct ImGui_ImplVulkan_FrameRenderBuffers; struct ImGui_ImplVulkan_WindowRenderBuffers;
diff --git a/backends/imgui_impl_vulkan.h b/backends/imgui_impl_vulkan.h index f4367fd..f840800 100644 --- a/backends/imgui_impl_vulkan.h +++ b/backends/imgui_impl_vulkan.h
@@ -51,6 +51,12 @@ //#define IMGUI_IMPL_VULKAN_VOLK_FILENAME <volk.h> // Default // Reminder: make those changes in your imconfig.h file, not here! +// Clang/GCC warnings with -Weverything +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast +#endif + #if defined(IMGUI_IMPL_VULKAN_NO_PROTOTYPES) && !defined(VK_NO_PROTOTYPES) #define VK_NO_PROTOTYPES #endif @@ -269,4 +275,8 @@ } }; +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + #endif // #ifndef IMGUI_DISABLE
diff --git a/backends/imgui_impl_wgpu.h b/backends/imgui_impl_wgpu.h index 68a89c9..c399668 100644 --- a/backends/imgui_impl_wgpu.h +++ b/backends/imgui_impl_wgpu.h
@@ -35,12 +35,21 @@ // Setup Emscripten default if not specified. #if defined(__EMSCRIPTEN__) && !defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN) && !defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU) #include <emscripten/version.h> + +#ifdef __EMSCRIPTEN_MAJOR__ +#if (__EMSCRIPTEN_MAJOR__ >= 4) && (__EMSCRIPTEN_MINOR__ >= 0) && (__EMSCRIPTEN_TINY__ >= 10) +#define IMGUI_IMPL_WEBGPU_BACKEND_DAWN +#else +#define IMGUI_IMPL_WEBGPU_BACKEND_WGPU +#endif +#else #if (__EMSCRIPTEN_major__ >= 4) && (__EMSCRIPTEN_minor__ >= 0) && (__EMSCRIPTEN_tiny__ >= 10) #define IMGUI_IMPL_WEBGPU_BACKEND_DAWN #else #define IMGUI_IMPL_WEBGPU_BACKEND_WGPU #endif #endif +#endif #include <webgpu/webgpu.h> #if defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU) && !defined(__EMSCRIPTEN__)
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e973075..5bbb533 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt
@@ -36,35 +36,24 @@ - Please report any issue! ----------------------------------------------------------------------- - VERSION 1.92.6 WIP (In Progress) + VERSION 1.92.6 (2026-02-17) ----------------------------------------------------------------------- +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.92.6 + Breaking Changes: -- Commented out legacy names obsoleted in 1.90 (Sept 2023): - - BeginChildFrame() --> BeginChild() with ImGuiChildFlags_FrameStyle flag. - - EndChildFrame() --> EndChild(). - - ShowStackToolWindow() --> ShowIDStackToolWindow(). - - IM_OFFSETOF() --> offsetof(). - - IM_FLOOR() --> IM_TRUNC() [internal, for positive values only] -- Hashing: handling of "###" operator to reset to seed within a string identifier - doesn't include the "###" characters in the output hash anymore: - Before: GetID("Hello###World") == GetID("###World") != GetID("World"); - Now: GetID("Hello###World") == GetID("###World") == GetID("World"); - - This has the property of facilitating concatenating and manipulating - identifiers using "###", and will allow fixing other dangling issues. - - This will invalidate hashes (stored in .ini data) for Tables and Windows - that are using the "###" operators. (#713, #1698) -- Renamed helper macro IM_ARRAYSIZE() -> IM_COUNTOF(). Kept redirection/legacy name. - Fonts: - AddFontDefault() now automatically selects an embedded font between: - - AddFontDefaultVector(): new scalable font. Recommended at any higher size. - AddFontDefaultBitmap(): classic pixel-clean font. Recommended at Size 13px with no scaling. + - AddFontDefaultVector(): new scalable font. Recommended at any higher size. - The default selection is based on (style.FontSizeBase * FontScaleMain * FontScaleDpi) - reaching a small threshold. Prefer calling either based on your own logic. - And you can call AddFontDefaultBitmap() to ensure legacy behavior. - - Fixed handling of `ImFontConfig::FontDataOwnedByAtlas = false` which - did erroneously make a copy of the font data, essentially defeating the purpose + reaching a small threshold, but old codebases may not set any of them properly. + As as a result, it is likely that old codebase may still default to AddFontDefaultBitmap(). + - Prefer explicitly calling either of them based on your own logic! + You can call AddFontDefaultBitmap() to ensure legacy behavior. + - 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 (undetected since July 2015 and now spotted by @TellowKrinkle, this is perhaps the oldest bug in Dear ImGui history, albeit for a rarely used feature!) (#9086, #8465) @@ -74,13 +63,8 @@ until a shutdown of the owning context or font atlas. - The fact that handling of `FontDataOwnedByAtlas = false` was broken bypassed the issue altogether. - - Fixed a crash when trying to use AddFont() with MergeMode=true on a font that - has already been rendered. (#9162) [@ocornut, @cyfewlp] - Removed ImFontConfig::PixelSnapV added in 1.92 which turns out is unnecessary (and misdocumented). Post-rescale GlyphOffset is always rounded. - - Fixed an issue where using PushFont() from the implicit/fallback "Debug" window when - its recorded state is collapsed would incorrectly early out. This would break e.g. using - direct draw-list calls such as GetForegroundDrawList() with current font. (#9210, #8865) - Popups: changed compile-time 'ImGuiPopupFlags popup_flags = 1' default value to be '= 0' for BeginPopupContextItem(), BeginPopupContextWindow(), BeginPopupContextVoid(), OpenPopupOnItemClick(). The default value has same meaning before and after. (#9157, #9146) @@ -91,8 +75,8 @@ - We have now changed this behavior to: cleanup a very old API quirk, facilitate use by bindings, and to remove the last and error-prone non-zero default value. Also because we deemed it extremely rare to use those helper functions with the Left mouse button! - As using the LMB would generally be triggered via another widget, e.g. a Button() + - a OpenPopup()/BeginPopup() call. + As using the LMB would generally be triggered via another widget, + e.g. a Button() + a OpenPopup()/BeginPopup() call. - Before: The default = 1 means ImGuiPopupFlags_MouseButtonRight. Explicitly passing a literal 0 means ImGuiPopupFlags_MouseButtonLeft. - After: The default = 0 means ImGuiPopupFlags_MouseButtonRight. @@ -108,6 +92,21 @@ - BeginPopupContextItem("foo", 1); // Behavior unchanged (as a courtesy we legacy interpret 1 as ImGuiPopupFlags_MouseButtonRight, will assert if disabling legacy behaviors. - BeginPopupContextItem("foo", 0); // !! Behavior changed !! Was Left button. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft. - BeginPopupContextItem("foo", ImGuiPopupFlags_NoReopen); // !! Behavior changed !! Was Left button + flags. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft | xxx. +- Commented out legacy names obsoleted in 1.90 (Sept 2023): + - BeginChildFrame() --> BeginChild() with ImGuiChildFlags_FrameStyle flag. + - EndChildFrame() --> EndChild(). + - ShowStackToolWindow() --> ShowIDStackToolWindow(). + - IM_OFFSETOF() --> offsetof(). + - IM_FLOOR() --> IM_TRUNC() [internal, for positive values only] +- Hashing: handling of "###" operator to reset to seed within a string identifier + doesn't include the "###" characters in the output hash anymore: + Before: `GetID("Hello###World") == GetID("###World") != GetID("World")` + After: `GetID("Hello###World") == GetID("###World") == GetID("World")` + - This has the property of facilitating concatenating and manipulating + identifiers using "###", and will allow fixing other dangling issues. + - This will invalidate hashes (stored in .ini data) for Tables and Windows + that are using the "###" operators. (#713, #1698) +- Renamed helper macro IM_ARRAYSIZE() -> IM_COUNTOF(). Kept redirection/legacy name. - Backends: - Vulkan: optional ImGui_ImplVulkanH_DestroyWindow() helper used by our example code does not call vkDestroySurfaceKHR(): because surface is created by caller @@ -116,7 +115,7 @@ Other Changes: - Fonts: - - Added AddFontDefaultVector(): a new embedded monospace scalable font: ProggyForever! + - Added `AddFontDefaultVector()`: a new embedded monospace scalable font: ProggyForever! From https://github.com/ocornut/proggyforever: "ProggyForever is an MIT-licensed partial reimplementation of the ProggyVector font (originally by Tristan Grimmer), which itself is a vector-based @@ -130,27 +129,33 @@ data is ~14 KB. Embedding a scalable default font ensures that Dear ImGui can be easily and readily used in all contexts, even without file system access. - As always you can opt-out of the embedded font data if desired. - - AddFontDefault() now automatically selects an embedded font between + - `AddFontDefault()` now automatically selects an embedded font between the classic pixel-looking one and the new scalable one. - Prefer calling AddFontDefaultVector() or AddFontDefaultBitmap() explicitely. - - Fixed an issue related to EllipsisChar handling, while changing + Prefer calling `AddFontDefaultVector()` or `AddFontDefaultBitmap()` explicitely. + - Fixed a crash when trying to use `AddFont()` with `MergeMode==true` on a font that + has already been rendered. (#9162) [@ocornut, @cyfewlp] + - Fixed an issue where using `PushFont()` from the implicit/fallback "Debug" window + when its recorded state is collapsed would incorrectly early out. This would break + e.g. using direct draw-list calls such as GetForegroundDrawList() with current font. + (#9210, #8865) + - Fixed an issue related to `EllipsisChar` handling, while changing font loader or font loader flags dynamically in Style->Fonts menus. - - imgui_freetype: fixed overwriting ImFontConfig::PixelSnapH when hinting + - imgui_freetype: fixed overwriting `ImFontConfig::PixelSnapH` when hinting is enabled, creating side-effects when later disabling hinting or dynamically switching to stb_truetype rasterizer. - - Post rescale GlyphOffset is always rounded. + - Post rescale `ImFontConfig::GlyphOffset` is always rounded. - Adding new fonts after removing all fonts mid-frame properly updates current state. - Textures: - - Fixed a building issue when ImTextureID is defined as a struct. + - Fixed a building issue when `ImTextureID` is defined as a struct. - Fixed displaying texture # in Metrics/Debugger window. - Menus: - - Fixed MenuItem() label position and BeginMenu() arrow/icon/popup positions, + - Fixed `MenuItem()` label position and `BeginMenu()` arrow/icon/popup positions, when used inside a line with a baseline offset. - Made navigation into menu-bar auto wrap on X axis. (#9178) - TreeNode: - Fixed highlight position when used inside a line with a large text baseline offset. (never quite worked in this situation; but then most of the time the text - baseline offset ends up being zero or FramePadding.y for a given line). + baseline offset ends up being zero or `FramePadding.y` for a given line). - Tables: - Fixed an issue where a very thin scrolling table would advance parent layout slightly differently depending on its visibility (caused by a mismatch @@ -161,66 +166,71 @@ data has missing or duplicate values. (#9108, #4046) - ColorEdit: - Added R/G/B/A color markers next to each component (enabled by default). - - Added ImGuiColorEditFlags_NoColorMarkers to disable them. - - Added style.ColorMarkerSize to configure width of color component markers. + - Added `ImGuiColorEditFlags_NoColorMarkers` to disable them. + - Added `style.ColorMarkerSize` to configure width of color component markers. - Sliders, Drags: - - Added ImGuiSliderFlags_ColorMarkers to opt-in adding R/G/B/A color markers + - Added `ImGuiSliderFlags_ColorMarkers` to opt-in adding R/G/B/A color markers next to each components, in multi-components functions. - Added a way to select a specific marker color. - InputText: - - ImGuiInputTextCallbackData: SelectAll() also sets CursorPos to SelectionEnd. - - ImGuiInputTextCallbackData: Added SetSelection() helper. - - ImGuiInputTextCallbackData: Added ID and EventActive helpers. (#9174) + - InputTextMultiline(): fixed a minor bug where Shift+Wheel would allow a small + horizontal scroll offset when there should be none. (#9249) + - ImGuiInputTextCallbackData: `SelectAll()` also sets `CursorPos` to `SelectionEnd`. + - ImGuiInputTextCallbackData: Added `SetSelection()` helper. + - ImGuiInputTextCallbackData: Added `ID` and `EventActivated` members. (#9174) - Text, InputText: - Reworked word-wrapping logic: - Try to not wrap in the middle of contiguous punctuations. (#8139, #8439, #9094) - Try to not wrap between a punctuation and a digit. (#8503) - - Inside InputTextMultiline() with _WordWrap: prefer keeping blanks at the - end of a line rather than at the beginning of next line. (#8990, #3237) - - Fixed low-level word-wrapping function reading from *text_end when passed + - Inside `InputTextMultiline()` with WordWrap enabled: prefer keeping blanks at + the end of a line rather than at the beginning of next line. (#8990, #3237) + - Fixed low-level word-wrapping function reading from `*text_end` when passed a string range. (#9107) [@achabense] - - Changed RenderTextEllipsis() logic to not trim trailing blanks before + - Changed `RenderTextEllipsis()` logic to not trim trailing blanks before the ellipsis, making ellipsis position more consistent and not arbitrary hiding the possibility of multiple blanks. (#9229) - Nav: - Fixed remote/shortcut InputText() not teleporting mouse cursor when nav cursor is visible and `io.ConfigNavMoveSetMousePos` is enabled. - - Fixed a looping/wrapping issue when done in menu layer. (#9178) + - Fixed a looping/wrapping issue when used in menu layer. (#9178) - Fixed speed scale for resizing/moving with keyboard/gamepad. We incorrectly - used io.DisplayFramebufferScale (very old code), effectively making those - actions faster on macOS/iOS retina screens. + used `io.DisplayFramebufferScale` as a scaling factor (very old code), + effectively making those actions faster on macOS/iOS retina screens. (changed this to use a style scale factor that's not fully formalized yet) - - Fixed an UBSan warning when using in a ListClipper region . (#9160) + - Fixed an UBSan warning when using in a `ImGuiListClipper` region . (#9160) - Scrollbar: fixed a codepath leading to a divide-by-zero (which would not be noticeable by user but detected by sanitizers). (#9089) [@judicaelclair] - InvisibleButton: allow calling with size (0,0) to fit to available content size. (#9166, #7623) -- Tooltips, Disabled: fixed EndDisabledOverrideReenable() assertion when +- Tooltips, Disabled: fixed `EndDisabledOverrideReenable()` assertion when nesting a tooltip in a disabled block. (#9180, #7640) [@RegimantasSimkus] -- Added GetItemFlags() in public API for consistency and to expose generic +- Added `GetItemFlags()` in public API for consistency and to expose generic flags of last submitted item. (#9127) -- Log/Capture: fixed erroneously injecting extra carriage returns in output - buffer when ItemSpacing.y > FramePadding.y + 1. +- Misc: fixed build on ARM64/ARM64EC targets trying to use SSE/immintrin.h. + (#9209, #5943, #4091) [@navvyswethgraphics] +- Log/Capture: + - Fixed erroneously injecting extra carriage returns in output text buffer + when `ItemSpacing.y` > `FramePadding.y + 1` while emitting items. - Images: - - Added style.ImageRounding, ImGuiStyleVar_ImageRounding to configure - rounding of Image() widgets. (#2942, #845) - - ImageButton() doesn't use a clamped style.FrameRounding value but instead - adjust inner image rounding when FramePadding > FrameRounding. (#2942, #845) + - Added `style.ImageRounding`, `ImGuiStyleVar_ImageRounding `to configure + rounding of `Image()` widgets. (#2942, #845) + - `ImageButton()` doesn't use a clamped `style.FrameRounding` value but instead + adjust inner image rounding when `FramePadding > `FrameRounding`. (#2942, #845) - Shortcuts: - - IsItemHovered() without ImGuiHoveredFlags_AllowWhenBlockedByActiveItem + - IsItemHovered() without `ImGuiHoveredFlags_AllowWhenBlockedByActiveItem` doesn't filter out the signal when activated item is a shortcut remote activation; - (which mimicks what's done internally in the ItemHoverable() function). (#9138) + (which mimicks what's done internally in the `ItemHoverable()` function). (#9138) - Fixed tooltip placement being affected for a frame when located over an item - activated by SetNextItemShortcut(). (#9138) + activated by `SetNextItemShortcut()`. (#9138) - Error Handling: - - Improve error handling and recovery for EndMenu()/EndCombo(). (#1651, #9165, #8499) - - Improve error handling and recovery for TableSetupColumn(). + - Improved error handling and recovery for `EndMenu()`/`EndCombo()`. (#1651, #9165, #8499) + - Improved error handling and recovery for `TableSetupColumn()`. - Debug Tools: - Debug Log: fixed incorrectly printing characters in IO log when submitting non-ASCII values to `io.AddInputCharacter()`. (#9099) - - Debug Log: can output to debugger on Windows. (#5855) + - Debug Log: can output to debugger on Windows via Win32 `OutputDebugString()` (#5855) - Demo: - - Slightly improve Selectable() demos. (#9193) + - Slightly improve `Selectable()` demos. (#9193) - Backends: - DirectX10: added `SamplerNearest` in `ImGui_ImplDX10_RenderState`. (+renamed `SamplerDefault` to `SamplerLinear`, which was tagged as beta API) @@ -228,13 +238,27 @@ (+renamed `SamplerDefault` to `SamplerLinear`, which was tagged as beta API) - GLFW: Avoid repeated `glfwSetCursor()` / `glfwSetInputMode()` unnecessary calls. Lowers overhead for very high framerates (e.g. 10k+ FPS). [@maxliani] - - GLFW: Added IMGUI_IMPL_GLFW_DISABLE_X11 / IMGUI_IMPL_GLFW_DISABLE_WAYLAND to + - GLFW: Added `IMGUI_IMPL_GLFW_DISABLE_X11` / `IMGUI_IMPL_GLFW_DISABLE_WAYLAND` to forcefully disable either. (#9109, #9116) Try to set them automatically if headers are not accessible. (#9225) - OpenGL3: Fixed embedded loader multiple init/shutdown cycles broken on some platforms. (#8792, #9112) - SDL2, SDL3: changed `GetClipboardText()` handler to return NULL on error aka clipboard contents is not text. Consistent with other backends. (#9168) + - SDL2, SDL3: systems other than X11 are back to starting mouse capture on mouse down + (reverts 1.91.9 change). Only X11 requires waiting for a drag by default (not ideal, + but a better default for X11 users). Waiting for a drag to start mouse capture leads to + input drops when dragging after clicking on the edge of a window. + (#3650, #6410, #9235, #3956, #3835) + - SDL2, SDL3: added `ImGui_ImplSDL2_SetMouseCaptureMode()`/`ImGui_ImplSDL3_SetMouseCaptureMode()` + function for X11 users to disable mouse capturing/grabbing. (#3650, #6410, #9235, #3956, #3835) + - When attached to a debugger may want to call: + - `ImGui_ImplSDL3_SetMouseCaptureMode(ImGui_ImplSDL3_MouseCaptureMode_Disabled);` + - But you can also configure your system or debugger to automatically release + mouse grab when crashing/breaking in debugger, e.g. + - console: `setxkbmap -option grab:break_actions && xdotool key XF86Ungrab` + - or use a GDB script to call SDL_CaptureMouse(false). See #3650. + - On platforms other than X11 this is unnecessary. - SDL_GPU3: added `SamplerNearest` in `ImGui_ImplSDLGPU3_RenderState`. - SDL_GPU3: macOS version can use MSL shaders in order to support macOS 10.14+ (vs Metallib shaders requiring macOS 14+). Requires application calling @@ -243,6 +267,7 @@ selects `VkSwapchainCreateInfoKHR`'s `compositeAlpha` value based on `cap.supportedCompositeAlpha`, which seems to be required on some Android devices. (#8784) [@FelixStach] + - WebGPU: fixes for Emscripten 5.0.0 (note: current examples do not build with 5.0.1). - Win32: handle `WM_IME_CHAR`/`WM_IME_COMPOSITION` to support Unicode inputs on MBCS (non-Unicode) Windows. (#9099, #3653, #5961) [@ulhc, @ocornut, @Othereum] - Win32: minor optimization not submitting gamepad input if packet number has not @@ -271,16 +296,16 @@ - Fixed an assert in background dimming code, which could trigger after using gamepad/keyboard to move a window to another viewport. (#9053) [@lut0pia, @ocornut] - Backends: - - GLFW: dynamically load X11 functions to avoid -lx11 linking requirement introduced + - GLFW: dynamically load X11 functions to avoid `-lx11` linking requirement introduced in 1.92.3. (#9116, #9109) [@ramenguy99] - GLFW: improve workarounds for cases where GLFW is unable to provide reliable monitor info. Preserve existing monitor list when none of the new one is valid. (#9195, #7902, #5683) - SDL2, SDL3: adjust IME offset to match other backends and master branch. (#6071, #1953) - Win32: viewports created by backend forcefully direct messages to - DefWindowProcW() in order to support Unicode text input. (#9099, #3653, #5961) [@ulhc] + `DefWindowProcW()` in order to support Unicode text input. (#9099, #3653, #5961) [@ulhc] - Win32: fixed an issue from 1.90.5 where newly appearing windows that are not parented to the main viewport didn't have their task bar icon appear before the window was - explicitely refocused. (#7354, #8669) + explicitly refocused. (#7354, #8669) -----------------------------------------------------------------------
diff --git a/docs/FONTS.md b/docs/FONTS.md index 1eeaefd..1e51cde 100644 --- a/docs/FONTS.md +++ b/docs/FONTS.md
@@ -11,8 +11,8 @@ We embed fonts in the code so you can use Dear ImGui without any file system access. If you don't use them you can set `IMGUI_DISABLE_DEFAULT_FONT` in your [imconfig.h](https://github.com/ocornut/imgui/blob/master/imconfig.h) file to ship binaries without the fonts and save about ~26 KB. -Calling io.Fonts->AddFontDefaultBitmap() loads ProggyClean. Calling io.Fonts->AddFontDefaultVector() loads ProggyForever. +Calling io.Fonts->AddFontDefaultBitmap() loads ProggyClean. Calling io.Fonts->AddFontDefault() selects one based on the expected default font size (when `style.FontSizeBase * style.FontScaleMain * style.FontSizeDpi >= 15` we use ProggyForever). You may also load external .TTF/.OTF files, see instructions on this page. @@ -170,7 +170,7 @@ 🆕 **Since 1.92, with an up to date backend: specifying glyph ranges is unnecessary.** ```cpp // Load a first font -ImFont* font = io.Fonts->AddFontDefault(); +ImFont* font = io.Fonts->AddFontDefaultVector(); ImFontConfig config; config.MergeMode = true; io.Fonts->AddFontFromFileTTF("DroidSans.ttf", 0.0f, &config); // Merge into first font to add e.g. Asian characters @@ -294,7 +294,7 @@ // Merge icons into default tool font #include "IconsFontAwesome.h" ImGuiIO& io = ImGui::GetIO(); -io.Fonts->AddFontDefault(); +io.Fonts->AddFontDefaultVector(); ImFontConfig config; config.MergeMode = true; config.GlyphMinAdvanceX = 13.0f; // Use if you want to make the icon monospaced @@ -451,7 +451,7 @@ #### Pseudo-code: ```cpp // Add font, then register two custom 13x13 rectangles mapped to glyph 'a' and 'b' of this font -ImFont* font = io.Fonts->AddFontDefault(); +ImFont* font = io.Fonts->AddFontDefaultVector(); int rect_ids[2]; rect_ids[0] = io.Fonts->AddCustomRectFontGlyph(font, 'a', 13, 13, 13+1); rect_ids[1] = io.Fonts->AddCustomRectFontGlyph(font, 'b', 13, 13, 13+1);
diff --git a/examples/example_glfw_wgpu/main.cpp b/examples/example_glfw_wgpu/main.cpp index fe1eeef..d41988c 100644 --- a/examples/example_glfw_wgpu/main.cpp +++ b/examples/example_glfw_wgpu/main.cpp
@@ -40,8 +40,8 @@ static int wgpu_surface_height = 800; // Forward declarations -static bool InitWGPU(GLFWwindow* window); -static WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, GLFWwindow* window); +static bool InitWGPU(GLFWwindow* window); +WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, GLFWwindow* window); static void glfw_error_callback(int error, const char* description) { @@ -409,7 +409,7 @@ #endif // __EMSCRIPTEN__ #endif // IMGUI_IMPL_WEBGPU_BACKEND_WGPU -static bool InitWGPU(GLFWwindow* window) +bool InitWGPU(GLFWwindow* window) { WGPUTextureFormat preferred_fmt = WGPUTextureFormat_Undefined; // acquired from SurfaceCapabilities
diff --git a/examples/example_sdl3_wgpu/main.cpp b/examples/example_sdl3_wgpu/main.cpp index adf4524..c02a5be 100644 --- a/examples/example_sdl3_wgpu/main.cpp +++ b/examples/example_sdl3_wgpu/main.cpp
@@ -40,8 +40,8 @@ static int wgpu_surface_height = 800; // Forward declarations -static bool InitWGPU(SDL_Window* window); -static WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, SDL_Window* window); +static bool InitWGPU(SDL_Window* window); +WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, SDL_Window* window); static void ResizeSurface(int width, int height) {
diff --git a/imgui.cpp b/imgui.cpp index 29b7f8c..5567f1d 100644 --- a/imgui.cpp +++ b/imgui.cpp
@@ -1,4 +1,4 @@ -// dear imgui, v1.92.6 WIP +// dear imgui, v1.92.6 // (main code and documentation) // Help: @@ -421,13 +421,14 @@ - BeginPopupContextItem("foo", 1); // Behavior unchanged (as a courtesy we legacy interpret 1 as ImGuiPopupFlags_MouseButtonRight, will assert if disabling legacy behaviors. - BeginPopupContextItem("foo", 0); // !! Behavior changed !! Was Left button. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft. - BeginPopupContextItem("foo", ImGuiPopupFlags_NoReopen); // !! Behavior changed !! Was Left button + flags. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft | xxx. - - 2025/12/23 (1.92.6) - Fonts:AddFontDefault() now automatically selects an embedded font between the new scalable AddFontDefaultVector() and the classic pixel-clean AddFontDefaultBitmap(). - The default selection is based on (style.FontSizeBase * FontScaleMain * FontScaleDpi) reaching a small threshold. Prefer calling either based on your own logic. You can call AddFontDefaultBitmap() to ensure legacy behavior. + - 2025/12/23 (1.92.6) - Fonts: AddFontDefault() now automatically selects an embedded font between the new scalable AddFontDefaultVector() and the classic pixel-clean AddFontDefaultBitmap(). + The default selection is based on (style.FontSizeBase * FontScaleMain * FontScaleDpi) reaching a small threshold, but old codebases may not set any of them properly. As as a result, it is likely that old codebase may still default to AddFontDefaultBitmap(). + Prefer calling either based on your own logic. You can call AddFontDefaultBitmap() to ensure legacy behavior. - 2025/12/23 (1.92.6) - Fonts: removed ImFontConfig::PixelSnapV added in 1.92 which turns out is unnecessary (and misdocumented). Post-rescale GlyphOffset is always rounded. - 2025/12/17 (1.92.6) - Renamed helper macro IM_ARRAYSIZE() -> IM_COUNTOF(). Kept redirection/legacy name for now. - 2025/12/11 (1.92.6) - Hashing: handling of "###" operator to reset to seed within a string identifier doesn't include the "###" characters in the output hash anymore. - - Before: GetID("Hello###World") == GetID("###World") != GetID("World"); - - Now: GetID("Hello###World") == GetID("###World") == GetID("World"); + - Before: GetID("Hello###World") == GetID("###World") != GetID("World") + - After: GetID("Hello###World") == GetID("###World") == GetID("World") - This has the property of facilitating concatenating and manipulating identifiers using "###", and will allow fixing other dangling issues. - This will invalidate hashes (stored in .ini data) for Tables and Windows that are using the "###" operators. (#713, #1698) - 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. @@ -1600,7 +1601,7 @@ ImGuiIO::ImGuiIO() { // Most fields are initialized with zero - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); IM_STATIC_ASSERT(IM_COUNTOF(ImGuiIO::MouseDown) == ImGuiMouseButton_COUNT && IM_COUNTOF(ImGuiIO::MouseClicked) == ImGuiMouseButton_COUNT); // Settings @@ -2041,7 +2042,7 @@ ImGuiPlatformIO::ImGuiPlatformIO() { // Most fields are initialized with zero - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); Platform_LocaleDecimalPoint = '.'; } @@ -3298,7 +3299,7 @@ ImGuiListClipper::ImGuiListClipper() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); } ImGuiListClipper::~ImGuiListClipper() @@ -4629,7 +4630,7 @@ // ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods ImGuiWindow::ImGuiWindow(ImGuiContext* ctx, const char* name) : DrawListInst(NULL) { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); Ctx = ctx; Name = ImStrdup(name); NameBufLen = (int)ImStrlen(name) + 1;
diff --git a/imgui.h b/imgui.h index a39652d..e52b124 100644 --- a/imgui.h +++ b/imgui.h
@@ -1,4 +1,4 @@ -// dear imgui, v1.92.6 WIP +// dear imgui, v1.92.6 // (headers) // Help: @@ -29,8 +29,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.6 WIP" -#define IMGUI_VERSION_NUM 19260 +#define IMGUI_VERSION "1.92.6" +#define IMGUI_VERSION_NUM 19261 #define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000 #define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198 #define IMGUI_HAS_VIEWPORT // In 'docking' WIP branch. @@ -2230,7 +2230,7 @@ int SpecsCount; // Sort spec count. Most often 1. May be > 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled. bool SpecsDirty; // Set to true when specs have changed since last time! Use this to sort again, then clear the flag. - ImGuiTableSortSpecs() { memset(this, 0, sizeof(*this)); } + ImGuiTableSortSpecs() { memset((void*)this, 0, sizeof(*this)); } }; // Sorting specification for one column of a table (sizeof == 12 bytes) @@ -2241,7 +2241,7 @@ ImS16 SortOrder; // Index within parent ImGuiTableSortSpecs (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here) ImGuiSortDirection SortDirection; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending - ImGuiTableColumnSortSpecs() { memset(this, 0, sizeof(*this)); } + ImGuiTableColumnSortSpecs() { memset((void*)this, 0, sizeof(*this)); } }; //----------------------------------------------------------------------------- @@ -3013,7 +3013,7 @@ #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS //inline void IncludeRangeByIndices(int item_begin, int item_end) { IncludeItemsByIndex(item_begin, item_end); } // [renamed in 1.89.9] //inline void ForceDisplayRangeByIndices(int item_begin, int item_end) { IncludeItemsByIndex(item_begin, item_end); } // [renamed in 1.89.6] - //inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79] + //inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset((void*)this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79] #endif }; @@ -3298,7 +3298,7 @@ int UserCallbackDataSize; // 4 // Size of callback user data when using storage, otherwise 0. int UserCallbackDataOffset;// 4 // [Internal] Offset of callback user data when using storage, otherwise -1. - ImDrawCmd() { memset(this, 0, sizeof(*this)); } // Also ensure our padding fields are zeroed + ImDrawCmd() { memset((void*)this, 0, sizeof(*this)); } // Also ensure our padding fields are zeroed // Since 1.83: returns ImTextureID associated with this draw call. Warning: DO NOT assume this is always same as 'TextureId' (we will change this function for an upcoming feature) // Since 1.92: removed ImDrawCmd::TextureId field, the getter function must be used! @@ -3344,7 +3344,7 @@ int _Count; // Number of active channels (1+) ImVector<ImDrawChannel> _Channels; // Draw channels (not resized down so _Count might be < Channels.Size) - inline ImDrawListSplitter() { memset(this, 0, sizeof(*this)); } + inline ImDrawListSplitter() { memset((void*)this, 0, sizeof(*this)); } inline ~ImDrawListSplitter() { ClearFreeMemory(); } inline void Clear() { _Current = 0; _Count = 1; } // Do not clear Channels[] so our allocations are reused next frame IMGUI_API void ClearFreeMemory(); @@ -3637,7 +3637,7 @@ bool WantDestroyNextFrame; // rw - // [Internal] Queued to set ImTextureStatus_WantDestroy next frame. May still be used in the current frame. // Functions - ImTextureData() { memset(this, 0, sizeof(*this)); Status = ImTextureStatus_Destroyed; TexID = ImTextureID_Invalid; } + ImTextureData() { memset((void*)this, 0, sizeof(*this)); Status = ImTextureStatus_Destroyed; TexID = ImTextureID_Invalid; } ~ImTextureData() { DestroyPixels(); } IMGUI_API void Create(ImTextureFormat format, int w, int h); IMGUI_API void DestroyPixels(); @@ -3714,7 +3714,7 @@ float U0, V0, U1, V1; // Texture coordinates for the current value of ImFontAtlas->TexRef. Cached equivalent of calling GetCustomRect() with PackId. int PackId; // [Internal] ImFontAtlasRectId value (FIXME: Cold data, could be moved elsewhere?) - ImFontGlyph() { memset(this, 0, sizeof(*this)); PackId = -1; } + ImFontGlyph() { memset((void*)this, 0, sizeof(*this)); PackId = -1; } }; // Helper to build glyph ranges from text/string data. Feed your application strings/characters to it then call BuildRanges(). @@ -3747,7 +3747,7 @@ unsigned short w, h; // Size ImVec2 uv0, uv1; // UV coordinates (in current texture) - ImFontAtlasRect() { memset(this, 0, sizeof(*this)); } + ImFontAtlasRect() { memset((void*)this, 0, sizeof(*this)); } }; // Flags for ImFontAtlas build @@ -4103,7 +4103,7 @@ bool PlatformRequestResize; // Platform window requested resize (e.g. window was resized by the OS / host window manager, authoritative size will be OS window size) bool PlatformRequestClose; // Platform window requested closure (e.g. window was moved by the OS / host window manager, e.g. pressing ALT-F4) - ImGuiViewport() { memset(this, 0, sizeof(*this)); } + ImGuiViewport() { memset((void*)this, 0, sizeof(*this)); } ~ImGuiViewport() { IM_ASSERT(PlatformUserData == NULL && RendererUserData == NULL); } // Helpers @@ -4292,7 +4292,7 @@ float InputLineHeight; // Line height (for IME). ImGuiID ViewportId; // ID of platform window/viewport. - ImGuiPlatformImeData() { memset(this, 0, sizeof(*this)); } + ImGuiPlatformImeData() { memset((void*)this, 0, sizeof(*this)); } }; //----------------------------------------------------------------------------- @@ -4314,6 +4314,7 @@ inline void PopButtonRepeat() { PopItemFlag(); } inline void PushTabStop(bool tab_stop) { PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); } inline void PopTabStop() { PopItemFlag(); } + // You do not need those functions! See #7838 on GitHub for more info. IMGUI_API ImVec2 GetContentRegionMax(); // Content boundaries max (e.g. window boundaries including scrolling, or current column boundaries). You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()! IMGUI_API ImVec2 GetWindowContentRegionMin(); // Content boundaries min for the window (roughly (0,0)-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()! IMGUI_API ImVec2 GetWindowContentRegionMax(); // Content boundaries max for the window (roughly (0,0)+Size-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 7cbcf7f..d74a8db 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp
@@ -1,4 +1,4 @@ -// dear imgui, v1.92.6 WIP +// dear imgui, v1.92.6 // (demo code) // Help: @@ -142,7 +142,7 @@ #include <inttypes.h> // PRId64/PRIu64, not avail in some MinGW headers. #endif #ifdef __EMSCRIPTEN__ -#include <emscripten/version.h> // __EMSCRIPTEN_major__ etc. +#include <emscripten/version.h> // __EMSCRIPTEN_MAJOR__ etc. #endif // Visual Studio warnings @@ -8325,8 +8325,12 @@ #endif #ifdef __EMSCRIPTEN__ ImGui::Text("define: __EMSCRIPTEN__"); +#ifdef __EMSCRIPTEN_MAJOR__ + ImGui::Text("Emscripten: %d.%d.%d", __EMSCRIPTEN_MAJOR__, __EMSCRIPTEN_MINOR__, __EMSCRIPTEN_TINY__); +#else ImGui::Text("Emscripten: %d.%d.%d", __EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__); #endif +#endif #ifdef IMGUI_HAS_VIEWPORT ImGui::Text("define: IMGUI_HAS_VIEWPORT"); #endif
diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 935535c..9c0af09 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp
@@ -1,4 +1,4 @@ -// dear imgui, v1.92.6 WIP +// dear imgui, v1.92.6 // (drawing and font code) /* @@ -398,7 +398,7 @@ ImDrawListSharedData::ImDrawListSharedData() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); InitialFringeScale = 1.0f; for (int i = 0; i < IM_COUNTOF(ArcFastVtx); i++) { @@ -430,7 +430,7 @@ ImDrawList::ImDrawList(ImDrawListSharedData* shared_data) { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); _SetDrawListSharedData(shared_data); } @@ -2423,7 +2423,7 @@ // FIXME-NEWATLAS: Oversample specification could be more dynamic. For now, favoring automatic selection. ImFontConfig::ImFontConfig() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); FontDataOwnedByAtlas = true; OversampleH = 0; // Auto == 1 or 2 depending on size OversampleV = 0; // Auto == 1 @@ -2647,7 +2647,7 @@ ImFontAtlas::ImFontAtlas() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); TexDesiredFormat = ImTextureFormat_RGBA32; TexGlyphPadding = 1; TexMinWidth = 512; @@ -5140,7 +5140,7 @@ ImFontBaked::ImFontBaked() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); FallbackGlyphIndex = -1; } @@ -5157,7 +5157,7 @@ ImFont::ImFont() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS Scale = 1.0f; #endif
diff --git a/imgui_internal.h b/imgui_internal.h index b1904de..2a71e0f 100644 --- a/imgui_internal.h +++ b/imgui_internal.h
@@ -1,4 +1,4 @@ -// dear imgui, v1.92.6 WIP +// dear imgui, v1.92.6 // (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. @@ -60,7 +60,7 @@ #include <limits.h> // INT_MIN, INT_MAX // Enable SSE intrinsics if available -#if (defined __SSE__ || defined __x86_64__ || defined _M_X64 || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))) && !defined(IMGUI_DISABLE_SSE) +#if (defined __SSE__ || defined __x86_64__ || defined _M_X64 || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))) && !defined(IMGUI_DISABLE_SSE) && !defined(_M_ARM64) && !defined(_M_ARM64EC) #define IMGUI_ENABLE_SSE #include <immintrin.h> #if (defined __AVX__ || defined __SSE4_2__) @@ -719,7 +719,7 @@ int Offsets[CHUNKS]; int Sizes[CHUNKS]; - ImSpanAllocator() { memset(this, 0, sizeof(*this)); } + ImSpanAllocator() { memset((void*)this, 0, sizeof(*this)); } inline void Reserve(int n, size_t sz, int a=4) { IM_ASSERT(n == CurrIdx && n < CHUNKS); CurrOff = IM_MEMALIGN(CurrOff, a); Offsets[n] = CurrOff; Sizes[n] = (int)sz; CurrIdx++; CurrOff += (int)sz; } inline int GetArenaSizeInBytes() { return CurrOff; } inline void SetArenaBasePtr(void* base_ptr) { BasePtr = (char*)base_ptr; } @@ -900,7 +900,7 @@ ImVector<ImDrawList*>* Layers[2]; // Pointers to global layers for: regular, tooltip. LayersP[0] is owned by DrawData. ImVector<ImDrawList*> LayerData1; - ImDrawDataBuilder() { memset(this, 0, sizeof(*this)); } + ImDrawDataBuilder() { memset((void*)this, 0, sizeof(*this)); } }; struct ImFontStackData @@ -1175,7 +1175,7 @@ float BackupPrevLineTextBaseOffset; ImGuiLayoutType BackupLayout; - ImGuiComboPreviewData() { memset(this, 0, sizeof(*this)); } + ImGuiComboPreviewData() { memset((void*)this, 0, sizeof(*this)); } }; // Stacked storage data for BeginGroup()/EndGroup() @@ -1209,7 +1209,7 @@ ImU16 OffsetMark; ImU16 Widths[4]; // Width of: Icon, Label, Shortcut, Mark (accumulators for current frame) - ImGuiMenuColumns() { memset(this, 0, sizeof(*this)); } + ImGuiMenuColumns() { memset((void*)this, 0, sizeof(*this)); } void Update(float spacing, bool window_reappearing); float DeclColumns(float w_icon, float w_label, float w_shortcut, float w_mark); void CalcNextTotalWidth(bool update_offsets); @@ -1221,7 +1221,7 @@ ImGuiID ID; // widget id owning the text state (which just got deactivated) ImVector<char> TextA; // text buffer - ImGuiInputTextDeactivatedState() { memset(this, 0, sizeof(*this)); } + ImGuiInputTextDeactivatedState() { memset((void*)this, 0, sizeof(*this)); } void ClearFreeMemory() { ID = 0; TextA.clear(); } }; @@ -1355,7 +1355,7 @@ ImVec2 MenuBarOffsetMinVal; // (Always on) This is not exposed publicly, so we don't clear it and it doesn't have a corresponding flag (could we? for consistency?) ImGuiWindowRefreshFlags RefreshFlagsVal; - ImGuiNextWindowData() { memset(this, 0, sizeof(*this)); } + ImGuiNextWindowData() { memset((void*)this, 0, sizeof(*this)); } inline void ClearFlags() { HasFlags = ImGuiNextWindowDataFlags_None; } }; @@ -1387,7 +1387,7 @@ ImGuiID StorageId; // Set by SetNextItemStorageID() ImU32 ColorMarker; // Set by SetNextItemColorMarker(). Not exposed yet, supported by DragScalar,SliderScalar and for ImGuiSliderFlags_ColorMarkers. - ImGuiNextItemData() { memset(this, 0, sizeof(*this)); SelectionUserData = -1; } + ImGuiNextItemData() { memset((void*)this, 0, sizeof(*this)); SelectionUserData = -1; } inline void ClearFlags() { HasFlags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()! }; @@ -1404,7 +1404,7 @@ ImRect ClipRect; // Clip rectangle at the time of submitting item. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasClipRect) is set.. ImGuiKeyChord Shortcut; // Shortcut at the time of submitting item. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasShortcut) is set.. - ImGuiLastItemData() { memset(this, 0, sizeof(*this)); } + ImGuiLastItemData() { memset((void*)this, 0, sizeof(*this)); } }; // Store data emitted by TreeNode() for usage by TreePop() @@ -1437,7 +1437,7 @@ short SizeOfBeginPopupStack; short SizeOfDisabledStack; - ImGuiErrorRecoveryState() { memset(this, 0, sizeof(*this)); } + ImGuiErrorRecoveryState() { memset((void*)this, 0, sizeof(*this)); } }; // Data saved for each window pushed into the stack @@ -1498,7 +1498,7 @@ ImVec2 OpenPopupPos; // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse) ImVec2 OpenMousePos; // Set on OpenPopup(), copy of mouse position at the time of opening popup - ImGuiPopupData() { memset(this, 0, sizeof(*this)); ParentNavLayer = OpenFrameCount = -1; } + ImGuiPopupData() { memset((void*)this, 0, sizeof(*this)); ParentNavLayer = OpenFrameCount = -1; } }; //----------------------------------------------------------------------------- @@ -1579,7 +1579,7 @@ }; bool AddedByTestEngine; - ImGuiInputEvent() { memset(this, 0, sizeof(*this)); } + ImGuiInputEvent() { memset((void*)this, 0, sizeof(*this)); } }; // Input function taking an 'ImGuiID owner_id' argument defaults to (ImGuiKeyOwner_Any == 0) aka don't test ownership, which matches legacy behavior. @@ -1694,7 +1694,7 @@ int ItemsFrozen; ImVector<ImGuiListClipperRange> Ranges; - ImGuiListClipperData() { memset(this, 0, sizeof(*this)); } + ImGuiListClipperData() { memset((void*)this, 0, sizeof(*this)); } void Reset(ImGuiListClipper* clipper) { ListClipper = clipper; StepNo = ItemsFrozen = 0; Ranges.resize(0); } }; @@ -1829,7 +1829,7 @@ float LastRequestTime = 0.0f; bool SingleCharModeLock = false; // After a certain single char repeat count we lock into SingleCharMode. Two benefits: 1) buffer never fill, 2) we can provide an immediate SingleChar mode without timer elapsing. - ImGuiTypingSelectState() { memset(this, 0, sizeof(*this)); } + ImGuiTypingSelectState() { memset((void*)this, 0, sizeof(*this)); } void Clear() { SearchBuffer[0] = 0; SingleCharModeLock = false; } // We preserve remaining data for easier debugging }; @@ -1865,7 +1865,7 @@ ImGuiOldColumnFlags Flags; // Not exposed ImRect ClipRect; - ImGuiOldColumnData() { memset(this, 0, sizeof(*this)); } + ImGuiOldColumnData() { memset((void*)this, 0, sizeof(*this)); } }; struct ImGuiOldColumns @@ -1886,7 +1886,7 @@ ImVector<ImGuiOldColumnData> Columns; ImDrawListSplitter Splitter; - ImGuiOldColumns() { memset(this, 0, sizeof(*this)); } + ImGuiOldColumns() { memset((void*)this, 0, sizeof(*this)); } }; //----------------------------------------------------------------------------- @@ -1914,7 +1914,7 @@ ImRect BoxSelectRectPrev; // Selection rectangle in absolute coordinates (derived every frame from BoxSelectStartPosRel and MousePos) ImRect BoxSelectRectCurr; - ImGuiBoxSelectState() { memset(this, 0, sizeof(*this)); } + ImGuiBoxSelectState() { memset((void*)this, 0, sizeof(*this)); } }; //----------------------------------------------------------------------------- @@ -2193,7 +2193,7 @@ bool WantApply; // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context) bool WantDelete; // Set to invalidate/delete the settings entry - ImGuiWindowSettings() { memset(this, 0, sizeof(*this)); DockOrder = -1; } + ImGuiWindowSettings() { memset((void*)this, 0, sizeof(*this)); DockOrder = -1; } char* GetName() { return (char*)(this + 1); } }; @@ -2209,7 +2209,7 @@ void (*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf); // Write: Output every entries into 'out_buf' void* UserData; - ImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); } + ImGuiSettingsHandler() { memset((void*)this, 0, sizeof(*this)); } }; //----------------------------------------------------------------------------- @@ -2301,7 +2301,7 @@ ImS16 LastEntriesIdx; // Current index in buffer ImGuiDebugAllocEntry LastEntriesBuf[6]; // Track last 6 frames that had allocations - ImGuiDebugAllocInfo() { memset(this, 0, sizeof(*this)); } + ImGuiDebugAllocInfo() { memset((void*)this, 0, sizeof(*this)); } }; struct ImGuiMetricsConfig @@ -2331,7 +2331,7 @@ ImS8 DataType; // ImGuiDataType int DescOffset; // -1 or offset into parent's ResultsPathsBuf - ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); DataType = -1; DescOffset = -1; } + ImGuiStackLevelInfo() { memset((void*)this, 0, sizeof(*this)); DataType = -1; DescOffset = -1; } }; struct ImGuiDebugItemPathQuery @@ -2344,7 +2344,7 @@ ImGuiTextBuffer ResultsDescBuf; ImGuiTextBuffer ResultPathBuf; - ImGuiDebugItemPathQuery() { memset(this, 0, sizeof(*this)); } + ImGuiDebugItemPathQuery() { memset((void*)this, 0, sizeof(*this)); } }; // State for ID Stack tool queries @@ -2355,7 +2355,7 @@ int LastActiveFrame; float CopyToClipboardLastTime; - ImGuiIDStackTool() { memset(this, 0, sizeof(*this)); LastActiveFrame = -1; OptHexEncodeNonAsciiChars = true; CopyToClipboardLastTime = -FLT_MAX; } + ImGuiIDStackTool() { memset((void*)this, 0, sizeof(*this)); LastActiveFrame = -1; OptHexEncodeNonAsciiChars = true; CopyToClipboardLastTime = -FLT_MAX; } }; //----------------------------------------------------------------------------- @@ -2373,7 +2373,7 @@ ImGuiContextHookCallback Callback; void* UserData; - ImGuiContextHook() { memset(this, 0, sizeof(*this)); } + ImGuiContextHook() { memset((void*)this, 0, sizeof(*this)); } }; //----------------------------------------------------------------------------- @@ -3040,7 +3040,7 @@ ImS16 IndexDuringLayout; // Index only used during TabBarLayout(). Tabs gets reordered so 'Tabs[n].IndexDuringLayout == n' but may mismatch during additions. bool WantClose; // Marked as closed by SetTabItemClosed() - ImGuiTabItem() { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; } + ImGuiTabItem() { memset((void*)this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; } }; // Storage for a tab bar (sizeof() 160 bytes) @@ -3145,7 +3145,7 @@ ImGuiTableColumn() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); StretchWeight = WidthRequest = -1.0f; NameOffset = -1; DisplayOrder = IndexWithinEnabledSet = -1; @@ -3306,7 +3306,7 @@ bool MemoryCompacted; bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis - ImGuiTable() { memset(this, 0, sizeof(*this)); LastFrameActive = -1; } + ImGuiTable() { memset((void*)this, 0, sizeof(*this)); LastFrameActive = -1; } ~ImGuiTable() { IM_FREE(RawData); } }; @@ -3335,7 +3335,7 @@ float HostBackupItemWidth; // Backup of OuterWindow->DC.ItemWidth at the end of BeginTable() int HostBackupItemWidthStackSize;//Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable() - ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; } + ImGuiTableTempData() { memset((void*)this, 0, sizeof(*this)); LastTimeActive = -1.0f; } }; // sizeof() ~ 16 @@ -3372,7 +3372,7 @@ ImGuiTableColumnIdx ColumnsCountMax; // Maximum number of columns this settings instance can store, we can recycle a settings instance with lower number of columns but not higher bool WantApply; // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context) - ImGuiTableSettings() { memset(this, 0, sizeof(*this)); } + ImGuiTableSettings() { memset((void*)this, 0, sizeof(*this)); } ImGuiTableColumnSettings* GetColumnSettings() { return (ImGuiTableColumnSettings*)(this + 1); } }; @@ -4086,7 +4086,7 @@ // FIXME: At this point the two other types of buffers may be managed by core to be consistent? size_t FontBakedSrcLoaderDataSize; - ImFontLoader() { memset(this, 0, sizeof(*this)); } + ImFontLoader() { memset((void*)this, 0, sizeof(*this)); } }; #ifdef IMGUI_ENABLE_STB_TRUETYPE @@ -4183,7 +4183,7 @@ ImFontAtlasRectId PackIdMouseCursors; // White pixel + mouse cursors. Also happen to be fallback in case of packing failure. ImFontAtlasRectId PackIdLinesTexData; - ImFontAtlasBuilder() { memset(this, 0, sizeof(*this)); FrameCount = -1; RectsIndexFreeListStart = -1; PackIdMouseCursors = PackIdLinesTexData = -1; } + ImFontAtlasBuilder() { memset((void*)this, 0, sizeof(*this)); FrameCount = -1; RectsIndexFreeListStart = -1; PackIdMouseCursors = PackIdLinesTexData = -1; } }; IMGUI_API void ImFontAtlasBuildInit(ImFontAtlas* atlas);
diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 6eaa973..8df3258 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp
@@ -1,4 +1,4 @@ -// dear imgui, v1.92.6 WIP +// dear imgui, v1.92.6 // (tables and columns code) /*
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index baf5a73..75c4dc9 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp
@@ -1,4 +1,4 @@ -// dear imgui, v1.92.6 WIP +// dear imgui, v1.92.6 // (widgets code) /* @@ -4258,7 +4258,7 @@ // We added an extra indirection where 'Stb' is heap-allocated, in order facilitate the work of bindings generators. ImGuiInputTextState::ImGuiInputTextState() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); Stb = IM_NEW(ImStbTexteditState); memset(Stb, 0, sizeof(*Stb)); } @@ -4308,7 +4308,7 @@ ImGuiInputTextCallbackData::ImGuiInputTextCallbackData() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); } // Public API to manipulate UTF-8 text from within a callback. @@ -5407,7 +5407,6 @@ } ImVec2 draw_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding; - ImVec2 text_size(0.0f, 0.0f); ImRect clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + inner_size.x, frame_bb.Min.y + inner_size.y); // Not using frame_bb.Max because we have adjusted size if (is_multiline) clip_rect.ClipWith(draw_window->ClipRect); @@ -5465,7 +5464,7 @@ line_visible_n1 = ImMin(line_visible_n1, line_count); // Store text height (we don't need width) - text_size = ImVec2(inner_size.x, line_count * g.FontSize); + float text_size_y = line_count * g.FontSize; //GetForegroundDrawList()->AddRect(draw_pos + ImVec2(0, line_visible_n0 * g.FontSize), draw_pos + ImVec2(frame_size.x, line_visible_n1 * g.FontSize), IM_COL32(255, 0, 0, 255)); // Calculate blinking cursor position @@ -5525,7 +5524,7 @@ } if (new_scroll_y != scroll_y) { - const float scroll_max_y = ImMax((text_size.y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f); + const float scroll_max_y = ImMax((text_size_y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f); scroll_y = ImClamp(new_scroll_y, 0.0f, scroll_max_y); draw_pos.y += (draw_window->Scroll.y - scroll_y); // Manipulate cursor pos immediately avoid a frame of lag draw_window->Scroll.y = scroll_y; @@ -5618,7 +5617,7 @@ if (is_multiline) { // For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (see #4761, #7870)... - Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y)); + Dummy(ImVec2(0.0f, text_size_y + style.FramePadding.y)); g.NextItemData.ItemFlags |= (ImGuiItemFlags)ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop; EndChild(); item_data_backup.StatusFlags |= (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredWindow); @@ -9562,7 +9561,7 @@ float WidthAfterShrinkMinWidth; float Spacing; // Horizontal spacing at the end of the section. - ImGuiTabBarSection() { memset(this, 0, sizeof(*this)); } + ImGuiTabBarSection() { memset((void*)this, 0, sizeof(*this)); } }; namespace ImGui @@ -9578,7 +9577,7 @@ ImGuiTabBar::ImGuiTabBar() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); CurrFrameVisible = PrevFrameVisible = -1; LastTabItemIdx = -1; }