diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 066d185cc8..25f639ac81 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -669,21 +669,18 @@ void EmuScreen::sendMessage(UIMessage message, const char *value) { bool EmuScreen::UnsyncTouch(const TouchInput &touch) { System_Notify(SystemNotification::ACTIVITY); + bool ignoreGamepad = 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); + ignoreGamepad = true; } } if (touch.flags & TOUCH_DOWN) { - if (!(g_Config.bShowImDebugger && imguiInited_)) { + if (!(g_Config.bShowImDebugger && imguiInited_) && !ignoreGamepad) { + // This just prevents the gamepad from timing out. GamepadTouch(); } } @@ -1072,7 +1069,9 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) { } } - if (UI::IsFocusMovementEnabled() || (g_Config.bShowImDebugger && imguiInited_)) { + const bool chatMenuOpen = chatMenu_ && chatMenu_->GetVisibility() == UI::V_VISIBLE; + + if (chatMenuOpen || (g_Config.bShowImDebugger && imguiInited_)) { // Note: Allow some Vkeys through, so we can toggle the imgui for example (since we actually block the control mapper otherwise in imgui mode). // We need to manually implement it here :/ if (g_Config.bShowImDebugger && imguiInited_) { @@ -1105,6 +1104,11 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) { controlMapper_.Key(key, &pauseTrigger_); break; } + } else { + // Let up-events through to the controlMapper_ so input doesn't get stuck. + if (key.flags & KEY_UP) { + controlMapper_.Key(key, &pauseTrigger_); + } } return UIScreen::UnsyncKey(key); @@ -1147,7 +1151,22 @@ void EmuScreen::touch(const TouchInput &touch) { if (!ImGui::GetIO().WantCaptureMouse) { UIScreen::touch(touch); } + } else if (g_Config.bMouseControl && !(touch.flags & TOUCH_UP)) { + // don't do anything as the mouse pointer is hidden in this case. + // But we let touch-up events through to avoid getting stuck if the user toggles mouse control. } else { + // Handle closing the chat menu if touched outside it. + if (chatMenu_ && chatMenu_->GetVisibility() == UI::V_VISIBLE) { + // Avoid pressing touch button behind the chat + if (!chatMenu_->Contains(touch.x, touch.y)) { + if ((touch.flags & TOUCH_DOWN) != 0) { + chatMenu_->Close(); + if (chatButton_) + chatButton_->SetVisibility(UI::V_VISIBLE); + UI::EnableFocusMovement(false); + } + } + } UIScreen::touch(touch); } } diff --git a/UI/ImDebugger/ImMemView.cpp b/UI/ImDebugger/ImMemView.cpp index e468d0b224..e2af463be6 100644 --- a/UI/ImDebugger/ImMemView.cpp +++ b/UI/ImDebugger/ImMemView.cpp @@ -367,7 +367,7 @@ void ImMemView::CopyToByteClipboard() { void ImMemView::PasteFromByteClipboard() { if (editableMemory_) - Memory::MemcpyUnchecked(curAddress_, byteClipboard_.data(), byteClipboard_.size()); + Memory::MemcpyUnchecked(curAddress_, byteClipboard_.data(), (u32)byteClipboard_.size()); } void ImMemView::toggleEditableMemory(bool toggle) {