2
0
Эх сурвалжийг харах

Docking: Disable SkipItems when directly/programmatically focused (possible generalization of code currently in BeginDocked which relies on tab bar interaction, will remove that code in next commit). (#2453, #2109)

omar 6 жил өмнө
parent
commit
b6ae8a0dca
3 өөрчлөгдсөн 12 нэмэгдсэн , 2 устгасан
  1. 3 1
      docs/TODO.txt
  2. 8 1
      imgui.cpp
  3. 1 0
      imgui_internal.h

+ 3 - 1
docs/TODO.txt

@@ -130,7 +130,9 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
  - splitter/separator: formalize the splitter idiom into an official api (we want to handle n-way split) (#319)
  - splitter/separator: formalize the splitter idiom into an official api (we want to handle n-way split) (#319)
 
 
  - dock: merge docking branch (#2109)
  - dock: merge docking branch (#2109)
- - dock: A~ Unreal style document system (requires low-level controls of dockspace serialization fork/copy/delete). this is mostly working but the DockBuilderXXX api are not exposed/finished.
+ - dock: B~ rework code to be able to lazily create tab bar instance in a single place. The _Unsorted tab flag could be replacing a trailing-counter in DockNode?
+ - dock: B~ fully track windows/settings reference in dock nodes. perhaps find a representation that allows facilitate use of dock builder functions.
+ - dock: B~ Unreal style document system (requires low-level controls of dockspace serialization fork/copy/delete). this is mostly working but the DockBuilderXXX api are not exposed/finished.
  - dock: B: when docking outer, perform size locking on neighbors nodes the same way we do it with splitters, so other nodes are not resized.
  - dock: B: when docking outer, perform size locking on neighbors nodes the same way we do it with splitters, so other nodes are not resized.
  - dock: B~ central node resizing behavior incorrect.
  - dock: B~ central node resizing behavior incorrect.
  - dock: B: changing title font/style per-window is not supported as dock nodes are created in NewFrame.
  - dock: B: changing title font/style per-window is not supported as dock nodes are created in NewFrame.

+ 8 - 1
imgui.cpp

@@ -2587,6 +2587,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
     SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX);
     SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX);
 
 
     LastFrameActive = -1;
     LastFrameActive = -1;
+    LastFrameJustFocused = -1;
     ItemWidthDefault = 0.0f;
     ItemWidthDefault = 0.0f;
     FontWindowScale = FontDpiScale = 1.0f;
     FontWindowScale = FontDpiScale = 1.0f;
     SettingsIdx = -1;
     SettingsIdx = -1;
@@ -6070,7 +6071,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
     g.NextWindowData.Clear();
     g.NextWindowData.Clear();
 
 
     if (window->DockIsActive && !window->DockTabIsVisible)
     if (window->DockIsActive && !window->DockTabIsVisible)
-        window->HiddenFramesCanSkipItems = 1;
+    {
+        if (window->LastFrameJustFocused == g.FrameCount) // This may be a better a generalization for the code in BeginDocked() setting the same field.
+            window->HiddenFramesCannotSkipItems = 1;
+        else
+            window->HiddenFramesCanSkipItems = 1;
+    }
 
 
     if (flags & ImGuiWindowFlags_ChildWindow)
     if (flags & ImGuiWindowFlags_ChildWindow)
     {
     {
@@ -6219,6 +6225,7 @@ void ImGui::FocusWindow(ImGuiWindow* window)
     // Passing NULL allow to disable keyboard focus
     // Passing NULL allow to disable keyboard focus
     if (!window)
     if (!window)
         return;
         return;
+    window->LastFrameJustFocused = g.FrameCount;
 
 
     // Select in dock node
     // Select in dock node
     if (window->DockNode && window->DockNode->TabBar)
     if (window->DockNode && window->DockNode->TabBar)

+ 1 - 0
imgui_internal.h

@@ -1405,6 +1405,7 @@ struct IMGUI_API ImGuiWindow
     ImVec2ih                HitTestHoleSize, HitTestHoleOffset;
     ImVec2ih                HitTestHoleSize, HitTestHoleOffset;
     ImRect                  ContentsRegionRect;                 // FIXME: This is currently confusing/misleading. Maximum visible content position ~~ Pos + (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis
     ImRect                  ContentsRegionRect;                 // FIXME: This is currently confusing/misleading. Maximum visible content position ~~ Pos + (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis
     int                     LastFrameActive;                    // Last frame number the window was Active.
     int                     LastFrameActive;                    // Last frame number the window was Active.
+    int                     LastFrameJustFocused;               // Last frame number the window was made Focused.
     float                   ItemWidthDefault;
     float                   ItemWidthDefault;
     ImGuiMenuColumns        MenuColumns;                        // Simplified columns storage for menu items
     ImGuiMenuColumns        MenuColumns;                        // Simplified columns storage for menu items
     ImGuiStorage            StateStorage;
     ImGuiStorage            StateStorage;