Merge remote-tracking branch 'origin/52-add-escape-shortcut-to-open-quit-menu' into main/yubo-dev

main/yubo-dev
Nuno 3 years ago
commit 2817c8d823

@ -2319,16 +2319,16 @@ namespace NLGUI
SModalWndInfo mwi = getModal(); SModalWndInfo mwi = getModal();
if (mwi.ModalExitKeyPushed) if (mwi.ModalExitKeyPushed)
disableModalWindow(); disableModalWindow();
}
handled= true;
} }
// Manage "quit window" If the Key is ESCAPE, no captureKeyboard
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keydown && eventDesc.getKey() == NLMISC::KeyESCAPE )
{
// Get the last escapable active top window. NB: this is ergonomically better.
CInterfaceGroup *win= getLastEscapableTopWindow(); CInterfaceGroup *win= getLastEscapableTopWindow();
if ( win ) if ( win )
{ {
// Manage "quit window" If the Key is ESCAPE, no captureKeyboard
// Get the last escapable active top window. NB: this is ergonomically better.
// If the window is a modal, must pop it. // If the window is a modal, must pop it.
if( dynamic_cast<CGroupModal*>(win) ) if( dynamic_cast<CGroupModal*>(win) )
{ {
@ -2414,6 +2414,12 @@ namespace NLGUI
} }
} }
if (eventDesc.getKeyEventType() == CEventDescriptorKey::keydown && eventDesc.getKey() == NLMISC::KeyESCAPE && !handled && !isKeyboardCaptured())
{
CAHManager::getInstance()->runActionHandler("enter_modal", NULL, "group=ui:interface:quit_dialog");
handled = true;
}
// General case: handle it in the Captured keyboard // General case: handle it in the Captured keyboard
if ( getCaptureKeyboard() != NULL && !handled) if ( getCaptureKeyboard() != NULL && !handled)
{ {

Loading…
Cancel
Save