1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Windows: Fixed an issue where repeated calls to SetNextWindowSize() using 0.0f to auto-size would keep marking ini settings as dirty.

+ marking dirty on old io.FontAllowUserScaling Ctrl+Wheel
This commit is contained in:
ocornut 2025-11-11 19:40:24 +01:00
parent 7537ba2b44
commit fc262355ca
2 changed files with 16 additions and 11 deletions

View file

@ -68,11 +68,14 @@ Other Changes:
- Tables: Angled headers: fixed an auto-resize feedback loop that could - Tables: Angled headers: fixed an auto-resize feedback loop that could
affect tables with empty non-resizing columns using angled headers, making affect tables with empty non-resizing columns using angled headers, making
them typically flicker back and forth between +0 and +1 pixels. them typically flicker back and forth between +0 and +1 pixels.
- Windows: io.ConfigWindowsMoveFromTitleBarOnly is latched during Begin(), - Windows:
effectively allowing to change the value on a per-window basis (although - Config flag io.ConfigWindowsMoveFromTitleBarOnly is now latched during
there is a better internal mechanism for it). Begin(), effectively allowing to change the value on a per-window basis.
- Windows: fixed single-axis auto-sizing (via double-clicking a border) to (although there is a better internal mechanism for it).
take account of remaining scrollbar on the other axis. (#9060) - Fixed single-axis auto-sizing (via double-clicking a border) to
take account of remaining scrollbar on the other axis. (#9060)
- Fixed an issue where repeated calls to SetNextWindowSize() using 0.0f
to auto-size on a given axis would keep marking ini settings as dirty.
- Disabled: fixed a bug when a previously enabled item that got nav focus - Disabled: fixed a bug when a previously enabled item that got nav focus
and then turns disabled could still be activated using keyboard. (#9036) and then turns disabled could still be activated using keyboard. (#9036)
- InputText: when buffer is not resizable, trying to paste contents that - InputText: when buffer is not resizable, trying to paste contents that

View file

@ -6968,8 +6968,8 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, int* border_hove
} }
// Apply back modified position/size to window // Apply back modified position/size to window
const ImVec2 curr_pos = window->Pos; const ImVec2 old_pos = window->Pos;
const ImVec2 curr_size = window->SizeFull; const ImVec2 old_size = window->SizeFull;
if (size_target.x != FLT_MAX && (window->Size.x != size_target.x || window->SizeFull.x != size_target.x)) if (size_target.x != FLT_MAX && (window->Size.x != size_target.x || window->SizeFull.x != size_target.x))
window->Size.x = window->SizeFull.x = size_target.x; window->Size.x = window->SizeFull.x = size_target.x;
if (size_target.y != FLT_MAX && (window->Size.y != size_target.y || window->SizeFull.y != size_target.y)) if (size_target.y != FLT_MAX && (window->Size.y != size_target.y || window->SizeFull.y != size_target.y))
@ -6978,7 +6978,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, int* border_hove
window->Pos.x = ImTrunc(pos_target.x); window->Pos.x = ImTrunc(pos_target.x);
if (pos_target.y != FLT_MAX && window->Pos.y != ImTrunc(pos_target.y)) if (pos_target.y != FLT_MAX && window->Pos.y != ImTrunc(pos_target.y))
window->Pos.y = ImTrunc(pos_target.y); window->Pos.y = ImTrunc(pos_target.y);
if (curr_pos.x != window->Pos.x || curr_pos.y != window->Pos.y || curr_size.x != window->SizeFull.x || curr_size.y != window->SizeFull.y) if (old_pos.x != window->Pos.x || old_pos.y != window->Pos.y || old_size.x != window->SizeFull.x || old_size.y != window->SizeFull.y)
MarkIniSettingsDirty(window); MarkIniSettingsDirty(window);
// Recalculate next expected border expected coordinates // Recalculate next expected border expected coordinates
@ -7579,6 +7579,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Calculate auto-fit size, handle automatic resize // Calculate auto-fit size, handle automatic resize
const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal, ~0); const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal, ~0);
const ImVec2 old_size = window->SizeFull;
if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed) if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed)
{ {
// Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc. // Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.
@ -7607,9 +7608,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->SizeFull.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y; window->SizeFull.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y;
use_current_size_for_scrollbar_y = true; use_current_size_for_scrollbar_y = true;
} }
if (!window->Collapsed)
MarkIniSettingsDirty(window);
} }
if (old_size.x != window->SizeFull.x || old_size.y != window->SizeFull.y)
MarkIniSettingsDirty(window);
// Apply minimum/maximum window size constraints and final size // Apply minimum/maximum window size constraints and final size
window->SizeFull = CalcWindowSizeAfterConstraint(window, window->SizeFull); window->SizeFull = CalcWindowSizeAfterConstraint(window, window->SizeFull);
@ -10220,8 +10221,9 @@ void ImGui::UpdateMouseWheel()
{ {
const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size; const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size;
SetWindowPos(window, window->Pos + offset, 0); SetWindowPos(window, window->Pos + offset, 0);
window->Size = ImTrunc(window->Size * scale); window->Size = ImTrunc(window->Size * scale); // FIXME: Legacy-ish code, call SetWindowSize()?
window->SizeFull = ImTrunc(window->SizeFull * scale); window->SizeFull = ImTrunc(window->SizeFull * scale);
MarkIniSettingsDirty(window);
} }
return; return;
} }