mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Make handling of F1-F24 keys binds consistent with regular binds
The handling of F1-F24 keys in `CBindsSpecial` was not correct for composite binds, leading to stuck inputs if modifier keys are released first. Now, the `CBindsSpecial::OnInput` function simply delegates to `CBinds::OnInput` for F-key presses/releases so the behavior is consistent with regular binds.
This commit is contained in:
parent
12e5f7f1d3
commit
dc1a483b53
|
@ -11,26 +11,15 @@ static const ColorRGBA gs_BindPrintColor{1.0f, 1.0f, 0.8f, 1.0f};
|
|||
|
||||
bool CBinds::CBindsSpecial::OnInput(const IInput::CEvent &Event)
|
||||
{
|
||||
if((Event.m_Flags & (IInput::FLAG_PRESS | IInput::FLAG_RELEASE)) == 0)
|
||||
return false;
|
||||
|
||||
// only handle F and composed F binds
|
||||
if(((Event.m_Key >= KEY_F1 && Event.m_Key <= KEY_F12) || (Event.m_Key >= KEY_F13 && Event.m_Key <= KEY_F24)) && (Event.m_Key != KEY_F5 || !m_pClient->m_Menus.IsActive()))
|
||||
// do not handle F5 bind while menu is active
|
||||
if(((Event.m_Key >= KEY_F1 && Event.m_Key <= KEY_F12) || (Event.m_Key >= KEY_F13 && Event.m_Key <= KEY_F24)) &&
|
||||
(Event.m_Key != KEY_F5 || !m_pClient->m_Menus.IsActive()))
|
||||
{
|
||||
int Mask = CBinds::GetModifierMask(Input());
|
||||
|
||||
// Look for a composed bind
|
||||
bool ret = false;
|
||||
if(m_pBinds->m_aapKeyBindings[Mask][Event.m_Key])
|
||||
{
|
||||
m_pBinds->GetConsole()->ExecuteLineStroked(Event.m_Flags & IInput::FLAG_PRESS, m_pBinds->m_aapKeyBindings[Mask][Event.m_Key]);
|
||||
ret = true;
|
||||
}
|
||||
// Look for a non composed bind
|
||||
if(!ret && m_pBinds->m_aapKeyBindings[0][Event.m_Key])
|
||||
{
|
||||
m_pBinds->GetConsole()->ExecuteLineStroked(Event.m_Flags & IInput::FLAG_PRESS, m_pBinds->m_aapKeyBindings[0][Event.m_Key]);
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return m_pBinds->OnInput(Event);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue