mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
GUI: Autofocus newly opened GUIModalMenu instances (#13911)
This in particular fixes incorrect event propagation to menus that are no longer shown, such as the key change menu when opened within the settings tab.
This commit is contained in:
parent
2fbf5f4250
commit
906417cc0d
@ -114,7 +114,6 @@ void GUIChatConsole::openConsole(f32 scale)
|
|||||||
reformatConsole();
|
reformatConsole();
|
||||||
m_animate_time_old = porting::getTimeMs();
|
m_animate_time_old = porting::getTimeMs();
|
||||||
IGUIElement::setVisible(true);
|
IGUIElement::setVisible(true);
|
||||||
Environment->setFocus(this);
|
|
||||||
m_menumgr->createdMenu(this);
|
m_menumgr->createdMenu(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ public:
|
|||||||
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void deletingMenu(gui::IGUIElement *menu)
|
virtual void deletingMenu(gui::IGUIElement *menu)
|
||||||
@ -64,8 +65,10 @@ public:
|
|||||||
// Remove all entries if there are duplicates
|
// Remove all entries if there are duplicates
|
||||||
m_stack.remove(menu);
|
m_stack.remove(menu);
|
||||||
|
|
||||||
if(!m_stack.empty())
|
if(!m_stack.empty()) {
|
||||||
m_stack.back()->setVisible(true);
|
m_stack.back()->setVisible(true);
|
||||||
|
guienv->setFocus(m_stack.back());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true to prevent further processing
|
// Returns true to prevent further processing
|
||||||
|
@ -49,7 +49,6 @@ GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
Environment->setFocus(this);
|
|
||||||
m_menumgr->createdMenu(this);
|
m_menumgr->createdMenu(this);
|
||||||
|
|
||||||
m_doubleclickdetect[0].time = 0;
|
m_doubleclickdetect[0].time = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user