|
|
@ -9258,21 +9258,22 @@ static int CalcRoutingScore(ImGuiID focus_scope_id, ImGuiID owner_id, ImGuiInput |
|
|
|
for (int index_in_focus_path = 0; index_in_focus_path < g.NavFocusRoute.Size; index_in_focus_path++) |
|
|
|
for (int index_in_focus_path = 0; index_in_focus_path < g.NavFocusRoute.Size; index_in_focus_path++) |
|
|
|
if (g.NavFocusRoute.Data[index_in_focus_path].ID == focus_scope_id) |
|
|
|
if (g.NavFocusRoute.Data[index_in_focus_path].ID == focus_scope_id) |
|
|
|
return 3 + index_in_focus_path; |
|
|
|
return 3 + index_in_focus_path; |
|
|
|
|
|
|
|
|
|
|
|
return 255; |
|
|
|
return 255; |
|
|
|
} |
|
|
|
} |
|
|
|
if (flags & ImGuiInputFlags_RouteActive) |
|
|
|
else if (flags & ImGuiInputFlags_RouteActive) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (owner_id != 0 && g.ActiveId == owner_id) |
|
|
|
if (owner_id != 0 && g.ActiveId == owner_id) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
return 255; |
|
|
|
return 255; |
|
|
|
} |
|
|
|
} |
|
|
|
if (flags & ImGuiInputFlags_RouteOverFocused) |
|
|
|
else if (flags & ImGuiInputFlags_RouteGlobal) |
|
|
|
return 2; |
|
|
|
{ |
|
|
|
if (flags & ImGuiInputFlags_RouteGlobal) |
|
|
|
if (flags & ImGuiInputFlags_RouteOverActive) |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
if (flags & ImGuiInputFlags_RouteOverFocused) |
|
|
|
|
|
|
|
return 2; |
|
|
|
return 254; |
|
|
|
return 254; |
|
|
|
if (flags & ImGuiInputFlags_RouteOverActive) |
|
|
|
} |
|
|
|
return 0; |
|
|
|
|
|
|
|
IM_ASSERT(0); |
|
|
|
IM_ASSERT(0); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -9329,20 +9330,20 @@ bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiInputFlags flags, I |
|
|
|
// Specific culling when there's an active item.
|
|
|
|
// Specific culling when there's an active item.
|
|
|
|
if (g.ActiveId != 0 && g.ActiveId != owner_id) |
|
|
|
if (g.ActiveId != 0 && g.ActiveId != owner_id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (flags & ImGuiInputFlags_RouteActive) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
// Cull shortcuts with no modifiers when it could generate a character.
|
|
|
|
// Cull shortcuts with no modifiers when it could generate a character.
|
|
|
|
// e.g. Shortcut(ImGuiKey_G) also generates 'g' character, should not trigger when InputText() is active.
|
|
|
|
// e.g. Shortcut(ImGuiKey_G) also generates 'g' character, should not trigger when InputText() is active.
|
|
|
|
// but Shortcut(Ctrl+G) should generally trigger when InputText() is active.
|
|
|
|
// but Shortcut(Ctrl+G) should generally trigger when InputText() is active.
|
|
|
|
// TL;DR: lettered shortcut with no mods or with only Alt mod will not trigger while an item reading text input is active.
|
|
|
|
// TL;DR: lettered shortcut with no mods or with only Alt mod will not trigger while an item reading text input is active.
|
|
|
|
// (We cannot filter based on io.InputQueueCharacters[] contents because of trickling and key<>chars submission order are undefined)
|
|
|
|
// (We cannot filter based on io.InputQueueCharacters[] contents because of trickling and key<>chars submission order are undefined)
|
|
|
|
if ((flags & ImGuiInputFlags_RouteFocused) && g.IO.WantTextInput && IsKeyChordPotentiallyCharInput(key_chord)) |
|
|
|
if (g.IO.WantTextInput && IsKeyChordPotentiallyCharInput(key_chord)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IMGUI_DEBUG_LOG_INPUTROUTING("SetShortcutRouting(%s, flags=%04X, owner_id=0x%08X) -> filtered as potential char input\n", GetKeyChordName(key_chord), flags, owner_id); |
|
|
|
IMGUI_DEBUG_LOG_INPUTROUTING("SetShortcutRouting(%s, flags=%04X, owner_id=0x%08X) -> filtered as potential char input\n", GetKeyChordName(key_chord), flags, owner_id); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (flags & ImGuiInputFlags_RouteActive) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ActiveIdUsingAllKeyboardKeys trumps all for ActiveId
|
|
|
|
// ActiveIdUsingAllKeyboardKeys trumps all for ActiveId
|
|
|
|
if ((flags & ImGuiInputFlags_RouteOverActive) == 0 && g.ActiveIdUsingAllKeyboardKeys) |
|
|
|
if ((flags & ImGuiInputFlags_RouteOverActive) == 0 && g.ActiveIdUsingAllKeyboardKeys) |
|
|
|
{ |
|
|
|
{ |
|
|
|