Avoid using ESC key to close non-foreground windows

This commit is contained in:
David Capello 2015-05-11 09:53:45 -03:00
parent 300a5cc1cb
commit 1583cd82bd

View File

@ -80,14 +80,16 @@ protected:
return true; return true;
case kKeyDownMessage: case kKeyDownMessage:
if (static_cast<KeyMessage*>(msg)->scancode() == kKeyEsc) { if (getRoot()->isForeground() &&
static_cast<KeyMessage*>(msg)->scancode() == kKeyEsc) {
setSelected(true); setSelected(true);
return true; return true;
} }
break; break;
case kKeyUpMessage: case kKeyUpMessage:
if (static_cast<KeyMessage*>(msg)->scancode() == kKeyEsc) { if (getRoot()->isForeground() &&
static_cast<KeyMessage*>(msg)->scancode() == kKeyEsc) {
if (isSelected()) { if (isSelected()) {
setSelected(false); setSelected(false);
closeWindow(); closeWindow();