mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-06 21:37:46 +00:00
Shortcuts: rename ImGuiInputFlags_RouteGlobalHighest to ImGuiInputFlags_RouteGlobalOverActive, made ImGuiInputFlags_RouteGlobalOverFocused and ImGuiInputFlags_RouteGlobalOverActive flags. (#456)
This commit is contained in:
13
imgui.cpp
13
imgui.cpp
@@ -8604,7 +8604,7 @@ ImGuiKeyRoutingData* ImGui::GetShortcutRoutingData(ImGuiKeyChord key_chord)
|
||||
}
|
||||
|
||||
// Current score encoding (lower is highest priority):
|
||||
// - 0: ImGuiInputFlags_RouteGlobalHighest
|
||||
// - 0: ImGuiInputFlags_RouteGlobalOverActive
|
||||
// - 1: ImGuiInputFlags_ActiveItem or ImGuiInputFlags_RouteFocused (if item active)
|
||||
// - 2: ImGuiInputFlags_RouteGlobalOverFocused
|
||||
// - 3+: ImGuiInputFlags_RouteFocused (if window in focus-stack)
|
||||
@@ -8646,8 +8646,9 @@ static int CalcRoutingScore(ImGuiID focus_scope_id, ImGuiID owner_id, ImGuiInput
|
||||
return 2;
|
||||
if (flags & ImGuiInputFlags_RouteGlobal)
|
||||
return 254;
|
||||
|
||||
// ImGuiInputFlags_RouteGlobalHighest is default, so calls without flags are not conditional
|
||||
if (flags & ImGuiInputFlags_RouteGlobalOverActive)
|
||||
return 0;
|
||||
IM_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8677,6 +8678,8 @@ static bool IsKeyChordPotentiallyCharInput(ImGuiKeyChord key_chord)
|
||||
bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiInputFlags flags, ImGuiID owner_id)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (flags & (ImGuiInputFlags_RouteGlobalOverFocused | ImGuiInputFlags_RouteGlobalOverActive))
|
||||
flags |= ImGuiInputFlags_RouteGlobal;
|
||||
IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiInputFlags_RouteTypeMask_)); // Check that only 1 routing flag is used
|
||||
IM_ASSERT(owner_id != ImGuiKeyOwner_Any && owner_id != ImGuiKeyOwner_NoOwner);
|
||||
|
||||
@@ -8716,7 +8719,7 @@ bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiInputFlags flags, I
|
||||
return false;
|
||||
|
||||
// ActiveIdUsingAllKeyboardKeys trumps all for ActiveId
|
||||
if ((flags & ImGuiInputFlags_RouteGlobalHighest) == 0 && g.ActiveIdUsingAllKeyboardKeys)
|
||||
if ((flags & ImGuiInputFlags_RouteGlobalOverActive) == 0 && g.ActiveIdUsingAllKeyboardKeys)
|
||||
{
|
||||
ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_);
|
||||
if (key == ImGuiKey_None)
|
||||
@@ -12870,7 +12873,7 @@ static void ImGui::NavUpdateWindowing()
|
||||
g.NavWindowingToggleLayer = start_windowing_with_gamepad ? true : false; // Gamepad starts toggling layer
|
||||
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad;
|
||||
|
||||
// Manually register ownership of our mods. Using ImGuiInputFlags_RouteGlobalHighest in the Shortcut() calls instead would probably be correct but may have more side-effects.
|
||||
// Manually register ownership of our mods. Using a global route in the Shortcut() calls instead would probably be correct but may have more side-effects.
|
||||
if (keyboard_next_window || keyboard_prev_window)
|
||||
SetKeyOwnersForKeyChord((g.ConfigNavWindowingKeyNext | g.ConfigNavWindowingKeyPrev) & ImGuiMod_Mask_, owner_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user