Skip to content

Commit

Permalink
Disable shortcuts if ESC is used for Actionkey cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Olzaq committed Nov 30, 2016
1 parent 126a12d commit c34e8e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/gui/MenuWidgets.cpp
Expand Up @@ -467,6 +467,7 @@ MenuPage::MenuPage(const Vec2f & pos, const Vec2f & size, MENUSTATE _eMenuState)
, m_selected(NULL)
, bEdit(false)
, bMouseAttack(false)
, m_disableShortcuts(false)
, m_blinkTime(PlatformDuration_ZERO)
, m_blink(true)
{
Expand Down Expand Up @@ -792,6 +793,10 @@ MENUSTATE MenuPage::checkShortcuts() {

if(w->m_shortcut != ActionKey::UNUSED) {
if(GInput->isKeyPressedNowUnPressed(w->m_shortcut)) {
if(m_disableShortcuts) {
m_disableShortcuts = false;
break;
}
bEdit = w->OnMouseClick();
m_selected = w;
return w->m_targetMenu;
Expand Down Expand Up @@ -890,6 +895,7 @@ void MenuPage::Render() {
if(widget->m_isKeybind) {
if(inputKeyId == Keyboard::Key_Escape) {
inputKeyId = ActionKey::UNUSED;
m_disableShortcuts = true;
}
config.setActionKey(widget->m_keybindAction, widget->m_keybindIndex, inputKeyId);
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/MenuWidgets.h
Expand Up @@ -95,7 +95,7 @@ class MenuPage {
Widget * m_selected;
bool bEdit;
bool bMouseAttack;

bool m_disableShortcuts;
PlatformDuration m_blinkTime;
bool m_blink;
};
Expand Down

0 comments on commit c34e8e9

Please sign in to comment.