Inputs: fixed an issue using SetKeyOwner() with ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease on ImGuiMod values. (#9323)

This commit is contained in:
ocornut
2026-03-25 22:00:14 +01:00
parent e9eb04ea95
commit b62cf3894b

View File

@@ -10078,11 +10078,12 @@ static void UpdateAliasKey(ImGuiKey key, bool v, float analog_value)
// [Internal] Do not use directly
static ImGuiKeyChord GetMergedModsFromKeys()
{
// Bypass IsKeyDown() for the unlikely case where user used a ImGuiInputFlags_LockXXXX on those.
ImGuiKeyChord mods = 0;
if (ImGui::IsKeyDown(ImGuiMod_Ctrl)) { mods |= ImGuiMod_Ctrl; }
if (ImGui::IsKeyDown(ImGuiMod_Shift)) { mods |= ImGuiMod_Shift; }
if (ImGui::IsKeyDown(ImGuiMod_Alt)) { mods |= ImGuiMod_Alt; }
if (ImGui::IsKeyDown(ImGuiMod_Super)) { mods |= ImGuiMod_Super; }
if (ImGui::GetKeyData(ImGuiMod_Ctrl)->Down) { mods |= ImGuiMod_Ctrl; }
if (ImGui::GetKeyData(ImGuiMod_Shift)->Down) { mods |= ImGuiMod_Shift; }
if (ImGui::GetKeyData(ImGuiMod_Alt)->Down) { mods |= ImGuiMod_Alt; }
if (ImGui::GetKeyData(ImGuiMod_Super)->Down) { mods |= ImGuiMod_Super; }
return mods;
}