From 33fabdf392d0a34b52a4db3eaf467847604d5167 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 17 Jan 2024 15:45:20 +0100 Subject: [PATCH] Scrollbar() doesn't forcefully mark itself as hovered when held. Weirdly as old as when dinosaurs roamed earth, aka first commit (per-1.0). + Minor alignment in both sense of the term :) Reduce padding in ImGuiNextItemData. --- docs/CHANGELOG.txt | 2 +- imgui_internal.h | 10 +++++----- imgui_widgets.cpp | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index df56d4f26..418fdc908 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -49,7 +49,7 @@ Other changes: - Nav: keyboard/gamepad activation mark widgets as held to give better visual feedback. - Nav: tweak to logic marking navigated item as hovered when using keyboard, allowing the hover highlight to stay even while another item is activated. -- Fixed SetKeyboardFocusHere() not working when current nav focus is in different scope, +- Nav: Fixed SetKeyboardFocusHere() not working when current nav focus is in different scope, regression from 1.90.1 related to code scoping Tab presses to local scope. (#7226) [@bratpilz] - Debug Tools: Metrics: Fixed debug break in SetShortcutRouting() not handling ImGuiMod_Shortcut redirect. - Debug Tools: Debug Log: Added "Input Routing" logging. diff --git a/imgui_internal.h b/imgui_internal.h index c96e2a564..1b4855374 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1192,9 +1192,9 @@ typedef ImS64 ImGuiSelectionUserData; enum ImGuiNextItemDataFlags_ { - ImGuiNextItemDataFlags_None = 0, - ImGuiNextItemDataFlags_HasWidth = 1 << 0, - ImGuiNextItemDataFlags_HasOpen = 1 << 1, + ImGuiNextItemDataFlags_None = 0, + ImGuiNextItemDataFlags_HasWidth = 1 << 0, + ImGuiNextItemDataFlags_HasOpen = 1 << 1, }; struct ImGuiNextItemData @@ -1202,10 +1202,10 @@ struct ImGuiNextItemData ImGuiNextItemDataFlags Flags; ImGuiItemFlags ItemFlags; // Currently only tested/used for ImGuiItemFlags_AllowOverlap. // Non-flags members are NOT cleared by ItemAdd() meaning they are still valid during NavProcessItem() - float Width; // Set by SetNextItemWidth() ImGuiSelectionUserData SelectionUserData; // Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values) - ImGuiCond OpenCond; + float Width; // Set by SetNextItemWidth() bool OpenVal; // Set by SetNextItemOpen() + ImGuiCond OpenCond : 8; ImGuiNextItemData() { memset(this, 0, sizeof(*this)); SelectionUserData = -1; } inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()! diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index bc71aa628..3c6937a92 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -968,7 +968,6 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6 // Click position in scrollbar normalized space (0.0f->1.0f) const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v); - SetHoveredID(id); bool seek_absolute = false; if (g.ActiveIdIsJustActivated)