diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index d82ed51ae3..09ddf81411 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -844,21 +844,27 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) { System_Notify(SystemNotification::ACTIVITY); if (UI::IsFocusMovementEnabled()) { - bool retval = UIScreen::UnsyncKey(key); - if ((key.flags & KEY_DOWN) != 0 && UI::IsEscapeKey(key)) { - if (chatMenu_) - chatMenu_->Close(); - if (chatButton_) - chatButton_->SetVisibility(UI::V_VISIBLE); - UI::EnableFocusMovement(false); - retval = true; - } - return retval; + return UIScreen::UnsyncKey(key); } return controlMapper_.Key(key, &pauseTrigger_); } +bool EmuScreen::key(const KeyInput &key) { + bool retval = UIScreen::key(key); + + if (!retval && (key.flags & KEY_DOWN) != 0 && UI::IsEscapeKey(key)) { + if (chatMenu_) + chatMenu_->Close(); + if (chatButton_) + chatButton_->SetVisibility(UI::V_VISIBLE); + UI::EnableFocusMovement(false); + return true; + } + + return retval; +} + void EmuScreen::UnsyncAxis(const AxisInput &axis) { System_Notify(SystemNotification::ACTIVITY); return controlMapper_.Axis(axis); diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index 3f07f3d789..970844ba18 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -55,6 +55,9 @@ public: bool UnsyncKey(const KeyInput &key) override; void UnsyncAxis(const AxisInput &axis) override; + // We also need to do some special handling of queued UI events to handle closing the chat window. + bool key(const KeyInput &key) override; + private: void CreateViews() override; UI::EventReturn OnDevTools(UI::EventParams ¶ms);