From bd84c98893073f78dc0aeec0e6b1855c7ed9e266 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 13 Sep 2017 19:15:34 +0200 Subject: [PATCH] skip text input when the console is open. (#1465) --- src/game/client/components/console.cpp | 5 +++++ src/game/client/components/console.h | 1 + src/game/client/components/menus.cpp | 12 ++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index 5e75b5d32..d275f09cf 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -673,6 +673,11 @@ void CGameConsole::ConchainConsoleOutputLevelUpdate(IConsole::IResult *pResult, } } +bool CGameConsole::IsConsoleActive() +{ + return m_ConsoleState != CONSOLE_CLOSED; +} + void CGameConsole::PrintLine(int Type, const char *pLine) { if(Type == CONSOLETYPE_LOCAL) diff --git a/src/game/client/components/console.h b/src/game/client/components/console.h index 786ce1480..e5e4906cf 100644 --- a/src/game/client/components/console.h +++ b/src/game/client/components/console.h @@ -90,6 +90,7 @@ public: CGameConsole(); + bool IsConsoleActive(); void PrintLine(int Type, const char *pLine); virtual void OnStateChange(int NewState, int OldState); diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index f459123b0..fff71013e 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -447,11 +448,14 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS } } - for(int i = 0; i < Input()->NumEvents(); i++) + if(!m_pClient->m_pGameConsole->IsConsoleActive()) { - Len = str_length(pStr); - int NumChars = Len; - ReturnValue |= CLineInput::Manipulate(Input()->GetEvent(i), pStr, StrSize, StrSize, &Len, &s_AtIndex, &NumChars); + for(int i = 0; i < Input()->NumEvents(); i++) + { + Len = str_length(pStr); + int NumChars = Len; + ReturnValue |= CLineInput::Manipulate(Input()->GetEvent(i), pStr, StrSize, StrSize, &Len, &s_AtIndex, &NumChars); + } } }