Skip to content

Commit

Permalink
Shortcuts: claim mods ownership once pressed. (#456, #2637, #2620, #2891
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed May 23, 2024
1 parent 1002cfa commit c150ad5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c150ad5

Please sign in to comment.