MCPcopy Create free account
hub / github.com/cinder/Cinder / IsKeyChordPotentiallyCharInput

Function IsKeyChordPotentiallyCharInput

src/imgui/imgui.cpp:9488–9504  ·  view source on GitHub ↗

- We need this to filter some Shortcut() routes when an item e.g. an InputText() is active e.g. ImGuiKey_G won't be considered a shortcut when item is active, but ImGuiMod|ImGuiKey_G can be. - This is also used by UpdateInputEvents() to avoid trickling in the most common case of e.g. pressing ImGuiKey_G also emitting a G character.

Source from the content-addressed store, hash-verified

9486// e.g. ImGuiKey_G won't be considered a shortcut when item is active, but ImGuiMod|ImGuiKey_G can be.
9487// - This is also used by UpdateInputEvents() to avoid trickling in the most common case of e.g. pressing ImGuiKey_G also emitting a G character.
9488static bool IsKeyChordPotentiallyCharInput(ImGuiKeyChord key_chord)
9489{
9490 // Mimic 'ignore_char_inputs' logic in InputText()
9491 ImGuiContext& g = *GImGui;
9492
9493 // When the right mods are pressed it cannot be a char input so we won't filter the shortcut out.
9494 ImGuiKey mods = (ImGuiKey)(key_chord & ImGuiMod_Mask_);
9495 const bool ignore_char_inputs = ((mods & ImGuiMod_Ctrl) && !(mods & ImGuiMod_Alt)) || (g.IO.ConfigMacOSXBehaviors && (mods & ImGuiMod_Ctrl));
9496 if (ignore_char_inputs)
9497 return false;
9498
9499 // Return true for A-Z, 0-9 and other keys associated to char inputs. Other keys such as F1-F12 won't be filtered.
9500 ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_);
9501 if (key == ImGuiKey_None)
9502 return false;
9503 return g.KeysMayBeCharInput.TestBit(key);
9504}
9505
9506// Request a desired route for an input chord (key + mods).
9507// Return true if the route is available this frame.

Callers 2

SetShortcutRoutingMethod · 0.85
UpdateInputEventsMethod · 0.85

Calls 1

TestBitMethod · 0.80

Tested by

no test coverage detected