From 989926cb7f8ed61e52785e1deb4d82f39c269b55 Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Thu, 10 Mar 2022 23:14:13 +0200 Subject: [PATCH] qt: Disable processing of alt-f4 in windows. Prevents the alt-f4 from quiting 86Box. --- src/qt/qt_mainwindow.cpp | 5 +++++ src/qt/qt_winrawinputfilter.cpp | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 0c1d88fb8..9eb0bb455 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -437,6 +437,11 @@ MainWindow::MainWindow(QWidget *parent) : } void MainWindow::closeEvent(QCloseEvent *event) { + if (mouse_capture) { + event->ignore(); + return; + } + if (confirm_exit && confirm_exit_cmdl && cpu_thread_run) { QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", tr("Are you sure you want to exit 86Box?"), QMessageBox::Yes | QMessageBox::No, this); diff --git a/src/qt/qt_winrawinputfilter.cpp b/src/qt/qt_winrawinputfilter.cpp index 9b86d2af4..1e5ec5a71 100644 --- a/src/qt/qt_winrawinputfilter.cpp +++ b/src/qt/qt_winrawinputfilter.cpp @@ -116,13 +116,19 @@ bool WindowsRawInputFilter::nativeEventFilter(const QByteArray &eventType, void { MSG *msg = static_cast(message); - if (msg->message == WM_INPUT) - { + if (msg->message == WM_INPUT) { if (window->isActiveWindow() && menus_open == 0) - handle_input((HRAWINPUT)msg->lParam); + handle_input((HRAWINPUT) msg->lParam); return true; } + + /* Stop processing of Alt-F4 */ + if (msg->message == WM_SYSKEYDOWN) { + if (msg->wParam == 0x73) { + return true; + } + } } return false;