瀏覽代碼

Merge branch 'master' into docking

ocornut 6 月之前
父節點
當前提交
11b3a7c8ca
共有 10 個文件被更改,包括 47 次插入23 次删除
  1. 9 5
      docs/CHANGELOG.txt
  2. 0 1
      examples/example_sdl3_opengl3/main.cpp
  3. 4 0
      examples/example_sdl3_sdlrenderer3/main.cpp
  4. 6 1
      imgui.cpp
  5. 3 3
      imgui.h
  6. 1 1
      imgui_demo.cpp
  7. 1 1
      imgui_draw.cpp
  8. 1 1
      imgui_internal.h
  9. 1 1
      imgui_tables.cpp
  10. 21 9
      imgui_widgets.cpp

+ 9 - 5
docs/CHANGELOG.txt

@@ -36,12 +36,15 @@ HOW TO UPDATE?
 - Please report any issue!
 - Please report any issue!
 
 
 -----------------------------------------------------------------------
 -----------------------------------------------------------------------
- VERSION 1.91.8 WIP (In Progress)
+ VERSION 1.91.8 (Released 2025-01-31)
 -----------------------------------------------------------------------
 -----------------------------------------------------------------------
 
 
+Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.91.8
+
 Breaking changes:
 Breaking changes:
 
 
