From c9deeae6f1c910ec65c86d47eb5bce74121c90c1 Mon Sep 17 00:00:00 2001 From: iota97 Date: Fri, 19 Nov 2021 16:12:26 +0100 Subject: [PATCH] Prevent chat menu touch to fall throght --- UI/EmuScreen.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 9c212a525d..c907638f4a 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -545,11 +545,17 @@ inline float clamp1(float x) { bool EmuScreen::touch(const TouchInput &touch) { Core_NotifyActivity(); - if (chatMenu_ && (touch.flags & TOUCH_DOWN) != 0 && !chatMenu_->Contains(touch.x, touch.y)) { - chatMenu_->Close(); - if (chatButton_) - chatButton_->SetVisibility(UI::V_VISIBLE); - UI::EnableFocusMovement(false); + if (chatMenu_ && chatMenu_->GetVisibility() == UI::V_VISIBLE) { + // Avoid pressing touch button behind the chat + if (chatMenu_->Contains(touch.x, touch.y)) { + chatMenu_->Touch(touch); + return true; + } else if ((touch.flags & TOUCH_DOWN) != 0) { + chatMenu_->Close(); + if (chatButton_) + chatButton_->SetVisibility(UI::V_VISIBLE); + UI::EnableFocusMovement(false); + } } if (root_) {