key functionality changes

This commit is contained in:
rei-2 committed 2026-06-27 20:56:32 -04:00
1 parent ba5fe7dcd3
commit 7a0c9e4d5c
5 files changed
+33 -17

No files matched your search

+27 -13
View File
@@ -2085,22 +2085,35 @@ namespace ImGui
{
SetActiveID(uId, GetCurrentWindow());
int iKeyPressed = 0;
for (short iKey = 0; iKey < 255; iKey++)
for (short iKey = 1; iKey < 255; iKey++)
{
if (!vIgnore.empty() && std::find(vIgnore.begin(), vIgnore.end(), iKey) != vIgnore.end())
bool bValid = U::KeyHandler.Pressed(iKey);
if (!bValid)
continue;
if (U::KeyHandler.Pressed(iKey))
{
iKeyPressed = iKey;
break;
}
}
bValid = vIgnore.empty() || std::find(vIgnore.begin(), vIgnore.end(), iKey) == vIgnore.end();
if (!bValid)
continue;
if (iKeyPressed && (iKeyPressed != VK_LBUTTON || !bHovered))
{
switch (iKeyPressed)
switch (iKey)
{
case VK_LBUTTON:
bValid = !bHovered; break;
case VK_SHIFT:
case VK_LSHIFT:
case VK_RSHIFT:
case VK_CONTROL:
case VK_LCONTROL:
case VK_RCONTROL:
case VK_MENU:
case VK_LMENU:
case VK_RMENU:
bValid = iKey != iOutput; break;
}
if (!bValid)
continue;
switch (iKey)
{
case VK_ESCAPE:
if (iFlags & FKeybindEnum::AllowNone)
@@ -2110,9 +2123,10 @@ namespace ImGui
}
[[fallthrough]];
default:
iOutput = iKeyPressed;
iOutput = iKey;
}
ClearActiveID();
break;
}
GetCurrentContext()->ActiveIdAllowOverlap = true;
+1 -1
View File
@@ -4135,7 +4135,7 @@ void CMenu::Render()
m_bInKeybind = false;
if (m_bIsOpen)
{
for (short iKey = 0; iKey < 256; iKey++)
for (short iKey = 1; iKey < 255; iKey++)
U::KeyHandler.StoreKey(iKey);
}
else
+1 -1
View File
@@ -70,7 +70,7 @@ void CDraw::UpdateKeyStrings()
if (HKL pCurrLayout = GetKeyboardLayout(0); pCurrLayout != pLastLayout)
{
pLastLayout = pCurrLayout;
for (short iKey = 0; iKey < 256; iKey++)
for (short iKey = 1; iKey < 255; iKey++)
U::KeyHandler.String(iKey, true);
}
}
+3 -1
View File
@@ -26,7 +26,9 @@ void CKeyHandler::StoreKey(byte iKey, KeyStorage* pStorage)
pStorage->m_bIsPressed = bPressed;
pStorage->m_bIsDouble = bDouble;
pStorage->m_bIsReleased = bReleased;
if (bPressed)
if (bDouble)
pStorage->m_dPressTime = 0.0;
else if (bPressed)
pStorage->m_dPressTime = dFloatTime;
}
+1 -1
View File
@@ -26,7 +26,7 @@ public:
public:
std::string& String(byte iKey, const bool bStore = false);
std::array<std::string, 256> m_aStringStorage = {};
std::array<std::string, 256> m_aStringStorage = { "none" };
};
ADD_FEATURE_CUSTOM(CKeyHandler, KeyHandler, U);