Qt: Don't pass key input to controllers/hotkeys when ImGui has focus

This commit is contained in:
Connor McLaughlin 2021-03-05 01:13:17 +10:00
parent 767343ca22
commit c3d2999d78

View file

@ -379,7 +379,12 @@ void QtHostInterface::onDisplayWindowKeyEvent(int key, bool pressed)
const u32 masked_key = static_cast<u32>(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);
}