Skip to content

Commit 742b5f4

Browse files
committed
Merged a bunch of small changes from Docking branch to reduce the difference between branches.
Noticeable: horizontal alignment of CloseButton. Menu fill take account of border. Various stylistic tweaks to accomodate other changes in Docking.
1 parent 311469e commit 742b5f4

File tree

4 files changed

+79
-50
lines changed

4 files changed

+79
-50
lines changed

docs/CHANGELOG.txt

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Other Changes:
5050
- GetMouseDragDelta(): verify that mouse positions are valid otherwise returns zero.
5151
- Inputs: Also add support for horizontal scroll with Shift+Mouse Wheel. (#2424, #1463) [@LucaRood]
5252
- PlotLines, PlotHistogram: Ignore NaN values when calculating min/max bounds. (#2485)
53+
- Window: Window close button is horizontally aligned with style.FramePadding.x.
5354
- Misc: Added IM_MALLOC/IM_FREE macros mimicking IM_NEW/IM_DELETE so user doesn't need to revert
5455
to using the ImGui::MemAlloc()/MemFree() calls directly.
5556
- Examples: OpenGL: Added a dummy GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized

imgui.cpp

+73-45
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ CODE
914914
(The ImGuiWindowFlags_NoDecoration flag itself is a shortcut for NoTitleBar | NoResize | NoScrollbar | NoCollapse)
915915
Then you can retrieve the ImDrawList* via GetWindowDrawList() and draw to it in any way you like.
916916
- You can call ImGui::GetBackgroundDrawList() or ImGui::GetForegroundDrawList() and use those draw list to display
917-
contents behind or over every other imgui windows.
917+
contents behind or over every other imgui windows (one bg/fg drawlist per viewport).
918918
- You can create your own ImDrawList instance. You'll need to initialize them ImGui::GetDrawListSharedData(), or create
919919
your own ImDrawListSharedData, and then call your rendered code with your own ImDrawList or ImDrawData data.
920920
@@ -1065,7 +1065,7 @@ static float NavUpdatePageUpPageDown(int allowed_dir_flags);
10651065
static inline void NavUpdateAnyRequestFlag();
10661066
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, ImGuiID id);
10671067
static ImVec2 NavCalcPreferredRefPos();
1068-
static void NavSaveLastChildNavWindow(ImGuiWindow* nav_window);
1068+
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
10691069
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
10701070

10711071
// Misc
@@ -3609,6 +3609,7 @@ void ImGui::NewFrame()
36093609
{
36103610
ImGuiWindow* window = g.Windows[i];
36113611
window->WasActive = window->Active;
3612+
window->BeginCount = 0;
36123613
window->Active = false;
36133614
window->WriteAccessed = false;
36143615
}
@@ -3791,6 +3792,7 @@ static void AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWin
37913792
}
37923793
}
37933794

3795+
// Layer is locked for the root window, however child windows may use a different viewport (e.g. extruding menu)
37943796
static void AddRootWindowToDrawData(ImGuiWindow* window)
37953797
{
37963798
ImGuiContext& g = *GImGui;
@@ -4916,6 +4918,13 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
49164918
window->Size = window->SizeFull;
49174919
}
49184920

4921+
static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& rect, const ImVec2& padding)
4922+
{
4923+
ImGuiContext& g = *GImGui;
4924+
ImVec2 size_for_clamping = (g.IO.ConfigWindowsMoveFromTitleBarOnly && !(window->Flags & ImGuiWindowFlags_NoTitleBar)) ? ImVec2(window->Size.x, window->TitleBarHeight()) : window->Size;
4925+
window->Pos = ImMin(rect.Max - padding, ImMax(window->Pos + size_for_clamping, rect.Min + padding) - size_for_clamping);
4926+
}
4927+
49194928
static void ImGui::RenderOuterBorders(ImGuiWindow* window)
49204929
{
49214930
ImGuiContext& g = *GImGui;
@@ -5002,18 +5011,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
50025011
const int current_frame = g.FrameCount;
50035012
const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame);
50045013

5005-
// Update Flags, LastFrameActive, BeginOrderXXX fields
5006-
if (first_begin_of_the_frame)
5007-
window->Flags = (ImGuiWindowFlags)flags;
5008-
else
5009-
flags = window->Flags;
5010-
5011-
// Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack
5012-
ImGuiWindow* parent_window_in_stack = g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back();
5013-
ImGuiWindow* parent_window = first_begin_of_the_frame ? ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) ? parent_window_in_stack : NULL) : window->ParentWindow;
5014-
IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
5015-
window->HasCloseButton = (p_open != NULL);
5016-
50175014
// Update the Appearing flag
50185015
bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
50195016
const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0);
@@ -5027,9 +5024,28 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
50275024
if (window->Appearing)
50285025
SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true);
50295026

