소스 검색

Docking, Nav: Fixed using gamepad/keyboard navigation not being able enter menu layer (#5463, #4792)

Fix 37958ca
ocornut 3 년 전
부모
커밋
77637fd936
2개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 0
      docs/CHANGELOG.txt
  2. 4 3
      imgui.cpp

+ 2 - 0
docs/CHANGELOG.txt

@@ -133,6 +133,8 @@ Other Changes:
 
 
 Docking+Viewports Branch:
 Docking+Viewports Branch:
 
 
+- Docking, Nav: Fixed using gamepad/keyboard navigation not being able enter menu layer when
+  it only contained the standard Collapse/Close buttons and no actual menu. (#5463, #4792)
 - Backends: GLFW: Fixed leftover static variable preventing from changing or
 - Backends: GLFW: Fixed leftover static variable preventing from changing or
   reinitializing backend while application is running. (#4616, #5434) [@rtoumazet]
   reinitializing backend while application is running. (#4616, #5434) [@rtoumazet]
 
 

+ 4 - 3
imgui.cpp

@@ -7061,6 +7061,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 
 
         window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
         window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
         window->DC.NavLayersActiveMask = window->DC.NavLayersActiveMaskNext;
         window->DC.NavLayersActiveMask = window->DC.NavLayersActiveMaskNext;
+        window->DC.NavLayersActiveMaskNext = 0x00;
         window->DC.NavHideHighlightOneFrame = false;
         window->DC.NavHideHighlightOneFrame = false;
         window->DC.NavHasScroll = (window->ScrollMax.y > 0.0f);
         window->DC.NavHasScroll = (window->ScrollMax.y > 0.0f);
 
 
@@ -7221,9 +7222,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
                 skip_items = true;
                 skip_items = true;
         window->SkipItems = skip_items;
         window->SkipItems = skip_items;
 
 
-        // Only clear NavLayersActiveMaskNext when marked as visible, so a CTRL+Tab back can use a safe value.
-        if (!window->SkipItems)
-            window->DC.NavLayersActiveMaskNext = 0x00;
+        // Restore NavLayersActiveMaskNext to previous value when not visible, so a CTRL+Tab back can use a safe value.
+        if (window->SkipItems)
+            window->DC.NavLayersActiveMaskNext = window->DC.NavLayersActiveMask;
 
 
         // Sanity check: there are two spots which can set Appearing = true
         // Sanity check: there are two spots which can set Appearing = true
         // - when 'window_just_activated_by_user' is set -> HiddenFramesCannotSkipItems is set -> SkipItems always false
         // - when 'window_just_activated_by_user' is set -> HiddenFramesCannotSkipItems is set -> SkipItems always false