|
@@ -1,4 +1,4 @@
|
|
-// dear imgui, v1.89.6 WIP
|
|
|
|
|
|
+// dear imgui, v1.89.6
|
|
// (main code and documentation)
|
|
// (main code and documentation)
|
|
|
|
|
|
// Help:
|
|
// Help:
|
|
@@ -11,7 +11,7 @@
|
|
// - FAQ http://dearimgui.com/faq
|
|
// - FAQ http://dearimgui.com/faq
|
|
// - Homepage & latest https://github.com/ocornut/imgui
|
|
// - Homepage & latest https://github.com/ocornut/imgui
|
|
// - Releases & changelog https://github.com/ocornut/imgui/releases
|
|
// - Releases & changelog https://github.com/ocornut/imgui/releases
|
|
-// - Gallery https://github.com/ocornut/imgui/issues/5886 (please post your screenshots/video there!)
|
|
|
|
|
|
+// - Gallery https://github.com/ocornut/imgui/issues/6478 (please post your screenshots/video there!)
|
|
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
|
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
|
@@ -405,10 +405,11 @@ CODE
|
|
- likewise io.MousePos and GetMousePos() will use OS coordinates.
|
|
- likewise io.MousePos and GetMousePos() will use OS coordinates.
|
|
If you query mouse positions to interact with non-imgui coordinates you will need to offset them, e.g. subtract GetWindowViewport()->Pos.
|
|
If you query mouse positions to interact with non-imgui coordinates you will need to offset them, e.g. subtract GetWindowViewport()->Pos.
|
|
|
|
|
|
- - 2023/05/22 (1.86.6) - listbox: commented out obsolete/redirecting functions that were marked obsolete more than two years ago:
|
|
|
|
|
|
+ - 2023/05/30 (1.89.6) - backends: renamed "imgui_impl_sdlrenderer.cpp" to "imgui_impl_sdlrenderer2.cpp" and "imgui_impl_sdlrenderer.h" to "imgui_impl_sdlrenderer2.h". This is in prevision for the future release of SDL3.
|
|
|
|
+ - 2023/05/22 (1.89.6) - listbox: commented out obsolete/redirecting functions that were marked obsolete more than two years ago:
|
|
- ListBoxHeader() -> use BeginListBox() (note how two variants of ListBoxHeader() existed. Check commented versions in imgui.h for reference)
|
|
- ListBoxHeader() -> use BeginListBox() (note how two variants of ListBoxHeader() existed. Check commented versions in imgui.h for reference)
|
|
- ListBoxFooter() -> use EndListBox()
|
|
- ListBoxFooter() -> use EndListBox()
|
|
- - 2023/05/15 (1.86.6) - clipper: commented out obsolete redirection constructor 'ImGuiListClipper(int items_count, float items_height = -1.0f)' that was marked obsolete in 1.79. Use default constructor + clipper.Begin().
|
|
|
|
|
|
+ - 2023/05/15 (1.89.6) - clipper: commented out obsolete redirection constructor 'ImGuiListClipper(int items_count, float items_height = -1.0f)' that was marked obsolete in 1.79. Use default constructor + clipper.Begin().
|
|
- 2023/05/15 (1.89.6) - clipper: renamed ImGuiListClipper::ForceDisplayRangeByIndices() to ImGuiListClipper::IncludeRangeByIndices().
|
|
- 2023/05/15 (1.89.6) - clipper: renamed ImGuiListClipper::ForceDisplayRangeByIndices() to ImGuiListClipper::IncludeRangeByIndices().
|
|
- 2023/03/14 (1.89.4) - commented out redirecting enums/functions names that were marked obsolete two years ago:
|
|
- 2023/03/14 (1.89.4) - commented out redirecting enums/functions names that were marked obsolete two years ago:
|
|
- ImGuiSliderFlags_ClampOnInput -> use ImGuiSliderFlags_AlwaysClamp
|
|
- ImGuiSliderFlags_ClampOnInput -> use ImGuiSliderFlags_AlwaysClamp
|
|
@@ -5155,7 +5156,7 @@ void ImGui::EndFrame()
|
|
if (g.IO.SetPlatformImeDataFn && memcmp(ime_data, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0)
|
|
if (g.IO.SetPlatformImeDataFn && memcmp(ime_data, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0)
|
|
{
|
|
{
|
|
ImGuiViewport* viewport = FindViewportByID(g.PlatformImeViewport);
|
|
ImGuiViewport* viewport = FindViewportByID(g.PlatformImeViewport);
|
|
- IMGUI_DEBUG_LOG_IO("Calling io.SetPlatformImeDataFn(): WantVisible: %d, InputPos (%.2f,%.2f)\n", ime_data->WantVisible, ime_data->InputPos.x, ime_data->InputPos.y);
|
|
|
|
|
|
+ IMGUI_DEBUG_LOG_IO("[io] Calling io.SetPlatformImeDataFn(): WantVisible: %d, InputPos (%.2f,%.2f)\n", ime_data->WantVisible, ime_data->InputPos.x, ime_data->InputPos.y);
|
|
if (viewport == NULL)
|
|
if (viewport == NULL)
|
|
viewport = GetMainViewport();
|
|
viewport = GetMainViewport();
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
@@ -5588,11 +5589,14 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
|
|
|
|
|
// Process navigation-in immediately so NavInit can run on first frame
|
|
// Process navigation-in immediately so NavInit can run on first frame
|
|
// Can enter a child if (A) it has navigatable items or (B) it can be scrolled.
|
|
// Can enter a child if (A) it has navigatable items or (B) it can be scrolled.
|
|
|
|
+ const ImGuiID temp_id_for_activation = (id + 1);
|
|
|
|
+ if (g.ActiveId == temp_id_for_activation)
|
|
|
|
+ ClearActiveID();
|
|
if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavWindowHasScrollY))
|
|
if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavWindowHasScrollY))
|
|
{
|
|
{
|
|
FocusWindow(child_window);
|
|
FocusWindow(child_window);
|
|
NavInitWindow(child_window, false);
|
|
NavInitWindow(child_window, false);
|
|
- SetActiveID(id + 1, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item
|
|
|
|
|
|
+ SetActiveID(temp_id_for_activation, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item
|
|
g.ActiveIdSource = g.NavInputSource;
|
|
g.ActiveIdSource = g.NavInputSource;
|
|
}
|
|
}
|
|
return ret;
|
|
return ret;
|
|
@@ -6018,6 +6022,11 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
|
const float grip_hover_inner_size = IM_FLOOR(grip_draw_size * 0.75f);
|
|
const float grip_hover_inner_size = IM_FLOOR(grip_draw_size * 0.75f);
|
|
const float grip_hover_outer_size = g.IO.ConfigWindowsResizeFromEdges ? WINDOWS_HOVER_PADDING : 0.0f;
|
|
const float grip_hover_outer_size = g.IO.ConfigWindowsResizeFromEdges ? WINDOWS_HOVER_PADDING : 0.0f;
|
|
|
|
|
|
|
|
+ ImRect clamp_rect = visibility_rect;
|
|
|
|
+ const bool window_move_from_title_bar = g.IO.ConfigWindowsMoveFromTitleBarOnly && !(window->Flags & ImGuiWindowFlags_NoTitleBar);
|
|
|
|
+ if (window_move_from_title_bar)
|
|
|
|
+ clamp_rect.Min.y -= window->TitleBarHeight();
|
|
|
|
+
|
|
ImVec2 pos_target(FLT_MAX, FLT_MAX);
|
|
ImVec2 pos_target(FLT_MAX, FLT_MAX);
|
|
ImVec2 size_target(FLT_MAX, FLT_MAX);
|
|
ImVec2 size_target(FLT_MAX, FLT_MAX);
|
|
|
|
|
|
@@ -6064,8 +6073,8 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
|
{
|
|
{
|
|
// Resize from any of the four corners
|
|
// Resize from any of the four corners
|
|
// We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position
|
|
// We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position
|
|
- ImVec2 clamp_min = ImVec2(def.CornerPosN.x == 1.0f ? visibility_rect.Min.x : -FLT_MAX, def.CornerPosN.y == 1.0f ? visibility_rect.Min.y : -FLT_MAX);
|
|
|
|
- ImVec2 clamp_max = ImVec2(def.CornerPosN.x == 0.0f ? visibility_rect.Max.x : +FLT_MAX, def.CornerPosN.y == 0.0f ? visibility_rect.Max.y : +FLT_MAX);
|
|
|
|
|
|
+ ImVec2 clamp_min = ImVec2(def.CornerPosN.x == 1.0f ? clamp_rect.Min.x : -FLT_MAX, (def.CornerPosN.y == 1.0f || (def.CornerPosN.y == 0.0f && window_move_from_title_bar)) ? clamp_rect.Min.y : -FLT_MAX);
|
|
|
|
+ ImVec2 clamp_max = ImVec2(def.CornerPosN.x == 0.0f ? clamp_rect.Max.x : +FLT_MAX, def.CornerPosN.y == 0.0f ? clamp_rect.Max.y : +FLT_MAX);
|
|
ImVec2 corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(def.InnerDir * grip_hover_outer_size, def.InnerDir * -grip_hover_inner_size, def.CornerPosN); // Corner of the window corresponding to our corner grip
|
|
ImVec2 corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(def.InnerDir * grip_hover_outer_size, def.InnerDir * -grip_hover_inner_size, def.CornerPosN); // Corner of the window corresponding to our corner grip
|
|
corner_target = ImClamp(corner_target, clamp_min, clamp_max);
|
|
corner_target = ImClamp(corner_target, clamp_min, clamp_max);
|
|
CalcResizePosSizeFromAnyCorner(window, corner_target, def.CornerPosN, &pos_target, &size_target);
|
|
CalcResizePosSizeFromAnyCorner(window, corner_target, def.CornerPosN, &pos_target, &size_target);
|
|
@@ -6094,8 +6103,8 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
|
}
|
|
}
|
|
if (held)
|
|
if (held)
|
|
{
|
|
{
|
|
- ImVec2 clamp_min(border_n == ImGuiDir_Right ? visibility_rect.Min.x : -FLT_MAX, border_n == ImGuiDir_Down ? visibility_rect.Min.y : -FLT_MAX);
|
|
|
|
- ImVec2 clamp_max(border_n == ImGuiDir_Left ? visibility_rect.Max.x : +FLT_MAX, border_n == ImGuiDir_Up ? visibility_rect.Max.y : +FLT_MAX);
|
|
|
|
|
|
+ ImVec2 clamp_min(border_n == ImGuiDir_Right ? clamp_rect.Min.x : -FLT_MAX, border_n == ImGuiDir_Down || (border_n == ImGuiDir_Up && window_move_from_title_bar) ? clamp_rect.Min.y : -FLT_MAX);
|
|
|
|
+ ImVec2 clamp_max(border_n == ImGuiDir_Left ? clamp_rect.Max.x : +FLT_MAX, border_n == ImGuiDir_Up ? clamp_rect.Max.y : +FLT_MAX);
|
|
ImVec2 border_target = window->Pos;
|
|
ImVec2 border_target = window->Pos;
|
|
border_target[axis] = g.IO.MousePos[axis] - g.ActiveIdClickOffset[axis] + WINDOWS_HOVER_PADDING;
|
|
border_target[axis] = g.IO.MousePos[axis] - g.ActiveIdClickOffset[axis] + WINDOWS_HOVER_PADDING;
|
|
border_target = ImClamp(border_target, clamp_min, clamp_max);
|
|
border_target = ImClamp(border_target, clamp_min, clamp_max);
|
|
@@ -6122,7 +6131,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
|
const float NAV_RESIZE_SPEED = 600.0f;
|
|
const float NAV_RESIZE_SPEED = 600.0f;
|
|
const float resize_step = NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y);
|
|
const float resize_step = NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y);
|
|
g.NavWindowingAccumDeltaSize += nav_resize_dir * resize_step;
|
|
g.NavWindowingAccumDeltaSize += nav_resize_dir * resize_step;
|
|
- g.NavWindowingAccumDeltaSize = ImMax(g.NavWindowingAccumDeltaSize, visibility_rect.Min - window->Pos - window->Size); // We need Pos+Size >= visibility_rect.Min, so Size >= visibility_rect.Min - Pos, so size_delta >= visibility_rect.Min - window->Pos - window->Size
|
|
|
|
|
|
+ g.NavWindowingAccumDeltaSize = ImMax(g.NavWindowingAccumDeltaSize, clamp_rect.Min - window->Pos - window->Size); // We need Pos+Size >= clmap_rect.Min, so Size >= clmap_rect.Min - Pos, so size_delta >= clmap_rect.Min - window->Pos - window->Size
|
|
g.NavWindowingToggleLayer = false;
|
|
g.NavWindowingToggleLayer = false;
|
|
g.NavDisableMouseHover = true;
|
|
g.NavDisableMouseHover = true;
|
|
resize_grip_col[0] = GetColorU32(ImGuiCol_ResizeGripActive);
|
|
resize_grip_col[0] = GetColorU32(ImGuiCol_ResizeGripActive);
|
|
@@ -8183,12 +8192,11 @@ void ImGui::SetItemDefaultFocus()
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
if (!window->Appearing)
|
|
if (!window->Appearing)
|
|
return;
|
|
return;
|
|
- if (g.NavWindow != window->RootWindowForNav || (!g.NavInitRequest && g.NavInitResultId == 0) || g.NavLayer != window->DC.NavLayerCurrent)
|
|
|
|
|
|
+ if (g.NavWindow != window->RootWindowForNav || (!g.NavInitRequest && g.NavInitResult.ID == 0) || g.NavLayer != window->DC.NavLayerCurrent)
|
|
return;
|
|
return;
|
|
|
|
|
|
g.NavInitRequest = false;
|
|
g.NavInitRequest = false;
|
|
- g.NavInitResultId = g.LastItemData.ID;
|
|
|
|
- g.NavInitResultRectRel = WindowRectAbsToRel(window, g.LastItemData.Rect);
|
|
|
|
|
|
+ NavApplyItemToResult(&g.NavInitResult);
|
|
NavUpdateAnyRequestFlag();
|
|
NavUpdateAnyRequestFlag();
|
|
|
|
|
|
// Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll)
|
|
// Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll)
|
|
@@ -9157,7 +9165,7 @@ static void LockWheelingWindow(ImGuiWindow* window, float wheel_amount)
|
|
g.WheelingWindowReleaseTimer = 0.0f;
|
|
g.WheelingWindowReleaseTimer = 0.0f;
|
|
if (g.WheelingWindow == window)
|
|
if (g.WheelingWindow == window)
|
|
return;
|
|
return;
|
|
- IMGUI_DEBUG_LOG_IO("LockWheelingWindow() \"%s\"\n", window ? window->Name : "NULL");
|
|
|
|
|
|
+ IMGUI_DEBUG_LOG_IO("[io] LockWheelingWindow() \"%s\"\n", window ? window->Name : "NULL");
|
|
g.WheelingWindow = window;
|
|
g.WheelingWindow = window;
|
|
g.WheelingWindowRefMousePos = g.IO.MousePos;
|
|
g.WheelingWindowRefMousePos = g.IO.MousePos;
|
|
if (window == NULL)
|
|
if (window == NULL)
|
|
@@ -9321,13 +9329,13 @@ static const char* GetMouseSourceName(ImGuiMouseSource source)
|
|
static void DebugPrintInputEvent(const char* prefix, const ImGuiInputEvent* e)
|
|
static void DebugPrintInputEvent(const char* prefix, const ImGuiInputEvent* e)
|
|
{
|
|
{
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
- if (e->Type == ImGuiInputEventType_MousePos) { if (e->MousePos.PosX == -FLT_MAX && e->MousePos.PosY == -FLT_MAX) IMGUI_DEBUG_LOG_IO("%s: MousePos (-FLT_MAX, -FLT_MAX)\n", prefix); else IMGUI_DEBUG_LOG_IO("%s: MousePos (%.1f, %.1f) (%s)\n", prefix, e->MousePos.PosX, e->MousePos.PosY, GetMouseSourceName(e->MouseWheel.MouseSource)); return; }
|
|
|
|
- if (e->Type == ImGuiInputEventType_MouseButton) { IMGUI_DEBUG_LOG_IO("%s: MouseButton %d %s (%s)\n", prefix, e->MouseButton.Button, e->MouseButton.Down ? "Down" : "Up", GetMouseSourceName(e->MouseWheel.MouseSource)); return; }
|
|
|
|
- if (e->Type == ImGuiInputEventType_MouseWheel) { IMGUI_DEBUG_LOG_IO("%s: MouseWheel (%.3f, %.3f) (%s)\n", prefix, e->MouseWheel.WheelX, e->MouseWheel.WheelY, GetMouseSourceName(e->MouseWheel.MouseSource)); return; }
|
|
|
|
- if (e->Type == ImGuiInputEventType_MouseViewport){IMGUI_DEBUG_LOG_IO("%s: MouseViewport (0x%08X)\n", prefix, e->MouseViewport.HoveredViewportID); return; }
|
|
|
|
- if (e->Type == ImGuiInputEventType_Key) { IMGUI_DEBUG_LOG_IO("%s: Key \"%s\" %s\n", prefix, ImGui::GetKeyName(e->Key.Key), e->Key.Down ? "Down" : "Up"); return; }
|
|
|
|
- if (e->Type == ImGuiInputEventType_Text) { IMGUI_DEBUG_LOG_IO("%s: Text: %c (U+%08X)\n", prefix, e->Text.Char, e->Text.Char); return; }
|
|
|
|
- if (e->Type == ImGuiInputEventType_Focus) { IMGUI_DEBUG_LOG_IO("%s: AppFocused %d\n", prefix, e->AppFocused.Focused); return; }
|
|
|
|
|
|
+ if (e->Type == ImGuiInputEventType_MousePos) { if (e->MousePos.PosX == -FLT_MAX && e->MousePos.PosY == -FLT_MAX) IMGUI_DEBUG_LOG_IO("[io] %s: MousePos (-FLT_MAX, -FLT_MAX)\n", prefix); else IMGUI_DEBUG_LOG_IO("[io] %s: MousePos (%.1f, %.1f) (%s)\n", prefix, e->MousePos.PosX, e->MousePos.PosY, GetMouseSourceName(e->MouseWheel.MouseSource)); return; }
|
|
|
|
+ if (e->Type == ImGuiInputEventType_MouseButton) { IMGUI_DEBUG_LOG_IO("[io] %s: MouseButton %d %s (%s)\n", prefix, e->MouseButton.Button, e->MouseButton.Down ? "Down" : "Up", GetMouseSourceName(e->MouseWheel.MouseSource)); return; }
|
|
|
|
+ if (e->Type == ImGuiInputEventType_MouseWheel) { IMGUI_DEBUG_LOG_IO("[io] %s: MouseWheel (%.3f, %.3f) (%s)\n", prefix, e->MouseWheel.WheelX, e->MouseWheel.WheelY, GetMouseSourceName(e->MouseWheel.MouseSource)); return; }
|
|
|
|
+ if (e->Type == ImGuiInputEventType_MouseViewport){IMGUI_DEBUG_LOG_IO("[io] %s: MouseViewport (0x%08X)\n", prefix, e->MouseViewport.HoveredViewportID); return; }
|
|
|
|
+ if (e->Type == ImGuiInputEventType_Key) { IMGUI_DEBUG_LOG_IO("[io] %s: Key \"%s\" %s\n", prefix, ImGui::GetKeyName(e->Key.Key), e->Key.Down ? "Down" : "Up"); return; }
|
|
|
|
+ if (e->Type == ImGuiInputEventType_Text) { IMGUI_DEBUG_LOG_IO("[io] %s: Text: %c (U+%08X)\n", prefix, e->Text.Char, e->Text.Char); return; }
|
|
|
|
+ if (e->Type == ImGuiInputEventType_Focus) { IMGUI_DEBUG_LOG_IO("[io] %s: AppFocused %d\n", prefix, e->AppFocused.Focused); return; }
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -11540,10 +11548,9 @@ static void ImGui::NavProcessItem()
|
|
{
|
|
{
|
|
// Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback
|
|
// Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback
|
|
const bool candidate_for_nav_default_focus = (item_flags & ImGuiItemFlags_NoNavDefaultFocus) == 0;
|
|
const bool candidate_for_nav_default_focus = (item_flags & ImGuiItemFlags_NoNavDefaultFocus) == 0;
|
|
- if (candidate_for_nav_default_focus || g.NavInitResultId == 0)
|
|
|
|
|
|
+ if (candidate_for_nav_default_focus || g.NavInitResult.ID == 0)
|
|
{
|
|
{
|
|
- g.NavInitResultId = id;
|
|
|
|
- g.NavInitResultRectRel = WindowRectAbsToRel(window, nav_bb);
|
|
|
|
|
|
+ NavApplyItemToResult(&g.NavInitResult);
|
|
}
|
|
}
|
|
if (candidate_for_nav_default_focus)
|
|
if (candidate_for_nav_default_focus)
|
|
{
|
|
{
|
|
@@ -11805,8 +11812,7 @@ void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit)
|
|
SetNavID(0, g.NavLayer, window->NavRootFocusScopeId, ImRect());
|
|
SetNavID(0, g.NavLayer, window->NavRootFocusScopeId, ImRect());
|
|
g.NavInitRequest = true;
|
|
g.NavInitRequest = true;
|
|
g.NavInitRequestFromMove = false;
|
|
g.NavInitRequestFromMove = false;
|
|
- g.NavInitResultId = 0;
|
|
|
|
- g.NavInitResultRectRel = ImRect();
|
|
|
|
|
|
+ g.NavInitResult.ID = 0;
|
|
NavUpdateAnyRequestFlag();
|
|
NavUpdateAnyRequestFlag();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -11891,12 +11897,12 @@ static void ImGui::NavUpdate()
|
|
g.NavInputSource = ImGuiInputSource_Keyboard;
|
|
g.NavInputSource = ImGuiInputSource_Keyboard;
|
|
|
|
|
|
// Process navigation init request (select first/default focus)
|
|
// Process navigation init request (select first/default focus)
|
|
- if (g.NavInitResultId != 0)
|
|
|
|
|
|
+ g.NavJustMovedToId = 0;
|
|
|
|
+ if (g.NavInitResult.ID != 0)
|
|
NavInitRequestApplyResult();
|
|
NavInitRequestApplyResult();
|
|
g.NavInitRequest = false;
|
|
g.NavInitRequest = false;
|
|
g.NavInitRequestFromMove = false;
|
|
g.NavInitRequestFromMove = false;
|
|
- g.NavInitResultId = 0;
|
|
|
|
- g.NavJustMovedToId = 0;
|
|
|
|
|
|
+ g.NavInitResult.ID = 0;
|
|
|
|
|
|
// Process navigation move request
|
|
// Process navigation move request
|
|
if (g.NavMoveSubmitted)
|
|
if (g.NavMoveSubmitted)
|
|
@@ -12036,10 +12042,18 @@ void ImGui::NavInitRequestApplyResult()
|
|
if (!g.NavWindow)
|
|
if (!g.NavWindow)
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ ImGuiNavItemData* result = &g.NavInitResult;
|
|
|
|
+ if (g.NavId != result->ID)
|
|
|
|
+ {
|
|
|
|
+ g.NavJustMovedToId = result->ID;
|
|
|
|
+ g.NavJustMovedToFocusScopeId = result->FocusScopeId;
|
|
|
|
+ g.NavJustMovedToKeyMods = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
// Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called)
|
|
// Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called)
|
|
// FIXME-NAV: On _NavFlattened windows, g.NavWindow will only be updated during subsequent frame. Not a problem currently.
|
|
// FIXME-NAV: On _NavFlattened windows, g.NavWindow will only be updated during subsequent frame. Not a problem currently.
|
|
- IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: ApplyResult: NavID 0x%08X in Layer %d Window \"%s\"\n", g.NavInitResultId, g.NavLayer, g.NavWindow->Name);
|
|
|
|
- SetNavID(g.NavInitResultId, g.NavLayer, 0, g.NavInitResultRectRel);
|
|
|
|
|
|
+ IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: ApplyResult: NavID 0x%08X in Layer %d Window \"%s\"\n", result->ID, g.NavLayer, g.NavWindow->Name);
|
|
|
|
+ SetNavID(result->ID, g.NavLayer, result->FocusScopeId, result->RectRel);
|
|
g.NavIdIsAlive = true; // Mark as alive from previous frame as we got a result
|
|
g.NavIdIsAlive = true; // Mark as alive from previous frame as we got a result
|
|
if (g.NavInitRequestFromMove)
|
|
if (g.NavInitRequestFromMove)
|
|
NavRestoreHighlightAfterMove();
|
|
NavRestoreHighlightAfterMove();
|
|
@@ -12138,7 +12152,7 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|
{
|
|
{
|
|
IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", window ? window->Name : "<NULL>", g.NavLayer);
|
|
IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", window ? window->Name : "<NULL>", g.NavLayer);
|
|
g.NavInitRequest = g.NavInitRequestFromMove = true;
|
|
g.NavInitRequest = g.NavInitRequestFromMove = true;
|
|
- g.NavInitResultId = 0;
|
|
|
|
|
|
+ g.NavInitResult.ID = 0;
|
|
g.NavDisableHighlight = false;
|
|
g.NavDisableHighlight = false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -18948,7 +18962,7 @@ void ImGui::DebugRenderKeyboardPreview(ImDrawList* draw_list)
|
|
draw_list->AddRectFilled(face_min, face_max, IM_COL32(252, 252, 252, 255), key_face_rounding);
|
|
draw_list->AddRectFilled(face_min, face_max, IM_COL32(252, 252, 252, 255), key_face_rounding);
|
|
ImVec2 label_min = ImVec2(key_min.x + key_label_pos.x, key_min.y + key_label_pos.y);
|
|
ImVec2 label_min = ImVec2(key_min.x + key_label_pos.x, key_min.y + key_label_pos.y);
|
|
draw_list->AddText(label_min, IM_COL32(64, 64, 64, 255), key_data->Label);
|
|
draw_list->AddText(label_min, IM_COL32(64, 64, 64, 255), key_data->Label);
|
|
- if (ImGui::IsKeyDown(key_data->Key))
|
|
|
|
|
|
+ if (IsKeyDown(key_data->Key))
|
|
draw_list->AddRectFilled(key_min, key_max, IM_COL32(255, 0, 0, 128), key_rounding);
|
|
draw_list->AddRectFilled(key_min, key_max, IM_COL32(255, 0, 0, 128), key_rounding);
|
|
}
|
|
}
|
|
draw_list->PopClipRect();
|
|
draw_list->PopClipRect();
|
|
@@ -19983,8 +19997,7 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
|
|
char* p = buf;
|
|
char* p = buf;
|
|
const char* buf_end = buf + IM_ARRAYSIZE(buf);
|
|
const char* buf_end = buf + IM_ARRAYSIZE(buf);
|
|
const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
|
|
const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
|
|
- p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
|
|
|
|
- p += ImFormatString(p, buf_end - p, " { ");
|
|
|
|
|
|
+ p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s {", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
|
|
for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++)
|
|
for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++)
|
|
{
|
|
{
|
|
ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
|
|
ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
|