Skip to content

Commit

Permalink
Chat console: Prevent input loss on double open
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed Apr 30, 2024
1 parent d767ab0 commit 9c11f16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/gui/guiChatConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ GUIChatConsole::~GUIChatConsole()

void GUIChatConsole::openConsole(f32 scale)
{
if (m_open)
return;

assert(scale > 0.0f && scale <= 1.0f);

m_open = true;

m_desired_height_fraction = scale;
m_desired_height = scale * m_screensize.Y;
reformatConsole();
Expand Down
8 changes: 4 additions & 4 deletions src/gui/mainmenumanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ class MainMenuManager : public IMenuManager
public:
virtual void createdMenu(gui::IGUIElement *menu)
{
#ifndef NDEBUG
for (gui::IGUIElement *i : m_stack) {
assert(i != menu);
for (gui::IGUIElement *e : m_stack) {
if (e == menu)
return;
}
#endif

if(!m_stack.empty())
m_stack.back()->setVisible(false);

m_stack.push_back(menu);
guienv->setFocus(m_stack.back());
}
Expand Down

0 comments on commit 9c11f16

Please sign in to comment.