mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-22 23:35:36 +00:00
This commit is contained in:
20
imgui.cpp
20
imgui.cpp
@@ -8605,7 +8605,7 @@ ImGuiKeyRoutingData* ImGui::GetShortcutRoutingData(ImGuiKeyChord key_chord)
|
||||
|
||||
// Current score encoding (lower is highest priority):
|
||||
// - 0: ImGuiInputFlags_RouteGlobalHighest
|
||||
// - 1: ImGuiInputFlags_RouteFocused (if item active)
|
||||
// - 1: ImGuiInputFlags_ActiveItem or ImGuiInputFlags_RouteFocused (if item active)
|
||||
// - 2: ImGuiInputFlags_RouteGlobalOverFocused
|
||||
// - 3+: ImGuiInputFlags_RouteFocused (if window in focus-stack)
|
||||
// - 254: ImGuiInputFlags_RouteGlobal
|
||||
@@ -8613,10 +8613,9 @@ ImGuiKeyRoutingData* ImGui::GetShortcutRoutingData(ImGuiKeyChord key_chord)
|
||||
// 'flags' should include an explicit routing policy
|
||||
static int CalcRoutingScore(ImGuiID focus_scope_id, ImGuiID owner_id, ImGuiInputFlags flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (flags & ImGuiInputFlags_RouteFocused)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
// ActiveID gets top priority
|
||||
// (we don't check g.ActiveIdUsingAllKeys here. Routing is applied but if input ownership is tested later it may discard it)
|
||||
if (owner_id != 0 && g.ActiveId == owner_id)
|
||||
@@ -8637,12 +8636,18 @@ static int CalcRoutingScore(ImGuiID focus_scope_id, ImGuiID owner_id, ImGuiInput
|
||||
|
||||
return 255;
|
||||
}
|
||||
|
||||
// ImGuiInputFlags_RouteGlobalHighest is default, so calls without flags are not conditional
|
||||
if (flags & ImGuiInputFlags_RouteActiveItem)
|
||||
{
|
||||
if (owner_id != 0 && g.ActiveId == owner_id)
|
||||
return 1;
|
||||
return 255;
|
||||
}
|
||||
if (flags & ImGuiInputFlags_RouteGlobalOverFocused)
|
||||
return 2;
|
||||
if (flags & ImGuiInputFlags_RouteGlobal)
|
||||
return 254;
|
||||
|
||||
// ImGuiInputFlags_RouteGlobalHighest is default, so calls without flags are not conditional
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8693,7 +8698,7 @@ bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiInputFlags flags, I
|
||||
return true;
|
||||
}
|
||||
|
||||
// Specific culling when there's an active.
|
||||
// Specific culling when there's an active item.
|
||||
if (g.ActiveId != 0 && g.ActiveId != owner_id)
|
||||
{
|
||||
// Cull shortcuts with no modifiers when it could generate a character.
|
||||
@@ -8707,6 +8712,9 @@ bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiInputFlags flags, I
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flags & ImGuiInputFlags_RouteActiveItem)
|
||||
return false;
|
||||
|
||||
// ActiveIdUsingAllKeyboardKeys trumps all for ActiveId
|
||||
if ((flags & ImGuiInputFlags_RouteGlobalHighest) == 0 && g.ActiveIdUsingAllKeyboardKeys)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user