5027+
// Update Flags, LastFrameActive, BeginOrderXXX fields
5028+
if (first_begin_of_the_frame)
5029+
{
5030+
window->Flags = (ImGuiWindowFlags)flags;
5031+
window->LastFrameActive = current_frame;
5032+
window->BeginOrderWithinParent = 0;
5033+
window->BeginOrderWithinContext = (short)(g.WindowsActiveCount++);
5034+
}
5035+
else
5036+
{
5037+
flags = window->Flags;
5038+
}
5039+
5040+
// Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack
5041+
ImGuiWindow* parent_window_in_stack = g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back();
5042+
ImGuiWindow* parent_window = first_begin_of_the_frame ? ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) ? parent_window_in_stack : NULL) : window->ParentWindow;
5043+
IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
5044+
50305045
// Add to stack
5046+
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
50315047
g.CurrentWindowStack.push_back(window);
5032-
SetCurrentWindow(window);
5048+
g.CurrentWindow = NULL;
50335049
CheckStacksSize(window, true);
50345050
if (flags & ImGuiWindowFlags_Popup)
50355051
{
@@ -5093,11 +5109,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
50935109
UpdateWindowParentAndRootLinks(window, flags, parent_window);
50945110

50955111
window->Active = true;
5096-
window->BeginOrderWithinParent = 0;
5097-
window->BeginOrderWithinContext = (short)(g.WindowsActiveCount++);
5098-
window->BeginCount = 0;
5112+
window->HasCloseButton = (p_open != NULL);
50995113
window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX);
5100-
window->LastFrameActive = current_frame;
51015114
window->IDStack.resize(1);
51025115

51035116
// Update stored window name when it changes (which can _only_ happen with the "###" operator, so the ID would stay unchanged).
@@ -5143,7 +5156,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
51435156
SetCurrentWindow(window);
51445157

51455158
// Lock border size and padding for the frame (so that altering them doesn't cause inconsistencies)
5146-
window->WindowBorderSize = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildBorderSize : ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize;
5159+
if (flags & ImGuiWindowFlags_ChildWindow)
5160+
window->WindowBorderSize = style.ChildBorderSize;
5161+
else
5162+
window->WindowBorderSize = ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize;
51475163
window->WindowPadding = style.WindowPadding;
51485164
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_Popup)) && window->WindowBorderSize == 0.0f)
51495165
window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f);
@@ -5247,14 +5263,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
52475263

52485264
// Clamp position so it stays visible
52495265
// Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
5266+
ImRect viewport_rect(GetViewportRect());
52505267
if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
52515268
{
52525269
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.
52535270
{
5254-
ImVec2 padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding);
5255-
ImVec2 size_for_clamping = ((g.IO.ConfigWindowsMoveFromTitleBarOnly) && !(window->Flags & ImGuiWindowFlags_NoTitleBar)) ? ImVec2(window->Size.x, window->TitleBarHeight()) : window->Size;
5256-
window->Pos = ImMax(window->Pos + size_for_clamping, padding) - size_for_clamping;
5257-
window->Pos = ImMin(window->Pos, g.IO.DisplaySize - padding);
5271+
ImVec2 clamp_padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding);
5272+
ClampWindowRect(window, viewport_rect, clamp_padding);
52585273
}
52595274
}
52605275
window->Pos = ImFloor(window->Pos);
@@ -5297,7 +5312,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
52975312
window->DrawList->Clear();
52985313
window->DrawList->Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);
52995314
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
5300-
ImRect viewport_rect(GetViewportRect());
53015315
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip)
53025316
PushClipRect(parent_window->ClipRect.Min, parent_window->ClipRect.Max, true);
53035317
else
@@ -5364,7 +5378,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
53645378
{
53655379
ImRect menu_bar_rect = window->MenuBarRect();
53665380
menu_bar_rect.ClipWith(window->Rect()); // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.
5367-
window->DrawList->AddRectFilled(menu_bar_rect.Min, menu_bar_rect.Max, GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawCornerFlags_Top);
5381+
window->DrawList->AddRectFilled(menu_bar_rect.Min+ImVec2(window_border_size,0), menu_bar_rect.Max-ImVec2(window_border_size,0), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawCornerFlags_Top);
53685382
if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y)
53695383
window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
53705384
}
@@ -5485,9 +5499,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
54855499
// Close button
54865500
if (p_open != NULL)
54875501
{
5488-
const float pad = style.FramePadding.y;
54895502
const float rad = g.FontSize * 0.5f;
5490-
if (CloseButton(window->GetID("#CLOSE"), window->Rect().GetTR() + ImVec2(-pad - rad, pad + rad), rad + 1))
5503+
if (CloseButton(window->GetID("#CLOSE"), ImVec2(window->Pos.x + window->Size.x - style.FramePadding.x - rad, window->Pos.y + style.FramePadding.y + rad), rad + 1))
54915504
*p_open = false;
54925505
}
54935506

