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

Fixed tooltip in own viewport over modal from being incorrectly dimmed. (#4729)

Normally we would aim to ensure that g.Windows[] gets maintained to reflect display layer but it is presently non trivial.
ocornut 3 жил өмнө
parent
commit
b50b22d787
2 өөрчлөгдсөн 16 нэмэгдсэн , 13 устгасан
  1. 3 10
      docs/CHANGELOG.txt
  2. 13 3
      imgui.cpp

+ 3 - 10
docs/CHANGELOG.txt

@@ -99,16 +99,6 @@ Other changes:
   Note that Linux/Mac still have inconsistent support for multi-viewports. If you want to help see https://github.com/ocornut/imgui/issues/2117.
 
 
------------------------------------------------------------------------
- VERSION 1.86 WIP (In Progress)
------------------------------------------------------------------------
-
-Docking+Viewports Branch:
-
-- Docking: Revert removal of io.ConfigDockingWithShift config option (removed in 1.83). (#4643)
-- Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (#4656)
-
-
 -----------------------------------------------------------------------
  VERSION 1.86 WIP (In Progress)
 -----------------------------------------------------------------------
@@ -154,9 +144,12 @@ Other Changes:
 
 Docking+Viewports Branch:
 
+- Docking: Revert removal of io.ConfigDockingWithShift config option (removed in 1.83). (#4643)
 - Viewports: Made it possible to explicitly assign ImGuiWindowClass::ParentViewportId to 0 in order
   to ensure a window is not parented. Previously this would use the global default (which might be 0,
   but not always as it would depend on io.ConfigViewportsNoDefaultParent). (#3152, #2871)
+- Viewports: Fixed tooltip in own viewport over modal from being incorrectly dimmed. (#4729)
+- Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (#4656)
 - Disabled: Fixed nested BeginDisabled()/EndDisabled() bug in Docking branch due to bad merge. (#4655, #4452, #4453, #4462)
 
 

+ 13 - 3
imgui.cpp

@@ -4534,11 +4534,15 @@ static void AddWindowToDrawData(ImGuiWindow* window, int layer)
     }
 }
 
+static inline int GetWindowDisplayLayer(ImGuiWindow* window)
+{
+    return (window->Flags & ImGuiWindowFlags_Tooltip) ? 1 : 0;
+}
+
 // Layer is locked for the root window, however child windows may use a different viewport (e.g. extruding menu)
-static void AddRootWindowToDrawData(ImGuiWindow* window)
+static inline void AddRootWindowToDrawData(ImGuiWindow* window)
 {
-    int layer = (window->Flags & ImGuiWindowFlags_Tooltip) ? 1 : 0;
-    AddWindowToDrawData(window, layer);
+    AddWindowToDrawData(window, GetWindowDisplayLayer(window));
 }
 
 void ImDrawDataBuilder::FlattenIntoSingleLayer()
@@ -7303,6 +7307,12 @@ bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent,
 bool ImGui::IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below)
 {
     ImGuiContext& g = *GImGui;
+
+    // It would be saner to ensure that display layer is always reflected in the g.Windows[] order, which would likely requires altering all manipulations of that array
+    const int display_layer_delta = GetWindowDisplayLayer(potential_above) - GetWindowDisplayLayer(potential_below);
+    if (display_layer_delta != 0)
+        return display_layer_delta > 0;
+
     for (int i = g.Windows.Size - 1; i >= 0; i--)
     {
         ImGuiWindow* candidate_window = g.Windows[i];