mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 04:28:47 +02:00
Nav: Disabled items are not candidate for default focus. (#211, #787) + simplify handling of ImGuiButtonFlags_PressedOnDragDropHold path.
This commit is contained in:
@ -8846,12 +8846,13 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con
|
||||
if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent)
|
||||
{
|
||||
// Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback
|
||||
if (!(item_flags & ImGuiItemFlags_NoNavDefaultFocus) || g.NavInitResultId == 0)
|
||||
const bool candidate_for_nav_default_focus = (item_flags & (ImGuiItemFlags_NoNavDefaultFocus | ImGuiItemFlags_Disabled)) == 0;
|
||||
if (candidate_for_nav_default_focus || g.NavInitResultId == 0)
|
||||
{
|
||||
g.NavInitResultId = id;
|
||||
g.NavInitResultRectRel = nav_bb_rel;
|
||||
}
|
||||
if (!(item_flags & ImGuiItemFlags_NoNavDefaultFocus))
|
||||
if (candidate_for_nav_default_focus)
|
||||
{
|
||||
g.NavInitRequest = false; // Found a match, clear request
|
||||
NavUpdateAnyRequestFlag();
|
||||
@ -11246,7 +11247,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]);
|
||||
Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
|
||||
Text("ActiveIdUsing: Wheel: %d, NavDirMask: %X, NavInputMask: %X, KeyInputMask: %llX", g.ActiveIdUsingMouseWheel, g.ActiveIdUsingNavDirMask, g.ActiveIdUsingNavInputMask, g.ActiveIdUsingKeyInputMask);
|
||||
Text("HoveredId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not
|
||||
Text("HoveredId: 0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Not displaying g.HoveredId as it is update mid-frame
|
||||
Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
||||
Unindent();
|
||||
|
||||
|
Reference in New Issue
Block a user