diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 8bc9e9e68..680b774e5 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -1530,12 +1530,16 @@ void MainWindow::showEvent(QShowEvent *e) { void MainWindow::closeEvent(QCloseEvent *e) { +#ifdef Q_OS_MACOS + Exit(); +#else if (!hidden_ && keep_running_ && e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable()) { SetHiddenInTray(true); } else { Exit(); } +#endif QMainWindow::closeEvent(e); @@ -2745,25 +2749,21 @@ void MainWindow::Raise() { } +#ifdef Q_OS_WIN #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) { #else bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) { #endif - Q_UNUSED(eventType); - Q_UNUSED(result); - -#ifdef Q_OS_WIN - MSG *msg = static_cast(message); - thumbbar_->HandleWinEvent(msg); -#else - Q_UNUSED(message); -#endif - - return false; + if (exit_count_ == 0 && message) { + MSG *msg = static_cast(message); + thumbbar_->HandleWinEvent(msg); + } + return QMainWindow::nativeEvent(eventType, message, result); } +#endif // Q_OS_WIN void MainWindow::AutoCompleteTags() { diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index 1b349fc58..2156561c3 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -117,10 +117,12 @@ class MainWindow : public QMainWindow, public PlatformInterface { void showEvent(QShowEvent *e) override; void closeEvent(QCloseEvent *e) override; void keyPressEvent(QKeyEvent *e) override; +#ifdef Q_OS_WIN #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override; #else bool nativeEvent(const QByteArray &eventType, void *message, long *result) override; +#endif #endif // PlatformInterface