MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / TestKeyOwner

Method TestKeyOwner

KBotExt/imgui/imgui.cpp:8994–9020  ·  view source on GitHub ↗

TestKeyOwner(..., ID) : (owner == None || owner == ID) TestKeyOwner(..., None) : (owner == None) TestKeyOwner(..., Any) : no owner test All paths are also testing for key not being locked, for the rare cases that key have been locked with using ImGuiInputFlags_LockXXX flags.

Source from the content-addressed store, hash-verified

8992// TestKeyOwner(..., Any) : no owner test
8993// All paths are also testing for key not being locked, for the rare cases that key have been locked with using ImGuiInputFlags_LockXXX flags.
8994bool ImGui::TestKeyOwner(ImGuiKey key, ImGuiID owner_id)
8995{
8996 if (!IsNamedKeyOrModKey(key))
8997 return true;
8998
8999 ImGuiContext& g = *GImGui;
9000 if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId && owner_id != ImGuiKeyOwner_Any)
9001 if (key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END)
9002 return false;
9003
9004 ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key);
9005 if (owner_id == ImGuiKeyOwner_Any)
9006 return (owner_data->LockThisFrame == false);
9007
9008 // Note: SetKeyOwner() sets OwnerCurr. It is not strictly required for most mouse routing overlap (because of ActiveId/HoveredId
9009 // are acting as filter before this has a chance to filter), but sane as soon as user tries to look into things.
9010 // Setting OwnerCurr in SetKeyOwner() is more consistent than testing OwnerNext here: would be inconsistent with getter and other functions.
9011 if (owner_data->OwnerCurr != owner_id)
9012 {
9013 if (owner_data->LockThisFrame)
9014 return false;
9015 if (owner_data->OwnerCurr != ImGuiKeyOwner_None)
9016 return false;
9017 }
9018
9019 return true;
9020}
9021
9022// _LockXXX flags are useful to lock keys away from code which is not input-owner aware.
9023// When using _LockXXX flags, you can use ImGuiKeyOwner_Any to lock keys from everyone.

Callers

nothing calls this directly

Calls 2

IsNamedKeyOrModKeyFunction · 0.85
GetKeyOwnerDataFunction · 0.85

Tested by

no test coverage detected