@@ -5547,7 +5560,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
55475560
window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerMainRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize)));
55485561
window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerMainRect.Max.y);
55495562

5550-
// We fill last item data based on Title Bar, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
5563+
// We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
55515564
// This is useful to allow creating context menus on title bar only, etc.
55525565
window->DC.LastItemId = window->MoveId;
55535566
window->DC.LastItemStatusFlags = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0;
@@ -5557,6 +5570,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
55575570
IMGUI_TEST_ENGINE_ITEM_ADD(window->DC.LastItemRect, window->DC.LastItemId);
55585571
#endif
55595572
}
5573+
else
5574+
{
5575+
// Append
5576+
SetCurrentWindow(window);
5577+
}
55605578

55615579
PushClipRect(window->InnerClipRect.Min, window->InnerClipRect.Max, true);
55625580

@@ -7126,14 +7144,6 @@ bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
71267144
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings);
71277145
}
71287146

7129-
ImRect ImGui::GetWindowAllowedExtentRect(ImGuiWindow*)
7130-
{
7131-
ImVec2 padding = GImGui->Style.DisplaySafeAreaPadding;
7132-
ImRect r_screen = GetViewportRect();
7133-
r_screen.Expand(ImVec2((r_screen.GetWidth() > padding.x * 2) ? -padding.x : 0.0f, (r_screen.GetHeight() > padding.y * 2) ? -padding.y : 0.0f));
7134-
return r_screen;
7135-
}
7136-
71377147
// r_avoid = the rectangle to avoid (e.g. for tooltip it is a rectangle around the mouse cursor which we want to avoid. for popups it's a small point around the cursor.)
71387148
// r_outer = the visible area rectangle, minus safe area padding. If our popup size won't fit because of safe area padding we ignore it.
71397149
ImVec2 ImGui::FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy)
@@ -7189,6 +7199,15 @@ ImVec2 ImGui::FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& s
71897199
return pos;
71907200
}
71917201

7202+
ImRect ImGui::GetWindowAllowedExtentRect(ImGuiWindow* window)
7203+
{
7204+
IM_UNUSED(window);
7205+
ImVec2 padding = GImGui->Style.DisplaySafeAreaPadding;
7206+
ImRect r_screen = GetViewportRect();
7207+
r_screen.Expand(ImVec2((r_screen.GetWidth() > padding.x * 2) ? -padding.x : 0.0f, (r_screen.GetHeight() > padding.y * 2) ? -padding.y : 0.0f));
7208+
return r_screen;
7209+
}
7210+
71927211
ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window)
71937212
{
71947213
ImGuiContext& g = *GImGui;
@@ -7530,7 +7549,9 @@ void ImGui::NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags mov
75307549
}
75317550
}
75327551

7533-
static void ImGui::NavSaveLastChildNavWindow(ImGuiWindow* nav_window)
7552+
// FIXME: This could be replaced by updating a frame number in each window when (window == NavWindow) and (NavLayer == 0).
7553+
// This way we could find the last focused window among our children. It would be much less confusing this way?
7554+
static void ImGui::NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window)
75347555
{
75357556
ImGuiWindow* parent_window = nav_window;
75367557
while (parent_window && (parent_window->Flags & ImGuiWindowFlags_ChildWindow) != 0 && (parent_window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) == 0)
@@ -7539,7 +7560,8 @@ static void ImGui::NavSaveLastChildNavWindow(ImGuiWindow* nav_window)
75397560
parent_window->NavLastChildNavWindow = nav_window;
75407561
}
75417562

