2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 15:05:56 +00:00

Ignore second tray icon click in short time.

Fixes #4479.
This commit is contained in:
John Preston
2018-03-09 15:53:44 +03:00
parent e6c0f0f774
commit 8c3b7f6417
2 changed files with 11 additions and 1 deletions

View File

@@ -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();