From c150ad50c46b30e80b7c667c3a88b9d0616269d9 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 23 May 2024 18:14:16 +0200 Subject: [PATCH] Shortcuts: claim mods ownership once pressed. (#456, #2637, #2620, #2891, #3370, #3724, #4828, #5108, #5242, #5641) --- imgui.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 8e7a677d1c34..76a506d6d7a8 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9743,6 +9743,10 @@ bool ImGui::Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags, ImGuiID own if (!IsKeyChordPressed(key_chord, flags, owner_id)) return false; + + // Claim mods during the press + SetKeyOwnersForKeyChord(key_chord & ImGuiMod_Mask_, owner_id); + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedByShortcut) == 0); // Passing flags not supported by this function! return true; }