Browse Source

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.
ocornut 1 year ago
parent
commit
33fabdf392
3 changed files with 6 additions and 7 deletions
  1. 1 1
      docs/CHANGELOG.txt
  2. 5 5
      imgui_internal.h
  3. 0 1
      imgui_widgets.cpp

+ 1 - 1
docs/CHANGELOG.txt

@@ -49,7 +49,7 @@ Other changes:
 - Nav: keyboard/gamepad activation mark widgets as held to give better visual feedback.
 - 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
 - Nav: tweak to logic marking navigated item as hovered when using keyboard, allowing
   the hover highlight to stay even while another item is activated.
   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]
   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: Metrics: Fixed debug break in SetShortcutRouting() not handling ImGuiMod_Shortcut redirect.
 - Debug Tools: Debug Log: Added "Input Routing" logging.
 - Debug Tools: Debug Log: Added "Input Routing" logging.

+ 5 - 5
imgui_internal.h

@@ -1192,9 +1192,9 @@ typedef ImS64 ImGuiSelectionUserData;
 
 
 enum ImGuiNextItemDataFlags_
 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
 struct ImGuiNextItemData
@@ -1202,10 +1202,10 @@ struct ImGuiNextItemData
     ImGuiNextItemDataFlags      Flags;
     ImGuiNextItemDataFlags      Flags;
     ImGuiItemFlags              ItemFlags;          // Currently only tested/used for ImGuiItemFlags_AllowOverlap.
     ImGuiItemFlags              ItemFlags;          // Currently only tested/used for ImGuiItemFlags_AllowOverlap.
     // Non-flags members are NOT cleared by ItemAdd() meaning they are still valid during NavProcessItem()
     // 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)
     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()
     bool                        OpenVal;            // Set by SetNextItemOpen()
+    ImGuiCond                   OpenCond : 8;
 
 
     ImGuiNextItemData()         { memset(this, 0, sizeof(*this)); SelectionUserData = -1; }
     ImGuiNextItemData()         { memset(this, 0, sizeof(*this)); SelectionUserData = -1; }
     inline void ClearFlags()    { Flags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()!
     inline void ClearFlags()    { Flags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()!

+ 0 - 1
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)
         // 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);
         const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
-        SetHoveredID(id);
 
 
         bool seek_absolute = false;
         bool seek_absolute = false;
         if (g.ActiveIdIsJustActivated)
         if (g.ActiveIdIsJustActivated)