Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI: Autofocus newly opened GUIModalMenu instances #13911

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion src/gui/guiChatConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ void GUIChatConsole::openConsole(f32 scale)
reformatConsole();
m_animate_time_old = porting::getTimeMs();
IGUIElement::setVisible(true);
Environment->setFocus(this);
m_menumgr->createdMenu(this);
}

Expand Down
5 changes: 4 additions & 1 deletion src/gui/mainmenumanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,18 @@ class MainMenuManager : public IMenuManager
if(!m_stack.empty())
m_stack.back()->setVisible(false);
m_stack.push_back(menu);
guienv->setFocus(m_stack.back());
}

virtual void deletingMenu(gui::IGUIElement *menu)
{
// Remove all entries if there are duplicates
m_stack.remove(menu);

if(!m_stack.empty())
if(!m_stack.empty()) {
m_stack.back()->setVisible(true);
guienv->setFocus(m_stack.back());
}
}

// Returns true to prevent further processing
Expand Down
1 change: 0 additions & 1 deletion src/gui/modalMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
#endif

setVisible(true);
Environment->setFocus(this);
m_menumgr->createdMenu(this);

m_doubleclickdetect[0].time = 0;
Expand Down