From c3d2999d7871a4f8868c9888f39058ff95b7d80e Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 5 Mar 2021 01:13:17 +1000 Subject: [PATCH] Qt: Don't pass key input to controllers/hotkeys when ImGui has focus --- src/duckstation-qt/qthostinterface.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index 47a381aff..d1ceeecb0 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -379,7 +379,12 @@ void QtHostInterface::onDisplayWindowKeyEvent(int key, bool pressed) const u32 masked_key = static_cast(key) & IMGUI_KEY_MASK; if (masked_key < countof(ImGuiIO::KeysDown)) - ImGui::GetIO().KeysDown[masked_key] = pressed; + { + ImGuiIO& io = ImGui::GetIO(); + io.KeysDown[masked_key] = pressed; + if (io.WantCaptureKeyboard) + return; + } HandleHostKeyEvent(key & ~Qt::KeyboardModifierMask, key & Qt::KeyboardModifierMask, pressed); }