7542-
// Call when we are expected to land on Layer 0 after FocusWindow()
7563+
// Restore the last focused child.
7564+
// Call when we are expected to land on the Main Layer (0) after FocusWindow()
75437565
static ImGuiWindow* ImGui::NavRestoreLastChildNavWindow(ImGuiWindow* window)
75447566
{
75457567
return window->NavLastChildNavWindow ? window->NavLastChildNavWindow : window;
@@ -7767,7 +7789,7 @@ static void ImGui::NavUpdate()
77677789

77687790
// Store our return window (for returning from Layer 1 to Layer 0) and clear it as soon as we step back in our own Layer 0
77697791
if (g.NavWindow)
7770-
NavSaveLastChildNavWindow(g.NavWindow);
7792+
NavSaveLastChildNavWindowIntoParent(g.NavWindow);
77717793
if (g.NavWindow && g.NavWindow->NavLastChildNavWindow != NULL && g.NavLayer == 0)
77727794
g.NavWindow->NavLastChildNavWindow = NULL;
77737795

@@ -8166,7 +8188,9 @@ static void ImGui::NavUpdateWindowing()
81668188

81678189
// Keyboard: Press and Release ALT to toggle menu layer
81688190
// FIXME: We lack an explicit IO variable for "is the imgui window focused", so compare mouse validity to detect the common case of back-end clearing releases all keys on ALT-TAB
8169-
if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released))
8191+
if (IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Pressed))
8192+
g.NavWindowingToggleLayer = true;
8193+
if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && g.NavWindowingToggleLayer && IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released))
81708194
if (IsMousePosValid(&g.IO.MousePos) == IsMousePosValid(&g.IO.MousePosPrev))
81718195
apply_toggle_layer = true;
81728196

@@ -8212,7 +8236,8 @@ static void ImGui::NavUpdateWindowing()
82128236
{
82138237
// Move to parent menu if necessary
82148238
ImGuiWindow* new_nav_window = g.NavWindow;
8215-
while ((new_nav_window->DC.NavLayerActiveMask & (1 << 1)) == 0
8239+
while (new_nav_window->ParentWindow
8240+
&& (new_nav_window->DC.NavLayerActiveMask & (1 << ImGuiNavLayer_Menu)) == 0
82168241
&& (new_nav_window->Flags & ImGuiWindowFlags_ChildWindow) != 0
82178242
&& (new_nav_window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) == 0)
82188243
new_nav_window = new_nav_window->ParentWindow;
@@ -8224,7 +8249,10 @@ static void ImGui::NavUpdateWindowing()
82248249
}
82258250
g.NavDisableHighlight = false;
82268251
g.NavDisableMouseHover = true;
8227-
NavRestoreLayer((g.NavWindow->DC.NavLayerActiveMask & (1 << ImGuiNavLayer_Menu)) ? (ImGuiNavLayer)((int)g.NavLayer ^ 1) : ImGuiNavLayer_Main);
8252+
8253+
// When entering a regular menu bar with the Alt key, we always reinitialize the navigation ID.
8254+
const ImGuiNavLayer new_nav_layer = (g.NavWindow->DC.NavLayerActiveMask & (1 << ImGuiNavLayer_Menu)) ? (ImGuiNavLayer)((int)g.NavLayer ^ 1) : ImGuiNavLayer_Main;
8255+
NavRestoreLayer(new_nav_layer);
82288256
}
82298257
}
82308258

@@ -9515,7 +9543,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
95159543
}
95169544
ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
95179545
bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "Draw %4d %s vtx, tex 0x%p, clip_rect (%4.0f,%4.0f)-(%4.0f,%4.0f)", pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? "indexed" : "non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
9518-
if (show_draw_cmd_clip_rects && ImGui::IsItemHovered())
9546+
if (show_draw_cmd_clip_rects && fg_draw_list && ImGui::IsItemHovered())
95199547
{
95209548
ImRect clip_rect = pcmd->ClipRect;
95219549
ImRect vtxs_rect;
@@ -9544,7 +9572,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
95449572
(n == 0) ? "idx" : " ", idx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
95459573
}
95469574
ImGui::Selectable(buf, false);
9547-
if (ImGui::IsItemHovered())
9575+
if (fg_draw_list && ImGui::IsItemHovered())
95489576
{
95499577
ImDrawListFlags backup_flags = fg_draw_list->Flags;
95509578
fg_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines at is more readable for very large and thin triangles.

imgui_demo.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -4267,16 +4267,16 @@ void ShowExampleAppDocuments(bool* p_open)
42674267
{
42684268
static ExampleAppDocuments app;
42694269

4270+
// Options
4271+
static bool opt_reorderable = true;
4272+
static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;
4273+
42704274
if (!ImGui::Begin("Example: Documents", p_open, ImGuiWindowFlags_MenuBar))
42714275
{
42724276
ImGui::End();
42734277
return;
42744278
}
42754279

4276-
// Options
4277-
static bool opt_reorderable = true;
4278-
static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;
4279-
42804280
// Menu
42814281
if (ImGui::BeginMenuBar())
42824282
{

0 commit comments

Comments
 (0)