MCPcopy Create free account
hub / github.com/RenderKit/embree / SetKeyOwner

Method SetKeyOwner

tutorials/common/imgui/imgui.cpp:8599–8611  ·  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

Source from the content-addressed store, hash-verified

8597// - SetKeyOwner(..., Any, !Lock) : illegal (assert)
8598// - SetKeyOwner(..., Any or None, Lock) : set lock
8599void ImGui::SetKeyOwner(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags)
8600{
8601 IM_ASSERT(IsNamedKeyOrModKey(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)
8602 IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetKeyOwner) == 0); // Passing flags not supported by this function!
8603
8604 ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(key);
8605 owner_data->OwnerCurr = owner_data->OwnerNext = owner_id;
8606
8607 // We cannot lock by default as it would likely break lots of legacy code.
8608 // In the case of using LockUntilRelease while key is not down we still lock during the frame (no key_data->Down test)
8609 owner_data->LockUntilRelease = (flags & ImGuiInputFlags_LockUntilRelease) != 0;
8610 owner_data->LockThisFrame = (flags & ImGuiInputFlags_LockThisFrame) != 0 || (owner_data->LockUntilRelease);
8611}
8612
8613// This is more or less equivalent to:
8614// if (IsItemHovered() || IsItemActive())

Callers

nothing calls this directly

Calls 2

IsNamedKeyOrModKeyFunction · 0.85
GetKeyOwnerDataFunction · 0.85

Tested by

no test coverage detected