diff --git a/imgui.cpp b/imgui.cpp index cedc4e71442c..d820d3e5de97 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4939,7 +4939,7 @@ static void AddWindowToDrawData(ImGuiWindow* window, int layer) static inline int GetWindowDisplayLayer(ImGuiWindow* window) { - return (window->Flags & ImGuiWindowFlags_Tooltip) ? 1 : 0; + 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) @@ -5868,7 +5868,9 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont const float decoration_h_without_scrollbars = window->DecoOuterSizeY1 + window->DecoOuterSizeY2 - window->ScrollbarSizes.y; ImVec2 size_pad = window->WindowPadding * 2.0f; ImVec2 size_desired = size_contents + size_pad + ImVec2(decoration_w_without_scrollbars, decoration_h_without_scrollbars); - if (window->Flags & ImGuiWindowFlags_Tooltip) + + //Microstrain custom! + if ((window->Flags & ImGuiWindowFlags_Tooltip) || (window->Flags & ImGuiWindowFlags_Always_New_Window)) { // Tooltip always resize return size_desired; @@ -6867,8 +6869,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->Pos = FindBestWindowPosForPopup(window); // Late create viewport if we don't fit within our current host viewport. + //Microstrain custom! if (window->ViewportAllowPlatformMonitorExtend >= 0 && !window->ViewportOwned && !(window->Viewport->Flags & ImGuiViewportFlags_IsMinimized)) - if (!window->Viewport->GetMainRect().Contains(window->Rect())) + if (!window->Viewport->GetMainRect().Contains(window->Rect()) || (flags & ImGuiWindowFlags_Always_New_Window)) { // This is based on the assumption that the DPI will be known ahead (same as the DPI of the selection done in UpdateSelectWindowViewport) //ImGuiViewport* old_viewport = window->Viewport; @@ -10694,7 +10697,8 @@ bool ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags ext SetWindowHiddendAndSkipItemsForCurrentFrame(window); ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount); } - ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDocking; + //Microstrain custom! + ImGuiWindowFlags flags = ImGuiWindowFlags_Always_New_Window | ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDocking; Begin(window_name, NULL, flags | extra_window_flags); // 2023-03-09: Added bool return value to the API, but currently always returning true. // If this ever returns false we need to update BeginDragDropSource() accordingly. @@ -14466,8 +14470,10 @@ void ImGui::WindowSyncOwnedViewport(ImGuiWindow* window, ImGuiWindow* parent_win ImGuiViewportFlags viewport_flags = window->Viewport->Flags & ~viewport_flags_to_clear; ImGuiWindowFlags window_flags = window->Flags; const bool is_modal = (window_flags & ImGuiWindowFlags_Modal) != 0; - const bool is_short_lived_floating_window = (window_flags & (ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) != 0; - if (window_flags & ImGuiWindowFlags_Tooltip) + + //Microstrain custom! + const bool is_short_lived_floating_window = (window_flags & (ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup | ImGuiWindowFlags_Always_New_Window)) != 0; + if ((window_flags & ImGuiWindowFlags_Tooltip) || (window_flags & ImGuiWindowFlags_Always_New_Window)) viewport_flags |= ImGuiViewportFlags_TopMost; if ((g.IO.ConfigViewportsNoTaskBarIcon || is_short_lived_floating_window) && !is_modal) viewport_flags |= ImGuiViewportFlags_NoTaskBarIcon; diff --git a/imgui.h b/imgui.h index 66171013d96f..75b6a425a138 100644 --- a/imgui.h +++ b/imgui.h @@ -1031,6 +1031,9 @@ enum ImGuiWindowFlags_ ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal() ImGuiWindowFlags_ChildMenu = 1 << 28, // Don't use! For internal use by BeginMenu() ImGuiWindowFlags_DockNodeHost = 1 << 29, // Don't use! For internal use by Begin()/NewFrame() + + // [Microstrain Custom!] + ImGuiWindowFlags_Always_New_Window = 1 << 30, // Microstrain Custom!!! }; // Flags for ImGui::InputText()