|
|
@@ -54,6 +54,7 @@ CODE
|
|
|
// [SECTION] ImGuiListClipper
|
|
|
// [SECTION] RENDER HELPERS
|
|
|
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
|
|
|
+// [SECTION] ERROR CHECKING
|
|
|
// [SECTION] SCROLLING
|
|
|
// [SECTION] TOOLTIPS
|
|
|
// [SECTION] POPUPS
|
|
|
@@ -351,7 +352,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.
|
|
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
|
|
|
|
- - 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017): Begin() (5 arguments signature), IsRootWindowOrAnyChildHovered(), AlignFirstTextHeightToWidgets(), SetNextWindowPosCenter(), ImFont::Glyph. Grep this log for details and new names, or see how they were implemented until 1.73.
|
|
|
+ - 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017): Begin() (5 arguments signature), IsRootWindowOrAnyChildHovered(), AlignFirstTextHeightToWidgets(), SetNextWindowPosCenter(), ImFont::Glyph. See docs/Changelog.txt or grep this log for details and new names, or see how they were implemented until 1.73.
|
|
|
- 2019/10/14 (1.74) - inputs: Fixed a miscalculation in the keyboard/mouse "typematic" repeat delay/rate calculation, used by keys and e.g. repeating mouse buttons as well as the GetKeyPressedAmount() function.
|
|
|
if you were using a non-default value for io.KeyRepeatRate (previous default was 0.250), you can add +io.KeyRepeatDelay to it to compensate for the fix.
|
|
|
The function was triggering on: 0.0 and (delay+rate*N) where (N>=1). Fixed formula responds to (N>=0). Effectively it made io.KeyRepeatRate behave like it was set to (io.KeyRepeatRate + io.KeyRepeatDelay).
|
|
|
@@ -840,7 +841,6 @@ static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 2.00f; // Lock
|
|
|
static void SetCurrentWindow(ImGuiWindow* window);
|
|
|
static void FindHoveredWindow();
|
|
|
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags);
|
|
|
-static void CheckStacksSize(ImGuiWindow* window, bool write);
|
|
|
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges);
|
|
|
|
|
|
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);
|
|
|
@@ -876,6 +876,10 @@ static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_win
|
|
|
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
|
|
|
static int FindWindowFocusIndex(ImGuiWindow* window);
|
|
|
|
|
|
+// Error Checking
|
|
|
+static void ErrorCheckEndFrame();
|
|
|
+static void ErrorCheckBeginEndCompareStacksSize(ImGuiWindow* window, bool write);
|
|
|
+
|
|
|
// Misc
|
|
|
static void UpdateMouseInputs();
|
|
|
static void UpdateMouseWheel();
|
|
|
@@ -3541,7 +3545,7 @@ void ImGui::NewFrame()
|
|
|
}
|
|
|
|
|
|
g.Time += g.IO.DeltaTime;
|
|
|
- g.FrameScopeActive = true;
|
|
|
+ g.WithinFrameScope = true;
|
|
|
g.FrameCount += 1;
|
|
|
g.TooltipOverrideCount = 0;
|
|
|
g.WindowsActiveCount = 0;
|
|
|
@@ -3715,7 +3719,7 @@ void ImGui::NewFrame()
|
|
|
// This fallback is particularly important as it avoid ImGui:: calls from crashing.
|
|
|
SetNextWindowSize(ImVec2(400,400), ImGuiCond_FirstUseEver);
|
|
|
Begin("Debug##Default");
|
|
|
- g.FrameScopePushedImplicitWindow = true;
|
|
|
+ g.WithinFrameScopeWithImplicitWindow = true;
|
|
|
|
|
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
|
|
ImGuiTestEngineHook_PostNewFrame(&g);
|
|
|
@@ -3984,7 +3988,7 @@ void ImGui::EndFrame()
|
|
|
IM_ASSERT(g.Initialized);
|
|
|
if (g.FrameCountEnded == g.FrameCount) // Don't process EndFrame() multiple times.
|
|
|
return;
|
|
|
- IM_ASSERT(g.FrameScopeActive && "Forgot to call ImGui::NewFrame()?");
|
|
|
+ IM_ASSERT(g.WithinFrameScope && "Forgot to call ImGui::NewFrame()?");
|
|
|
|
|
|
// Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)
|
|
|
if (g.IO.ImeSetInputScreenPosFn && (g.PlatformImeLastPos.x == FLT_MAX || ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f))
|
|
|
@@ -3993,24 +3997,10 @@ void ImGui::EndFrame()
|
|
|
g.PlatformImeLastPos = g.PlatformImePos;
|
|
|
}
|
|
|
|
|
|
- // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you
|
|
|
- // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API).
|
|
|
- if (g.CurrentWindowStack.Size != 1)
|
|
|
- {
|
|
|
- if (g.CurrentWindowStack.Size > 1)
|
|
|
- {
|
|
|
- IM_ASSERT(g.CurrentWindowStack.Size == 1 && "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
|
|
|
- while (g.CurrentWindowStack.Size > 1) // FIXME-ERRORHANDLING
|
|
|
- End();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- IM_ASSERT(g.CurrentWindowStack.Size == 1 && "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
|
|
|
- }
|
|
|
- }
|
|
|
+ ErrorCheckEndFrame();
|
|
|
|
|
|
// Hide implicit/fallback "Debug" window if it hasn't been used
|
|
|
- g.FrameScopePushedImplicitWindow = false;
|
|
|
+ g.WithinFrameScopeWithImplicitWindow = false;
|
|
|
if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)
|
|
|
g.CurrentWindow->Active = false;
|
|
|
End();
|
|
|
@@ -4037,7 +4027,7 @@ void ImGui::EndFrame()
|
|
|
}
|
|
|
|
|
|
// End frame
|
|
|
- g.FrameScopeActive = false;
|
|
|
+ g.WithinFrameScope = false;
|
|
|
g.FrameCountEnded = g.FrameCount;
|
|
|
|
|
|
// Initiate moving window + handle left-click and right-click focus
|
|
|
@@ -4604,7 +4594,10 @@ void ImGui::EndChild()
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
+ IM_ASSERT(g.WithinEndChild == false);
|
|
|
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss
|
|
|
+
|
|
|
+ g.WithinEndChild = true;
|
|
|
if (window->BeginCount > 1)
|
|
|
{
|
|
|
End();
|
|
|
@@ -4636,6 +4629,7 @@ void ImGui::EndChild()
|
|
|
ItemAdd(bb, 0);
|
|
|
}
|
|
|
}
|
|
|
+ g.WithinEndChild = false;
|
|
|
}
|
|
|
|
|
|
// Helper to create a child window / scrolling region that looks like a normal widget frame.
|
|
|
@@ -4658,22 +4652,6 @@ void ImGui::EndChildFrame()
|
|
|
EndChild();
|
|
|
}
|
|
|
|
|
|
-// Save and compare stack sizes on Begin()/End() to detect usage errors
|
|
|
-static void CheckStacksSize(ImGuiWindow* window, bool write)
|
|
|
-{
|
|
|
- // NOT checking: DC.ItemWidth, DC.AllowKeyboardFocus, DC.ButtonRepeat, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin)
|
|
|
- ImGuiContext& g = *GImGui;
|
|
|
- short* p_backup = &window->DC.StackSizesBackup[0];
|
|
|
- { int current = window->IDStack.Size; if (write) *p_backup = (short)current; else IM_ASSERT(*p_backup == current && "PushID/PopID or TreeNode/TreePop Mismatch!"); p_backup++; } // Too few or too many PopID()/TreePop()
|
|
|
- { int current = window->DC.GroupStack.Size; if (write) *p_backup = (short)current; else IM_ASSERT(*p_backup == current && "BeginGroup/EndGroup Mismatch!"); p_backup++; } // Too few or too many EndGroup()
|
|
|
- { int current = g.BeginPopupStack.Size; if (write) *p_backup = (short)current; else IM_ASSERT(*p_backup == current && "BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch"); p_backup++;}// Too few or too many EndMenu()/EndPopup()
|
|
|
- // For color, style and font stacks there is an incentive to use Push/Begin/Pop/.../End patterns, so we relax our checks a little to allow them.
|
|
|
- { int current = g.ColorModifiers.Size; if (write) *p_backup = (short)current; else IM_ASSERT(*p_backup >= current && "PushStyleColor/PopStyleColor Mismatch!"); p_backup++; } // Too few or too many PopStyleColor()
|
|
|
- { int current = g.StyleModifiers.Size; if (write) *p_backup = (short)current; else IM_ASSERT(*p_backup >= current && "PushStyleVar/PopStyleVar Mismatch!"); p_backup++; } // Too few or too many PopStyleVar()
|
|
|
- { int current = g.FontStack.Size; if (write) *p_backup = (short)current; else IM_ASSERT(*p_backup >= current && "PushFont/PopFont Mismatch!"); p_backup++; } // Too few or too many PopFont()
|
|
|
- IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));
|
|
|
-}
|
|
|
-
|
|
|
static void SetWindowConditionAllowFlags(ImGuiWindow* window, ImGuiCond flags, bool enabled)
|
|
|
{
|
|
|
window->SetWindowPosAllowFlags = enabled ? (window->SetWindowPosAllowFlags | flags) : (window->SetWindowPosAllowFlags & ~flags);
|
|
|
@@ -5240,7 +5218,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
const ImGuiStyle& style = g.Style;
|
|
|
IM_ASSERT(name != NULL && name[0] != '\0'); // Window name required
|
|
|
- IM_ASSERT(g.FrameScopeActive); // Forgot to call ImGui::NewFrame()
|
|
|
+ IM_ASSERT(g.WithinFrameScope); // Forgot to call ImGui::NewFrame()
|
|
|
IM_ASSERT(g.FrameCountEnded != g.FrameCount); // Called ImGui::Render() or ImGui::EndFrame() and haven't called ImGui::NewFrame() again yet
|
|
|
|
|
|
// Find or create
|
|
|
@@ -5302,7 +5280,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
|
|
|
g.CurrentWindowStack.push_back(window);
|
|
|
g.CurrentWindow = NULL;
|
|
|
- CheckStacksSize(window, true);
|
|
|
+ ErrorCheckBeginEndCompareStacksSize(window, true);
|
|
|
if (flags & ImGuiWindowFlags_Popup)
|
|
|
{
|
|
|
ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];
|
|
|
@@ -5841,16 +5819,21 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
void ImGui::End()
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
- if (g.CurrentWindowStack.Size <= 1 && g.FrameScopePushedImplicitWindow)
|
|
|
+ // Error checking: verify that user hasn't called End() too many times!
|
|
|
+ if (g.CurrentWindowStack.Size <= 1 && g.WithinFrameScopeWithImplicitWindow)
|
|
|
{
|
|
|
- IM_ASSERT(g.CurrentWindowStack.Size > 1 && "Calling End() too many times!");
|
|
|
- return; // FIXME-ERRORHANDLING
|
|
|
+ IMGUI_USER_ERROR(g.CurrentWindowStack.Size > 1, "Calling End() too many times!");
|
|
|
+ return;
|
|
|
}
|
|
|
IM_ASSERT(g.CurrentWindowStack.Size > 0);
|
|
|
|
|
|
- ImGuiWindow* window = g.CurrentWindow;
|
|
|
+ // Error checking: verify that user doesn't directly call End() on a child window.
|
|
|
+ if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
|
|
+ IMGUI_USER_ERROR(g.WithinEndChild, "Must call EndChild() and not End()!");
|
|
|
|
|
|
+ // Close anything that is open
|
|
|
if (window->DC.CurrentColumns)
|
|
|
EndColumns();
|
|
|
PopClipRect(); // Inner window clip rectangle
|
|
|
@@ -5863,7 +5846,7 @@ void ImGui::End()
|
|
|
g.CurrentWindowStack.pop_back();
|
|
|
if (window->Flags & ImGuiWindowFlags_Popup)
|
|
|
g.BeginPopupStack.pop_back();
|
|
|
- CheckStacksSize(window, false);
|
|
|
+ ErrorCheckBeginEndCompareStacksSize(window, false);
|
|
|
SetCurrentWindow(g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back());
|
|
|
}
|
|
|
|
|
|
@@ -7009,6 +6992,54 @@ void ImGui::Unindent(float indent_w)
|
|
|
}
|
|
|
|
|
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
+// [SECTION] ERROR CHECKING
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
+
|
|
|
+static void ImGui::ErrorCheckEndFrame()
|
|
|
+{
|
|
|
+ // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you
|
|
|
+ // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API).
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ if (g.CurrentWindowStack.Size != 1)
|
|
|
+ {
|
|
|
+ if (g.CurrentWindowStack.Size > 1)
|
|
|
+ {
|
|
|
+ IMGUI_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
|
|
|
+ while (g.CurrentWindowStack.Size > 1)
|
|
|
+ End();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ IMGUI_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// Save and compare stack sizes on Begin()/End() to detect usage errors
|
|
|
+// Begin() calls this with write=true
|
|
|
+// End() calls this with write=false
|
|
|
+static void ImGui::ErrorCheckBeginEndCompareStacksSize(ImGuiWindow* window, bool write)
|
|
|
+{
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ short* p = &window->DC.StackSizesBackup[0];
|
|
|
+
|
|
|
+ // Window stacks
|
|
|
+ // NOT checking: DC.ItemWidth, DC.AllowKeyboardFocus, DC.ButtonRepeat, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin)
|
|
|
+ { int n = window->IDStack.Size; if (write) *p = (short)n; else IM_ASSERT(*p == n && "PushID/PopID or TreeNode/TreePop Mismatch!"); p++; } // Too few or too many PopID()/TreePop()
|
|
|
+ { int n = window->DC.GroupStack.Size; if (write) *p = (short)n; else IM_ASSERT(*p == n && "BeginGroup/EndGroup Mismatch!"); p++; } // Too few or too many EndGroup()
|
|
|
+
|
|
|
+ // Global stacks
|
|
|
+ // For color, style and font stacks there is an incentive to use Push/Begin/Pop/.../End patterns, so we relax our checks a little to allow them.
|
|
|
+ { int n = g.BeginPopupStack.Size; if (write) *p = (short)n; else IM_ASSERT(*p == n && "BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch!"); p++; }// Too few or too many EndMenu()/EndPopup()
|
|
|
+ { int n = g.ColorModifiers.Size; if (write) *p = (short)n; else IM_ASSERT(*p >= n && "PushStyleColor/PopStyleColor Mismatch!"); p++; } // Too few or too many PopStyleColor()
|
|
|
+ { int n = g.StyleModifiers.Size; if (write) *p = (short)n; else IM_ASSERT(*p >= n && "PushStyleVar/PopStyleVar Mismatch!"); p++; } // Too few or too many PopStyleVar()
|
|
|
+ { int n = g.FontStack.Size; if (write) *p = (short)n; else IM_ASSERT(*p >= n && "PushFont/PopFont Mismatch!"); p++; } // Too few or too many PopFont()
|
|
|
+ IM_ASSERT(p == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// [SECTION] SCROLLING
|
|
|
//-----------------------------------------------------------------------------
|
|
|
@@ -8171,7 +8202,7 @@ static void ImGui::NavUpdate()
|
|
|
g.IO.NavVisible = (g.IO.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL);
|
|
|
|
|
|
// Process NavCancel input (to close a popup, get back to parent, clear focus)
|
|
|
- if (IsNavInputPressed(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed))
|
|
|
+ if (IsNavInputTest(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed))
|
|
|
{
|
|
|
if (g.ActiveId != 0)
|
|
|
{
|
|
|
@@ -8215,14 +8246,14 @@ static void ImGui::NavUpdate()
|
|
|
if (g.NavId != 0 && !g.NavDisableHighlight && !g.NavWindowingTarget && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
|
|
{
|
|
|
bool activate_down = IsNavInputDown(ImGuiNavInput_Activate);
|
|
|
- bool activate_pressed = activate_down && IsNavInputPressed(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed);
|
|
|
+ bool activate_pressed = activate_down && IsNavInputTest(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed);
|
|
|
if (g.ActiveId == 0 && activate_pressed)
|
|
|
g.NavActivateId = g.NavId;
|
|
|
if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_down)
|
|
|
g.NavActivateDownId = g.NavId;
|
|
|
if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_pressed)
|
|
|
g.NavActivatePressedId = g.NavId;
|
|
|
- if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && IsNavInputPressed(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed))
|
|
|
+ if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && IsNavInputTest(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed))
|
|
|
g.NavInputId = g.NavId;
|
|
|
}
|
|
|
if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
|
|
@@ -8243,10 +8274,11 @@ static void ImGui::NavUpdate()
|
|
|
g.NavMoveRequestFlags = ImGuiNavMoveFlags_None;
|
|
|
if (g.NavWindow && !g.NavWindowingTarget && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
|
|
{
|
|
|
- if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadLeft, ImGuiNavInput_KeyLeft_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Left; }
|
|
|
- if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadRight,ImGuiNavInput_KeyRight_,ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Right; }
|
|
|
- if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadUp, ImGuiNavInput_KeyUp_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Up; }
|
|
|
- if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadDown, ImGuiNavInput_KeyDown_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Down; }
|
|
|
+ const ImGuiInputReadMode read_mode = ImGuiInputReadMode_Repeat;
|
|
|
+ if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && (IsNavInputTest(ImGuiNavInput_DpadLeft, read_mode) || IsNavInputTest(ImGuiNavInput_KeyLeft_, read_mode))) { g.NavMoveDir = ImGuiDir_Left; }
|
|
|
+ if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && (IsNavInputTest(ImGuiNavInput_DpadRight, read_mode) || IsNavInputTest(ImGuiNavInput_KeyRight_, read_mode))) { g.NavMoveDir = ImGuiDir_Right; }
|
|
|
+ if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && (IsNavInputTest(ImGuiNavInput_DpadUp, read_mode) || IsNavInputTest(ImGuiNavInput_KeyUp_, read_mode))) { g.NavMoveDir = ImGuiDir_Up; }
|
|
|
+ if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && (IsNavInputTest(ImGuiNavInput_DpadDown, read_mode) || IsNavInputTest(ImGuiNavInput_KeyDown_, read_mode))) { g.NavMoveDir = ImGuiDir_Down; }
|
|
|
}
|
|
|
g.NavMoveClipDir = g.NavMoveDir;
|
|
|
}
|
|
|
@@ -8541,7 +8573,7 @@ static void ImGui::NavUpdateWindowing()
|
|
|
}
|
|
|
|
|
|
// Start CTRL-TAB or Square+L/R window selection
|
|
|
- bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
|
|
+ bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputTest(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
|
|
bool start_windowing_with_keyboard = !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);
|
|
|
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
|
|
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
|
|
@@ -8560,7 +8592,7 @@ static void ImGui::NavUpdateWindowing()
|
|
|
g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f));
|
|
|
|
|
|
// Select window to focus
|
|
|
- const int focus_change_dir = (int)IsNavInputPressed(ImGuiNavInput_FocusPrev, ImGuiInputReadMode_RepeatSlow) - (int)IsNavInputPressed(ImGuiNavInput_FocusNext, ImGuiInputReadMode_RepeatSlow);
|
|
|
+ const int focus_change_dir = (int)IsNavInputTest(ImGuiNavInput_FocusPrev, ImGuiInputReadMode_RepeatSlow) - (int)IsNavInputTest(ImGuiNavInput_FocusNext, ImGuiInputReadMode_RepeatSlow);
|
|
|
if (focus_change_dir != 0)
|
|
|
{
|
|
|
NavUpdateWindowingHighlightWindow(focus_change_dir);
|
|
|
@@ -8592,9 +8624,9 @@ static void ImGui::NavUpdateWindowing()
|
|
|
|
|
|
// Keyboard: Press and Release ALT to toggle menu layer
|
|
|
// 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
|
|
|
- if (IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Pressed))
|
|
|
+ if (IsNavInputTest(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Pressed))
|
|
|
g.NavWindowingToggleLayer = true;
|
|
|
- if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && g.NavWindowingToggleLayer && IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released))
|
|
|
+ if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && g.NavWindowingToggleLayer && IsNavInputTest(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released))
|
|
|
if (IsMousePosValid(&g.IO.MousePos) == IsMousePosValid(&g.IO.MousePosPrev))
|
|
|
apply_toggle_layer = true;
|
|
|
|
|
|
@@ -9609,6 +9641,20 @@ static void ImeSetInputScreenPosFn_DefaultImpl(int, int) {}
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
#ifndef IMGUI_DISABLE_METRICS_WINDOW
|
|
|
+// Avoid naming collision with imgui_demo.cpp's HelpMarker() for unity builds.
|
|
|
+static void MetricsHelpMarker(const char* desc)
|
|
|
+{
|
|
|
+ ImGui::TextDisabled("(?)");
|
|
|
+ if (ImGui::IsItemHovered())
|
|
|
+ {
|
|
|
+ ImGui::BeginTooltip();
|
|
|
+ ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
|
|
+ ImGui::TextUnformatted(desc);
|
|
|
+ ImGui::PopTextWrapPos();
|
|
|
+ ImGui::EndTooltip();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
{
|
|
|
if (!ImGui::Begin("Dear ImGui Metrics", p_open))
|
|
|
@@ -9892,6 +9938,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
// The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted.
|
|
|
if (ImGui::Button("Item Picker.."))
|
|
|
ImGui::DebugStartItemPicker();
|
|
|
+ ImGui::SameLine();
|
|
|
+ MetricsHelpMarker("Will call the IM_DEBUG_BREAK() macro to break in debugger.\nWarning: If you don't have a debugger attached, this will probably crash.");
|
|
|
|
|
|
ImGui::Checkbox("Show windows begin order", &show_windows_begin_order);
|
|
|
ImGui::Checkbox("Show windows rectangles", &show_windows_rects);
|