Fix assorted interaction problem with the chat menu

Fixes #20633
This commit is contained in:
Henrik Rydgård
2025-07-20 11:04:11 +02:00
parent 48e414fd0e
commit 5aa8156fd0
2 changed files with 29 additions and 10 deletions
+28 -9
View File
@@ -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);
}
}
+1 -1
View File
@@ -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) {