mirror of
https://github.com/minetest/minetest.git
synced 2025-01-11 15:57:29 +01:00
Chat console: Prevent input loss on double open
This commit is contained in:
parent
c352fbf5c9
commit
f0bb5313d3
@ -106,9 +106,13 @@ GUIChatConsole::~GUIChatConsole()
|
|||||||
|
|
||||||
void GUIChatConsole::openConsole(f32 scale)
|
void GUIChatConsole::openConsole(f32 scale)
|
||||||
{
|
{
|
||||||
|
if (m_open)
|
||||||
|
return;
|
||||||
|
|
||||||
assert(scale > 0.0f && scale <= 1.0f);
|
assert(scale > 0.0f && scale <= 1.0f);
|
||||||
|
|
||||||
m_open = true;
|
m_open = true;
|
||||||
|
|
||||||
m_desired_height_fraction = scale;
|
m_desired_height_fraction = scale;
|
||||||
m_desired_height = scale * m_screensize.Y;
|
m_desired_height = scale * m_screensize.Y;
|
||||||
reformatConsole();
|
reformatConsole();
|
||||||
|
@ -48,14 +48,14 @@ class MainMenuManager : public IMenuManager
|
|||||||
public:
|
public:
|
||||||
virtual void createdMenu(gui::IGUIElement *menu)
|
virtual void createdMenu(gui::IGUIElement *menu)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
for (gui::IGUIElement *e : m_stack) {
|
||||||
for (gui::IGUIElement *i : m_stack) {
|
if (e == menu)
|
||||||
assert(i != menu);
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!m_stack.empty())
|
if(!m_stack.empty())
|
||||||
m_stack.back()->setVisible(false);
|
m_stack.back()->setVisible(false);
|
||||||
|
|
||||||
m_stack.push_back(menu);
|
m_stack.push_back(menu);
|
||||||
guienv->setFocus(m_stack.back());
|
guienv->setFocus(m_stack.back());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user