MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / SetKeyOwner

Method SetKeyOwner

include/imgui/imgui.cpp:10688–10702  ·  view source on GitHub ↗

_LockXXX flags are useful to lock keys away from code which is not input-owner aware. When using _LockXXX flags, you can use ImGuiKeyOwner_Any to lock keys from everyone. - SetKeyOwner(..., None) : clears owner - SetKeyOwner(..., Any, !Lock) : illegal (assert) - SetKeyOwner(..., Any or None, Lock) : set lock Ownership is automatically released on the frame after a release, see

Source from the content-addressed store, hash-verified

10686// - SetKeyOwner(..., Any or None, Lock) : set lock
10687// Ownership is automatically released on the frame after a release, see code in UpdateKeyboardInputs().
10688void ImGui::SetKeyOwner(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags)
10689{
10690 ImGuiContext& g = *GImGui;
10691 IM_ASSERT(IsNamedKeyOrMod(key) && (owner_id != ImGuiKeyOwner_Any || (flags & (ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease)))); // Can only use _Any with _LockXXX flags (to eat a key away without an ID to retrieve it)
10692 IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetKeyOwner) == 0); // Passing flags not supported by this function!
10693 //IMGUI_DEBUG_LOG("SetKeyOwner(%s, owner_id=0x%08X, flags=%08X)\n", GetKeyName(key), owner_id, flags);
10694
10695 ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key);
10696 owner_data->OwnerCurr = owner_data->OwnerNext = owner_id;
10697
10698 // We cannot lock by default as it would likely break lots of legacy code.
10699 // In the case of using LockUntilRelease while key is not down we still lock during the frame (no key_data->Down test)
10700 owner_data->LockUntilRelease = (flags & ImGuiInputFlags_LockUntilRelease) != 0;
10701 owner_data->LockThisFrame = (flags & ImGuiInputFlags_LockThisFrame) != 0 || (owner_data->LockUntilRelease);
10702}
10703
10704// Rarely used helper
10705void ImGui::SetKeyOwnersForKeyChord(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags)

Callers

nothing calls this directly

Calls 2

IsNamedKeyOrModFunction · 0.85
GetKeyOwnerDataFunction · 0.85

Tested by

no test coverage detected