|
@@ -364,6 +364,7 @@ CODE
|
|
|
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
|
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
|
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
|
|
|
|
|
|
|
|
+ - 2019/02/01 (1.68) - removed io.DisplayVisibleMin/DisplayVisibleMax (which were marked obsolete and removed from viewport/docking branch already).
|
|
|
- 2019/01/06 (1.67) - renamed io.InputCharacters[], marked internal as was always intended. Please don't access directly, and use AddInputCharacter() instead!
|
|
- 2019/01/06 (1.67) - renamed io.InputCharacters[], marked internal as was always intended. Please don't access directly, and use AddInputCharacter() instead!
|
|
|
- 2019/01/06 (1.67) - renamed ImFontAtlas::GlyphRangesBuilder to ImFontGlyphRangesBuilder. Keep redirection typedef (will obsolete).
|
|
- 2019/01/06 (1.67) - renamed ImFontAtlas::GlyphRangesBuilder to ImFontGlyphRangesBuilder. Keep redirection typedef (will obsolete).
|
|
|
- 2018/12/20 (1.67) - made it illegal to call Begin("") with an empty string. This somehow half-worked before but had various undesirable side-effects.
|
|
- 2018/12/20 (1.67) - made it illegal to call Begin("") with an empty string. This somehow half-worked before but had various undesirable side-effects.
|
|
@@ -937,8 +938,8 @@ CODE
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
// Debug options
|
|
// Debug options
|
|
|
-#define IMGUI_DEBUG_NAV_SCORING 0
|
|
|
|
|
-#define IMGUI_DEBUG_NAV_RECTS 0
|
|
|
|
|
|
|
+#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL
|
|
|
|
|
+#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
|
|
|
|
|
|
|
|
// Visual Studio warnings
|
|
// Visual Studio warnings
|
|
|
#ifdef _MSC_VER
|
|
#ifdef _MSC_VER
|
|
@@ -1000,7 +1001,6 @@ static void CheckStacksSize(ImGuiWindow* window, bool write);
|
|
|
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges);
|
|
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges);
|
|
|
|
|
|
|
|
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);
|
|
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);
|
|
|
-static void AddWindowToDrawData(ImVector<ImDrawList*>* out_list, ImGuiWindow* window);
|
|
|
|
|
static void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window);
|
|
static void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window);
|
|
|
|
|
|
|
|
static ImRect GetViewportRect();
|
|
static ImRect GetViewportRect();
|
|
@@ -1035,7 +1035,7 @@ static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
|
|
|
static void UpdateMouseInputs();
|
|
static void UpdateMouseInputs();
|
|
|
static void UpdateMouseWheel();
|
|
static void UpdateMouseWheel();
|
|
|
static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);
|
|
static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);
|
|
|
-static void RenderOuterBorders(ImGuiWindow* window, int border_held);
|
|
|
|
|
|
|
+static void RenderOuterBorders(ImGuiWindow* window);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1170,9 +1170,9 @@ ImGuiIO::ImGuiIO()
|
|
|
FontDefault = NULL;
|
|
FontDefault = NULL;
|
|
|
FontAllowUserScaling = false;
|
|
FontAllowUserScaling = false;
|
|
|
DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
|
DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
|
|
- DisplayVisibleMin = DisplayVisibleMax = ImVec2(0.0f, 0.0f);
|
|
|
|
|
|
|
|
|
|
- // Miscellaneous configuration options
|
|
|
|
|
|
|
+ // Miscellaneous options
|
|
|
|
|
+ MouseDrawCursor = false;
|
|
|
#ifdef __APPLE__
|
|
#ifdef __APPLE__
|
|
|
ConfigMacOSXBehaviors = true; // Set Mac OS X style defaults based on __APPLE__ compile time flag
|
|
ConfigMacOSXBehaviors = true; // Set Mac OS X style defaults based on __APPLE__ compile time flag
|
|
|
#else
|
|
#else
|
|
@@ -2524,6 +2524,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
|
|
|
Appearing = false;
|
|
Appearing = false;
|
|
|
Hidden = false;
|
|
Hidden = false;
|
|
|
HasCloseButton = false;
|
|
HasCloseButton = false;
|
|
|
|
|
+ ResizeBorderHeld = -1;
|
|
|
BeginCount = 0;
|
|
BeginCount = 0;
|
|
|
BeginOrderWithinParent = -1;
|
|
BeginOrderWithinParent = -1;
|
|
|
BeginOrderWithinContext = -1;
|
|
BeginOrderWithinContext = -1;
|
|
@@ -2637,6 +2638,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
|
|
if (g.ActiveIdIsJustActivated)
|
|
if (g.ActiveIdIsJustActivated)
|
|
|
{
|
|
{
|
|
|
g.ActiveIdTimer = 0.0f;
|
|
g.ActiveIdTimer = 0.0f;
|
|
|
|
|
+ g.ActiveIdHasBeenPressed = false;
|
|
|
g.ActiveIdHasBeenEdited = false;
|
|
g.ActiveIdHasBeenEdited = false;
|
|
|
if (id != 0)
|
|
if (id != 0)
|
|
|
{
|
|
{
|
|
@@ -2852,7 +2854,8 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
|
|
if ((window->DC.ItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
|
|
if ((window->DC.ItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
- // Special handling for the 1st item after Begin() which represent the title bar. When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect tht case.
|
|
|
|
|
|
|
+ // Special handling for the dummy item after Begin() which represent the title bar or tab.
|
|
|
|
|
+ // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case.
|
|
|
if (window->DC.LastItemId == window->MoveId && window->WriteAccessed)
|
|
if (window->DC.LastItemId == window->MoveId && window->WriteAccessed)
|
|
|
return false;
|
|
return false;
|
|
|
return true;
|
|
return true;
|
|
@@ -3086,13 +3089,17 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window)
|
|
|
{
|
|
{
|
|
|
// Set ActiveId even if the _NoMove flag is set. Without it, dragging away from a window with _NoMove would activate hover on other windows.
|
|
// Set ActiveId even if the _NoMove flag is set. Without it, dragging away from a window with _NoMove would activate hover on other windows.
|
|
|
// We _also_ call this when clicking in a window empty space when io.ConfigWindowsMoveFromTitleBarOnly is set, but clear g.MovingWindow afterward.
|
|
// We _also_ call this when clicking in a window empty space when io.ConfigWindowsMoveFromTitleBarOnly is set, but clear g.MovingWindow afterward.
|
|
|
- // This is because we want ActiveId to be set even when the window is stuck from moving.
|
|
|
|
|
|
|
+ // This is because we want ActiveId to be set even when the window is not permitted to move.
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
FocusWindow(window);
|
|
FocusWindow(window);
|
|
|
SetActiveID(window->MoveId, window);
|
|
SetActiveID(window->MoveId, window);
|
|
|
g.NavDisableHighlight = true;
|
|
g.NavDisableHighlight = true;
|
|
|
g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos;
|
|
g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos;
|
|
|
- if (!(window->Flags & ImGuiWindowFlags_NoMove) && !(window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
|
|
|
|
|
|
+
|
|
|
|
|
+ bool can_move_window = true;
|
|
|
|
|
+ if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
|
|
|
|
+ can_move_window = false;
|
|
|
|
|
+ if (can_move_window)
|
|
|
g.MovingWindow = window;
|
|
g.MovingWindow = window;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3160,7 +3167,8 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
|
|
}
|
|
}
|
|
|
else if (g.NavWindow != NULL && GetFrontMostPopupModal() == NULL)
|
|
else if (g.NavWindow != NULL && GetFrontMostPopupModal() == NULL)
|
|
|
{
|
|
{
|
|
|
- FocusWindow(NULL); // Clicking on void disable focus
|
|
|
|
|
|
|
+ // Clicking on void disable focus
|
|
|
|
|
+ FocusWindow(NULL);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3408,7 +3416,7 @@ void ImGui::NewFrame()
|
|
|
g.TooltipOverrideCount = 0;
|
|
g.TooltipOverrideCount = 0;
|
|
|
g.WindowsActiveCount = 0;
|
|
g.WindowsActiveCount = 0;
|
|
|
|
|
|
|
|
- // Setup current font and draw list
|
|
|
|
|
|
|
+ // Setup current font and draw list shared data
|
|
|
g.IO.Fonts->Locked = true;
|
|
g.IO.Fonts->Locked = true;
|
|
|
SetCurrentFont(GetDefaultFont());
|
|
SetCurrentFont(GetDefaultFont());
|
|
|
IM_ASSERT(g.Font->IsLoaded());
|
|
IM_ASSERT(g.Font->IsLoaded());
|
|
@@ -3420,7 +3428,7 @@ void ImGui::NewFrame()
|
|
|
g.OverlayDrawList.PushClipRectFullScreen();
|
|
g.OverlayDrawList.PushClipRectFullScreen();
|
|
|
g.OverlayDrawList.Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);
|
|
g.OverlayDrawList.Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);
|
|
|
|
|
|
|
|
- // Mark rendering data as invalid to prevent user who may have a handle on it to use it
|
|
|
|
|
|
|
+ // Mark rendering data as invalid to prevent user who may have a handle on it to use it.
|
|
|
g.DrawData.Clear();
|
|
g.DrawData.Clear();
|
|
|
|
|
|
|
|
// Drag and drop keep the source ID alive so even if the source disappear our state is consistent
|
|
// Drag and drop keep the source ID alive so even if the source disappear our state is consistent
|
|
@@ -3547,7 +3555,7 @@ void ImGui::Initialize(ImGuiContext* context)
|
|
|
ini_handler.ReadOpenFn = SettingsHandlerWindow_ReadOpen;
|
|
ini_handler.ReadOpenFn = SettingsHandlerWindow_ReadOpen;
|
|
|
ini_handler.ReadLineFn = SettingsHandlerWindow_ReadLine;
|
|
ini_handler.ReadLineFn = SettingsHandlerWindow_ReadLine;
|
|
|
ini_handler.WriteAllFn = SettingsHandlerWindow_WriteAll;
|
|
ini_handler.WriteAllFn = SettingsHandlerWindow_WriteAll;
|
|
|
- g.SettingsHandlers.push_front(ini_handler);
|
|
|
|
|
|
|
+ g.SettingsHandlers.push_back(ini_handler);
|
|
|
|
|
|
|
|
g.Initialized = true;
|
|
g.Initialized = true;
|
|
|
}
|
|
}
|
|
@@ -3587,8 +3595,7 @@ void ImGui::Shutdown(ImGuiContext* context)
|
|
|
g.CurrentWindowStack.clear();
|
|
g.CurrentWindowStack.clear();
|
|
|
g.WindowsById.Clear();
|
|
g.WindowsById.Clear();
|
|
|
g.NavWindow = NULL;
|
|
g.NavWindow = NULL;
|
|
|
- g.HoveredWindow = NULL;
|
|
|
|
|
- g.HoveredRootWindow = NULL;
|
|
|
|
|
|
|
+ g.HoveredWindow = g.HoveredRootWindow = NULL;
|
|
|
g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL;
|
|
g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL;
|
|
|
g.MovingWindow = NULL;
|
|
g.MovingWindow = NULL;
|
|
|
g.ColorModifiers.clear();
|
|
g.ColorModifiers.clear();
|
|
@@ -3693,7 +3700,7 @@ static void AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWin
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void AddWindowToDrawDataSelectLayer(ImGuiWindow* window)
|
|
|
|
|
|
|
+static void AddRootWindowToDrawData(ImGuiWindow* window)
|
|
|
{
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
if (window->Flags & ImGuiWindowFlags_Tooltip)
|
|
if (window->Flags & ImGuiWindowFlags_Tooltip)
|
|
@@ -3829,7 +3836,8 @@ void ImGui::EndFrame()
|
|
|
AddWindowToSortBuffer(&g.WindowsSortBuffer, window);
|
|
AddWindowToSortBuffer(&g.WindowsSortBuffer, window);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong
|
|
|
|
|
|
|
+ // This usually assert if there is a mismatch between the ImGuiWindowFlags_ChildWindow / ParentWindow values and DC.ChildWindows[] in parents, aka we've done something wrong.
|
|
|
|
|
+ IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size);
|
|
|
g.Windows.swap(g.WindowsSortBuffer);
|
|
g.Windows.swap(g.WindowsSortBuffer);
|
|
|
g.IO.MetricsActiveWindows = g.WindowsActiveCount;
|
|
g.IO.MetricsActiveWindows = g.WindowsActiveCount;
|
|
|
|
|
|
|
@@ -3861,11 +3869,11 @@ void ImGui::Render()
|
|
|
{
|
|
{
|
|
|
ImGuiWindow* window = g.Windows[n];
|
|
ImGuiWindow* window = g.Windows[n];
|
|
|
if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_front_most[0] && window != windows_to_render_front_most[1])
|
|
if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_front_most[0] && window != windows_to_render_front_most[1])
|
|
|
- AddWindowToDrawDataSelectLayer(window);
|
|
|
|
|
|
|
+ AddRootWindowToDrawData(window);
|
|
|
}
|
|
}
|
|
|
for (int n = 0; n < IM_ARRAYSIZE(windows_to_render_front_most); n++)
|
|
for (int n = 0; n < IM_ARRAYSIZE(windows_to_render_front_most); n++)
|
|
|
if (windows_to_render_front_most[n] && IsWindowActiveAndVisible(windows_to_render_front_most[n])) // NavWindowingTarget is always temporarily displayed as the front-most window
|
|
if (windows_to_render_front_most[n] && IsWindowActiveAndVisible(windows_to_render_front_most[n])) // NavWindowingTarget is always temporarily displayed as the front-most window
|
|
|
- AddWindowToDrawDataSelectLayer(windows_to_render_front_most[n]);
|
|
|
|
|
|
|
+ AddRootWindowToDrawData(windows_to_render_front_most[n]);
|
|
|
g.DrawDataBuilder.FlattenIntoSingleLayer();
|
|
g.DrawDataBuilder.FlattenIntoSingleLayer();
|
|
|
|
|
|
|
|
// Draw software mouse cursor if requested
|
|
// Draw software mouse cursor if requested
|
|
@@ -4229,7 +4237,10 @@ bool ImGui::IsItemFocused()
|
|
|
{
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
- return g.NavId && !g.NavDisableHighlight && g.NavId == window->DC.LastItemId;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (g.NavId == 0 || g.NavDisableHighlight || g.NavId != window->DC.LastItemId)
|
|
|
|
|
+ return false;
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool ImGui::IsItemClicked(int mouse_button)
|
|
bool ImGui::IsItemClicked(int mouse_button)
|
|
@@ -4298,8 +4309,6 @@ ImVec2 ImGui::GetItemRectSize()
|
|
|
static ImRect GetViewportRect()
|
|
static ImRect GetViewportRect()
|
|
|
{
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
- if (g.IO.DisplayVisibleMin.x != g.IO.DisplayVisibleMax.x && g.IO.DisplayVisibleMin.y != g.IO.DisplayVisibleMax.y)
|
|
|
|
|
- return ImRect(g.IO.DisplayVisibleMin, g.IO.DisplayVisibleMax);
|
|
|
|
|
return ImRect(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y);
|
|
return ImRect(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4563,13 +4572,16 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window, const ImVec2& size_contents)
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- // When the window cannot fit all contents (either because of constraints, either because screen is too small): we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding.
|
|
|
|
|
|
|
+ // Maximum window size is determined by the display size
|
|
|
const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0;
|
|
const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0;
|
|
|
const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;
|
|
const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;
|
|
|
ImVec2 size_min = style.WindowMinSize;
|
|
ImVec2 size_min = style.WindowMinSize;
|
|
|
if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
|
|
if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
|
|
|
size_min = ImMin(size_min, ImVec2(4.0f, 4.0f));
|
|
size_min = ImMin(size_min, ImVec2(4.0f, 4.0f));
|
|
|
ImVec2 size_auto_fit = ImClamp(size_contents, size_min, ImMax(size_min, g.IO.DisplaySize - style.DisplaySafeAreaPadding * 2.0f));
|
|
ImVec2 size_auto_fit = ImClamp(size_contents, size_min, ImMax(size_min, g.IO.DisplaySize - style.DisplaySafeAreaPadding * 2.0f));
|
|
|
|
|
+
|
|
|
|
|
+ // When the window cannot fit all contents (either because of constraints, either because screen is too small),
|
|
|
|
|
+ // we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than ViewportSize-WindowPadding.
|
|
|
ImVec2 size_auto_fit_after_constraint = CalcSizeAfterConstraint(window, size_auto_fit);
|
|
ImVec2 size_auto_fit_after_constraint = CalcSizeAfterConstraint(window, size_auto_fit);
|
|
|
if (size_auto_fit_after_constraint.x < size_contents.x && !(window->Flags & ImGuiWindowFlags_NoScrollbar) && (window->Flags & ImGuiWindowFlags_HorizontalScrollbar))
|
|
if (size_auto_fit_after_constraint.x < size_contents.x && !(window->Flags & ImGuiWindowFlags_NoScrollbar) && (window->Flags & ImGuiWindowFlags_HorizontalScrollbar))
|
|
|
size_auto_fit.y += style.ScrollbarSize;
|
|
size_auto_fit.y += style.ScrollbarSize;
|
|
@@ -4785,13 +4797,15 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
|
|
|
window->Size = window->SizeFull;
|
|
window->Size = window->SizeFull;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void ImGui::RenderOuterBorders(ImGuiWindow* window, int border_held)
|
|
|
|
|
|
|
+static void ImGui::RenderOuterBorders(ImGuiWindow* window)
|
|
|
{
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
float rounding = window->WindowRounding;
|
|
float rounding = window->WindowRounding;
|
|
|
float border_size = window->WindowBorderSize;
|
|
float border_size = window->WindowBorderSize;
|
|
|
if (border_size > 0.0f && !(window->Flags & ImGuiWindowFlags_NoBackground))
|
|
if (border_size > 0.0f && !(window->Flags & ImGuiWindowFlags_NoBackground))
|
|
|
window->DrawList->AddRect(window->Pos, window->Pos + window->Size, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size);
|
|
window->DrawList->AddRect(window->Pos, window->Pos + window->Size, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size);
|
|
|
|
|
+
|
|
|
|
|
+ int border_held = window->ResizeBorderHeld;
|
|
|
if (border_held != -1)
|
|
if (border_held != -1)
|
|
|
{
|
|
{
|
|
|
struct ImGuiResizeBorderDef
|
|
struct ImGuiResizeBorderDef
|
|
@@ -5113,9 +5127,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
window->Pos = FindBestWindowPosForPopup(window);
|
|
window->Pos = FindBestWindowPosForPopup(window);
|
|
|
|
|
|
|
|
// Clamp position so it stays visible
|
|
// Clamp position so it stays visible
|
|
|
- if (!(flags & ImGuiWindowFlags_ChildWindow))
|
|
|
|
|
|
|
+ // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
|
|
|
|
|
+ if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
|
|
|
{
|
|
{
|
|
|
- if (!window_pos_set_by_api && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f) // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
|
|
|
|
|
|
|
+ if (g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f) // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
|
|
|
{
|
|
{
|
|
|
ImVec2 padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding);
|
|
ImVec2 padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding);
|
|
|
ImVec2 size_for_clamping = ((g.IO.ConfigWindowsMoveFromTitleBarOnly) && !(window->Flags & ImGuiWindowFlags_NoTitleBar)) ? ImVec2(window->Size.x, window->TitleBarHeight()) : window->Size;
|
|
ImVec2 size_for_clamping = ((g.IO.ConfigWindowsMoveFromTitleBarOnly) && !(window->Flags & ImGuiWindowFlags_NoTitleBar)) ? ImVec2(window->Size.x, window->TitleBarHeight()) : window->Size;
|
|
@@ -5141,8 +5156,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
// Apply window focus (new and reactivated windows are moved to front)
|
|
// Apply window focus (new and reactivated windows are moved to front)
|
|
|
bool want_focus = false;
|
|
bool want_focus = false;
|
|
|
if (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing))
|
|
if (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing))
|
|
|
- if (!(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ if (flags & ImGuiWindowFlags_Popup)
|
|
|
|
|
+ want_focus = true;
|
|
|
|
|
+ else if ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) == 0)
|
|
|
want_focus = true;
|
|
want_focus = true;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// Handle manual resize: Resize Grips, Borders, Gamepad
|
|
// Handle manual resize: Resize Grips, Borders, Gamepad
|
|
|
int border_held = -1;
|
|
int border_held = -1;
|
|
@@ -5151,6 +5170,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
|
|
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
|
|
|
if (!window->Collapsed)
|
|
if (!window->Collapsed)
|
|
|
UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
|
|
UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
|
|
|
|
|
+ window->ResizeBorderHeld = (signed char)border_held;
|
|
|
|
|
|
|
|
// Default item width. Make it proportional to window size if window manually resizes
|
|
// Default item width. Make it proportional to window size if window manually resizes
|
|
|
if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
|
|
if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
|
|
@@ -5189,6 +5209,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Draw window + handle manual resize
|
|
// Draw window + handle manual resize
|
|
|
|
|
+ // As we highlight the title bar when want_focus is set, multiple reappearing windows will have have their title bar highlighted on their reappearing frame.
|
|
|
const float window_rounding = window->WindowRounding;
|
|
const float window_rounding = window->WindowRounding;
|
|
|
const float window_border_size = window->WindowBorderSize;
|
|
const float window_border_size = window->WindowBorderSize;
|
|
|
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
|
|
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
|
|
@@ -5209,8 +5230,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
if (!(flags & ImGuiWindowFlags_NoBackground))
|
|
if (!(flags & ImGuiWindowFlags_NoBackground))
|
|
|
{
|
|
{
|
|
|
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
|
|
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
|
|
|
|
|
+ float alpha = 1.0f;
|
|
|
if (g.NextWindowData.BgAlphaCond != 0)
|
|
if (g.NextWindowData.BgAlphaCond != 0)
|
|
|
- bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(g.NextWindowData.BgAlphaVal) << IM_COL32_A_SHIFT);
|
|
|
|
|
|
|
+ alpha = g.NextWindowData.BgAlphaVal;
|
|
|
|
|
+ if (alpha != 1.0f)
|
|
|
|
|
+ bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT);
|
|
|
window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
|
window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
|
|
}
|
|
}
|
|
|
g.NextWindowData.BgAlphaCond = 0;
|
|
g.NextWindowData.BgAlphaCond = 0;
|
|
@@ -5253,7 +5277,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Borders
|
|
// Borders
|
|
|
- RenderOuterBorders(window, border_held);
|
|
|
|
|
|
|
+ RenderOuterBorders(window);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Draw navigation selection/windowing rectangle border
|
|
// Draw navigation selection/windowing rectangle border
|
|
@@ -5410,7 +5434,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerMainRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize)));
|
|
window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerMainRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize)));
|
|
|
window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerMainRect.Max.y);
|
|
window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerMainRect.Max.y);
|
|
|
|
|
|
|
|
- // After Begin() we fill the last item / hovered data based on title bar data. It is a standard behavior (to allow creation of context menus on title bar only, etc.).
|
|
|
|
|
|
|
+ // We fill last item data based on Title Bar, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
|
|
|
|
|
+ // This is useful to allow creating context menus on title bar only, etc.
|
|
|
window->DC.LastItemId = window->MoveId;
|
|
window->DC.LastItemId = window->MoveId;
|
|
|
window->DC.LastItemStatusFlags = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0;
|
|
window->DC.LastItemStatusFlags = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0;
|
|
|
window->DC.LastItemRect = title_bar_rect;
|
|
window->DC.LastItemRect = title_bar_rect;
|
|
@@ -5430,7 +5455,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
// Child window can be out of sight and have "negative" clip windows.
|
|
// Child window can be out of sight and have "negative" clip windows.
|
|
|
// Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).
|
|
// Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).
|
|
|
IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
|
|
IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
|
|
|
-
|
|
|
|
|
if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
|
|
if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
|
|
|
if (window->OuterRectClipped.Min.x >= window->OuterRectClipped.Max.x || window->OuterRectClipped.Min.y >= window->OuterRectClipped.Max.y)
|
|
if (window->OuterRectClipped.Min.x >= window->OuterRectClipped.Max.x || window->OuterRectClipped.Min.y >= window->OuterRectClipped.Max.y)
|
|
|
window->HiddenFramesRegular = 1;
|
|
window->HiddenFramesRegular = 1;
|
|
@@ -5555,7 +5579,7 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
|
|
g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId
|
|
g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId
|
|
|
g.NavIdIsAlive = false;
|
|
g.NavIdIsAlive = false;
|
|
|
g.NavLayer = ImGuiNavLayer_Main;
|
|
g.NavLayer = ImGuiNavLayer_Main;
|
|
|
- //IMGUI_DEBUG_LOG("FocusWindow(\"%s\")\n", g.FrameCount, window ? window->Name : NULL);
|
|
|
|
|
|
|
+ //IMGUI_DEBUG_LOG("FocusWindow(\"%s\")\n", window ? window->Name : NULL);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Passing NULL allow to disable keyboard focus
|
|
// Passing NULL allow to disable keyboard focus
|
|
@@ -6823,7 +6847,7 @@ void ImGui::ClosePopupToLevel(int remaining, bool apply_focus_to_window_under)
|
|
|
// FIXME: This code is faulty and we may want to eventually to replace or remove the 'apply_focus_to_window_under=true' path completely.
|
|
// FIXME: This code is faulty and we may want to eventually to replace or remove the 'apply_focus_to_window_under=true' path completely.
|
|
|
// Instead of using g.OpenPopupStack[remaining-1].Window etc. we should find the highest root window that is behind the popups we are closing.
|
|
// Instead of using g.OpenPopupStack[remaining-1].Window etc. we should find the highest root window that is behind the popups we are closing.
|
|
|
// The current code will set focus to the parent of the popup window which is incorrect.
|
|
// The current code will set focus to the parent of the popup window which is incorrect.
|
|
|
- // It rarely manifested until now because UpdateMouseMovingWindow() would call FocusWindow() again on the clicked window,
|
|
|
|
|
|
|
+ // It rarely manifested until now because UpdateMouseMovingWindowNewFrame() would call FocusWindow() again on the clicked window,
|
|
|
// leading to a chain of focusing A (clicked window) then B (parent window of the popup) then A again.
|
|
// leading to a chain of focusing A (clicked window) then B (parent window of the popup) then A again.
|
|
|
// However if the clicked window has the _NoMove flag set we would be left with B focused.
|
|
// However if the clicked window has the _NoMove flag set we would be left with B focused.
|
|
|
// For now, we have disabled this path when called from ClosePopupsOverWindow() because the users of ClosePopupsOverWindow() don't need to alter focus anyway,
|
|
// For now, we have disabled this path when called from ClosePopupsOverWindow() because the users of ClosePopupsOverWindow() don't need to alter focus anyway,
|
|
@@ -7297,6 +7321,7 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con
|
|
|
if (new_best)
|
|
if (new_best)
|
|
|
{
|
|
{
|
|
|
result->ID = id;
|
|
result->ID = id;
|
|
|
|
|
+ result->SelectScopeId = g.MultiSelectScopeId;
|
|
|
result->Window = window;
|
|
result->Window = window;
|
|
|
result->RectRel = nav_bb_rel;
|
|
result->RectRel = nav_bb_rel;
|
|
|
}
|
|
}
|
|
@@ -7308,6 +7333,7 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con
|
|
|
{
|
|
{
|
|
|
result = &g.NavMoveResultLocalVisibleSet;
|
|
result = &g.NavMoveResultLocalVisibleSet;
|
|
|
result->ID = id;
|
|
result->ID = id;
|
|
|
|
|
+ result->SelectScopeId = g.MultiSelectScopeId;
|
|
|
result->Window = window;
|
|
result->Window = window;
|
|
|
result->RectRel = nav_bb_rel;
|
|
result->RectRel = nav_bb_rel;
|
|
|
}
|
|
}
|
|
@@ -7848,8 +7874,13 @@ static void ImGui::NavUpdateMoveResult()
|
|
|
|
|
|
|
|
ClearActiveID();
|
|
ClearActiveID();
|
|
|
g.NavWindow = result->Window;
|
|
g.NavWindow = result->Window;
|
|
|
|
|
+ if (g.NavId != result->ID)
|
|
|
|
|
+ {
|
|
|
|
|
+ // Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)
|
|
|
|
|
+ g.NavJustMovedToId = result->ID;
|
|
|
|
|
+ g.NavJustMovedToSelectScopeId = result->SelectScopeId;
|
|
|
|
|
+ }
|
|
|
SetNavIDWithRectRel(result->ID, g.NavLayer, result->RectRel);
|
|
SetNavIDWithRectRel(result->ID, g.NavLayer, result->RectRel);
|
|
|
- g.NavJustMovedToId = result->ID;
|
|
|
|
|
g.NavMoveFromClampedRefRect = false;
|
|
g.NavMoveFromClampedRefRect = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -8730,6 +8761,9 @@ void ImGui::EndDragDropTarget()
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
// [SECTION] LOGGING/CAPTURING
|
|
// [SECTION] LOGGING/CAPTURING
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
+// All text output from the interface can be captured into tty/file/clipboard.
|
|
|
|
|
+// By default, tree nodes are automatically opened during logging.
|
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Pass text data straight to log (without being displayed)
|
|
// Pass text data straight to log (without being displayed)
|
|
|
void ImGui::LogText(const char* fmt, ...)
|
|
void ImGui::LogText(const char* fmt, ...)
|
|
@@ -8933,6 +8967,13 @@ ImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id)
|
|
|
return NULL;
|
|
return NULL;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ImGuiWindowSettings* ImGui::FindOrCreateWindowSettings(const char* name)
|
|
|
|
|
+{
|
|
|
|
|
+ if (ImGuiWindowSettings* settings = FindWindowSettings(ImHashStr(name, 0)))
|
|
|
|
|
+ return settings;
|
|
|
|
|
+ return CreateNewWindowSettings(name);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void ImGui::LoadIniSettingsFromDisk(const char* ini_filename)
|
|
void ImGui::LoadIniSettingsFromDisk(const char* ini_filename)
|
|
|
{
|
|
{
|
|
|
size_t file_data_size = 0;
|
|
size_t file_data_size = 0;
|