diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 62cf3944f..69934b193 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -779,15 +779,22 @@ void MainWindow::toggleTray(QSystemTrayIcon::ActivationReason reason) { if (reason == QSystemTrayIcon::Context) { updateTrayMenu(true); QTimer::singleShot(1, this, SLOT(psShowTrayMenu())); - } else { + } else if (!skipTrayClick()) { if (isActive()) { minimizeToTray(); } else { showFromTray(reason); } + _lastTrayClickTime = getms(); } } +bool MainWindow::skipTrayClick() const { + return (_lastTrayClickTime > 0) + && (getms() - _lastTrayClickTime + < QApplication::doubleClickInterval()); +} + void MainWindow::toggleDisplayNotifyFromTray() { if (App::passcoded()) { if (!isActive()) showFromTray(); diff --git a/Telegram/SourceFiles/mainwindow.h b/Telegram/SourceFiles/mainwindow.h index 2b3f5734e..8f28a8f62 100644 --- a/Telegram/SourceFiles/mainwindow.h +++ b/Telegram/SourceFiles/mainwindow.h @@ -177,6 +177,8 @@ private: void showConnecting(const QString &text, const QString &reconnect = QString()); void hideConnecting(); + [[nodiscard]] bool skipTrayClick() const; + void ensureLayerCreated(); void destroyLayerDelayed(); @@ -196,6 +198,7 @@ private: }; QList _delayedServiceMsgs; mtpRequestId _serviceHistoryRequest = 0; + TimeMs _lastTrayClickTime = 0; object_ptr _passcode = { nullptr }; object_ptr _intro = { nullptr };