qt: Disable processing of alt-f4 in windows.

Prevents the alt-f4 from quiting 86Box.
This commit is contained in:
ts-korhonen
2022-03-10 23:14:13 +02:00
parent fd53393686
commit 989926cb7f
2 changed files with 14 additions and 3 deletions

View File

@@ -437,6 +437,11 @@ MainWindow::MainWindow(QWidget *parent) :
} }
void MainWindow::closeEvent(QCloseEvent *event) { void MainWindow::closeEvent(QCloseEvent *event) {
if (mouse_capture) {
event->ignore();
return;
}
if (confirm_exit && confirm_exit_cmdl && cpu_thread_run) 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); QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", tr("Are you sure you want to exit 86Box?"), QMessageBox::Yes | QMessageBox::No, this);

View File

@@ -116,13 +116,19 @@ bool WindowsRawInputFilter::nativeEventFilter(const QByteArray &eventType, void
{ {
MSG *msg = static_cast<MSG *>(message); MSG *msg = static_cast<MSG *>(message);
if (msg->message == WM_INPUT) if (msg->message == WM_INPUT) {
{
if (window->isActiveWindow() && menus_open == 0) if (window->isActiveWindow() && menus_open == 0)
handle_input((HRAWINPUT)msg->lParam); handle_input((HRAWINPUT) msg->lParam);
return true; return true;
} }
/* Stop processing of Alt-F4 */
if (msg->message == WM_SYSKEYDOWN) {
if (msg->wParam == 0x73) {
return true;
}
}
} }
return false; return false;