From b62cf3894bc971a1aa8a8bb4006bd502491a06a0 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 25 Mar 2026 22:00:14 +0100 Subject: [PATCH] Inputs: fixed an issue using SetKeyOwner() with ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease on ImGuiMod values. (#9323) --- imgui.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index a10d0a0c2..353eda54b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -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; }