From f2df8a4cce0ac741e8fc725e68bb5f905d35ec55 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 21 Mar 2022 15:28:43 +0600 Subject: [PATCH] qt: Keyboard input now works properly when mouse is uncaptured --- src/qt/qt_mainwindow.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 1d558c38b..df2c841e9 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1313,7 +1313,14 @@ void MainWindow::getTitle(wchar_t *title) bool MainWindow::eventFilter(QObject* receiver, QEvent* event) { - if (this->keyboardGrabber() == this) { + if (!dopause && (mouse_capture || !kbd_req_capture)) { + if (event->type() == QEvent::Shortcut) { + auto shortcutEvent = (QShortcutEvent*)event; + if (shortcutEvent->key() == ui->actionExit->shortcut()) { + event->accept(); + return true; + } + } if (event->type() == QEvent::KeyPress) { event->accept(); this->keyPressEvent((QKeyEvent *) event);