-- ColorEdit, ColorPicker: redesigned how alpha is displayed in the preview square. (#8335, #1578, #346)
+- ColorEdit, ColorPicker: redesigned how alpha is displayed in the preview
+  square. (#8335, #1578, #346)
    - Removed ImGuiColorEditFlags_AlphaPreview (made value 0): it is now the default behavior.
    - Removed ImGuiColorEditFlags_AlphaPreview (made value 0): it is now the default behavior.
    - Prior to 1.91.8: alpha was made opaque in the preview by default _unless_ using ImGuiColorEditFlags_AlphaPreview.
    - Prior to 1.91.8: alpha was made opaque in the preview by default _unless_ using ImGuiColorEditFlags_AlphaPreview.
    - We now display the preview as transparent by default. You can use ImGuiColorEditFlags_AlphaOpaque to use old behavior.
    - We now display the preview as transparent by default. You can use ImGuiColorEditFlags_AlphaOpaque to use old behavior.
@@ -63,7 +66,7 @@ Other changes:
   by introducing a delay. This is a very rarely used UI idiom, but some apps
   by introducing a delay. This is a very rarely used UI idiom, but some apps
   use this: e.g. MS Explorer single-click on an icon triggers a rename.
   use this: e.g. MS Explorer single-click on an icon triggers a rename.
   Generally use with 'delay >= io.MouseDoubleClickTime' + combine with a
   Generally use with 'delay >= io.MouseDoubleClickTime' + combine with a
-  'io.MouseClickedLastCount == 1' check.
+  'GetMouseClickedCount() == 1' check.
 - Windows: legacy SetWindowFontScale() is properly inherited by nested child
 - Windows: legacy SetWindowFontScale() is properly inherited by nested child
   windows. Note that an upcoming major release should make this obsolete,
   windows. Note that an upcoming major release should make this obsolete,
   but in the meanwhile it works better now. (#2701, #8138, #1018)
   but in the meanwhile it works better now. (#2701, #8138, #1018)
@@ -71,14 +74,16 @@ Other changes:
   scrollbar when using thick border sizes. (#8267, #7887)
   scrollbar when using thick border sizes. (#8267, #7887)
 - Windows: Fixed IsItemXXXX() functions not working on append-version of EndChild(). (#8350)
 - Windows: Fixed IsItemXXXX() functions not working on append-version of EndChild(). (#8350)
   Also made some of the fields accessible after BeginChild() to match Begin() logic.
   Also made some of the fields accessible after BeginChild() to match Begin() logic.
+- Error Handling: Recovery from missing EndMenuBar() call. (#1651)
 - Tables, Menus: Fixed using BeginTable() in menu layer (any menu bar). (#8355)
 - Tables, Menus: Fixed using BeginTable() in menu layer (any menu bar). (#8355)
   It previously overrode the current layer back to main layer, which caused an issue
   It previously overrode the current layer back to main layer, which caused an issue
   with MainMenuBar attempted to release focus when leaving the menu layer.
   with MainMenuBar attempted to release focus when leaving the menu layer.
+- Tables, Menus: Fixed tables or child windows submitted inside BeginMainMenuBar()
+  being unable to save their settings, as the main menu bar uses _NoSavedSettings. (#8356)
 - ColorEdit, ColorPicker: Fixed alpha preview broken in 1.91.7. (#8336, #8241). [@PathogenDavid]
 - ColorEdit, ColorPicker: Fixed alpha preview broken in 1.91.7. (#8336, #8241). [@PathogenDavid]
 - Tabs, Style: reworked selected overline rendering to better accommodate
 - Tabs, Style: reworked selected overline rendering to better accommodate
   for rounded tabs. Reduced default thickness (style.TabBarOverlineSize),
   for rounded tabs. Reduced default thickness (style.TabBarOverlineSize),
   increased default rounding (style.TabRounding). (#8334) [@Kian738, @ocornut]
   increased default rounding (style.TabRounding). (#8334) [@Kian738, @ocornut]
-  styles as the current look is not right (but ImGuiCol_TabSelectedOverline stays the same).
 - Debug Tools: Tweaked font preview.
 - Debug Tools: Tweaked font preview.
 - ImDrawList: texture baked storage for thick line reduced from ~64x64 to ~32x32. (#3245)
 - ImDrawList: texture baked storage for thick line reduced from ~64x64 to ~32x32. (#3245)
 - Fonts: IndexLookup[] table hold 16-bit values even in ImWchar32 mode,
 - Fonts: IndexLookup[] table hold 16-bit values even in ImWchar32 mode,
@@ -87,7 +92,6 @@ Other changes:
 - Fonts: OversampleH/OversampleV defaults to 0 for automatic selection.
 - Fonts: OversampleH/OversampleV defaults to 0 for automatic selection.
    - OversampleH == 0 --> use 1 or 2 depending on font size and use of PixelSnapH.
    - OversampleH == 0 --> use 1 or 2 depending on font size and use of PixelSnapH.
    - OversampleV == 0 --> always use 1.
    - OversampleV == 0 --> always use 1.
-  This also
 - ImFontAtlas: made calling ClearFonts() call ClearInputData(), as calling
 - ImFontAtlas: made calling ClearFonts() call ClearInputData(), as calling
   one without the other is never correct. (#8174, #6556, #6336, #4723)
   one without the other is never correct. (#8174, #6556, #6336, #4723)
 - Examples: DirectX12: Reduced number of frame in flight from 3 to 2 in
 - Examples: DirectX12: Reduced number of frame in flight from 3 to 2 in

+ 0 - 1
examples/example_sdl3_opengl3/main.cpp

@@ -18,7 +18,6 @@
 #include <SDL3/SDL_opengl.h>
 #include <SDL3/SDL_opengl.h>
 #endif
 #endif
 
 
-// This example doesn't compile with Emscripten yet! Awaiting SDL3 support.
 #ifdef __EMSCRIPTEN__
 #ifdef __EMSCRIPTEN__
 #include "../libs/emscripten/emscripten_mainloop_stub.h"
 #include "../libs/emscripten/emscripten_mainloop_stub.h"
 #endif
 #endif

+ 4 - 0
examples/example_sdl3_sdlrenderer3/main.cpp

@@ -21,6 +21,10 @@
 #include <SDL3/SDL_opengl.h>
 #include <SDL3/SDL_opengl.h>
 #endif
 #endif
 
 
+#ifdef __EMSCRIPTEN__
+#include "../libs/emscripten/emscripten_mainloop_stub.h"
+#endif
+
 // Main code
 // Main code
 int main(int, char**)
 int main(int, char**)
 {
 {

+ 6 - 1
imgui.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.91.8 WIP
+// dear imgui, v1.91.8
 // (main code and documentation)
 // (main code and documentation)
 
 
 // Help:
 // Help:
@@ -10973,6 +10973,11 @@ void    ImGui::ErrorRecoveryTryToRecoverWindowState(const ImGuiErrorRecoveryStat
         IM_ASSERT_USER_ERROR(0, "Missing EndMultiSelect()");
         IM_ASSERT_USER_ERROR(0, "Missing EndMultiSelect()");
         EndMultiSelect();
         EndMultiSelect();
     }
     }
+    if (window->DC.MenuBarAppending) //-V1044
+    {
+        IM_ASSERT_USER_ERROR(0, "Missing EndMenuBar()");
+        EndMenuBar();
+    }
     while (window->DC.TreeDepth > state_in->SizeOfTreeStack) //-V1044
     while (window->DC.TreeDepth > state_in->SizeOfTreeStack) //-V1044
     {
     {
         IM_ASSERT_USER_ERROR(0, "Missing TreePop()");
         IM_ASSERT_USER_ERROR(0, "Missing TreePop()");

+ 3 - 3
imgui.h

@@ -1,4 +1,4 @@
-// dear imgui, v1.91.8 WIP
+// dear imgui, v1.91.8
 // (headers)
 // (headers)
 
 
 // Help:
 // Help:
@@ -28,8 +28,8 @@
 
 
 // Library Version
 // Library Version
 // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
 // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
-#define IMGUI_VERSION       "1.91.8 WIP"
-#define IMGUI_VERSION_NUM   19174
+#define IMGUI_VERSION       "1.91.8"
+#define IMGUI_VERSION_NUM   19180
 #define IMGUI_HAS_TABLE
 #define IMGUI_HAS_TABLE
 #define IMGUI_HAS_VIEWPORT          // Viewport WIP branch
 #define IMGUI_HAS_VIEWPORT          // Viewport WIP branch
 #define IMGUI_HAS_DOCK              // Docking WIP branch
 #define IMGUI_HAS_DOCK              // Docking WIP branch

+ 1 - 1
imgui_demo.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.91.8 WIP
+// dear imgui, v1.91.8
 // (demo code)
 // (demo code)
 
 
 // Help:
 // Help:

+ 1 - 1
imgui_draw.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.91.8 WIP
+// dear imgui, v1.91.8
 // (drawing and font code)
 // (drawing and font code)
 
 
 /*
 /*

+ 1 - 1
imgui_internal.h

@@ -1,4 +1,4 @@
-// dear imgui, v1.91.8 WIP
+// dear imgui, v1.91.8
 // (internal structures/api)
 // (internal structures/api)
 
 
 // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
 // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.

+ 1 - 1
imgui_tables.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.91.8 WIP
+// dear imgui, v1.91.8
 // (tables and columns code)
 // (tables and columns code)
 
 
 /*
 /*

+ 21 - 9
imgui_widgets.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.91.8 WIP
+// dear imgui, v1.91.8
 // (widgets code)
 // (widgets code)
 
 
 /*
 /*
@@ -8665,6 +8665,10 @@ void ImGui::EndMenuBar()
         return;
         return;
     ImGuiContext& g = *GImGui;
     ImGuiContext& g = *GImGui;
 
 
+    IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'"
+    IM_ASSERT(window->Flags & ImGuiWindowFlags_MenuBar);
+    IM_ASSERT(window->DC.MenuBarAppending);
+
     // Nav: When a move request within one of our child menu failed, capture the request to navigate among our siblings.
     // Nav: When a move request within one of our child menu failed, capture the request to navigate among our siblings.
     if (NavMoveRequestButNoResultYet() && (g.NavMoveDir == ImGuiDir_Left || g.NavMoveDir == ImGuiDir_Right) && (g.NavWindow->Flags & ImGuiWindowFlags_ChildMenu))
     if (NavMoveRequestButNoResultYet() && (g.NavMoveDir == ImGuiDir_Left || g.NavMoveDir == ImGuiDir_Right) && (g.NavWindow->Flags & ImGuiWindowFlags_ChildMenu))
     {
     {
@@ -8691,9 +8695,6 @@ void ImGui::EndMenuBar()
         }
         }
     }
     }
 
 
-    IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'"
-    IM_ASSERT(window->Flags & ImGuiWindowFlags_MenuBar);
-    IM_ASSERT(window->DC.MenuBarAppending);
     PopClipRect();
     PopClipRect();
     PopID();
     PopID();
     window->DC.MenuBarOffset.x = window->DC.CursorPos.x - window->Pos.x; // Save horizontal position so next append can reuse it. This is kinda equivalent to a per-layer CursorPos.
     window->DC.MenuBarOffset.x = window->DC.CursorPos.x - window->Pos.x; // Save horizontal position so next append can reuse it. This is kinda equivalent to a per-layer CursorPos.
@@ -8766,21 +8767,32 @@ bool ImGui::BeginMainMenuBar()
     float height = GetFrameHeight();
     float height = GetFrameHeight();
     bool is_open = BeginViewportSideBar("##MainMenuBar", viewport, ImGuiDir_Up, height, window_flags);
     bool is_open = BeginViewportSideBar("##MainMenuBar", viewport, ImGuiDir_Up, height, window_flags);
     g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
     g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
-
-    if (is_open)
-        BeginMenuBar();
-    else
+    if (!is_open)
+    {
         End();
         End();
+        return false;
+    }
+
+    // Temporarily disable _NoSavedSettings, in the off-chance that tables or child windows submitted within the menu-bar may want to use settings. (#8356)
+    g.CurrentWindow->Flags &= ~ImGuiWindowFlags_NoSavedSettings;
+    BeginMenuBar();
     return is_open;
     return is_open;
 }
 }
 
 
 void ImGui::EndMainMenuBar()
 void ImGui::EndMainMenuBar()
 {
 {
+    ImGuiContext& g = *GImGui;
+    if (!g.CurrentWindow->DC.MenuBarAppending)
+    {
+        IM_ASSERT_USER_ERROR(0, "Calling EndMainMenuBar() not from a menu-bar!"); // Not technically testing that it is the main menu bar
+        return;
+    }
+
     EndMenuBar();
     EndMenuBar();
+    g.CurrentWindow->Flags |= ImGuiWindowFlags_NoSavedSettings; // Restore _NoSavedSettings (#8356)
 
 
     // When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
     // When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
     // FIXME: With this strategy we won't be able to restore a NULL focus.
     // FIXME: With this strategy we won't be able to restore a NULL focus.
-    ImGuiContext& g = *GImGui;
     if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest && g.ActiveId == 0)
     if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest && g.ActiveId == 0)
         FocusTopMostWindowUnderOne(g.NavWindow, NULL, NULL, ImGuiFocusRequestFlags_UnlessBelowModal | ImGuiFocusRequestFlags_RestoreFocusedChild);
         FocusTopMostWindowUnderOne(g.NavWindow, NULL, NULL, ImGuiFocusRequestFlags_UnlessBelowModal | ImGuiFocusRequestFlags_RestoreFocusedChild);