11
0
Files
plasma5-workspace/0011-notifications-Always-check-first-if-the-dispatch-tim.patch

82 lines
2.5 KiB
Diff

From 83ec35b632ee495df4b3c6f33f7ca33bca398a8f Mon Sep 17 00:00:00 2001
From: Martin Klapetek <mklapetek@kde.org>
Date: Fri, 1 May 2015 14:51:37 +0200
Subject: [PATCH 11/12] [notifications] Always check first if the dispatch
timer isn't running already
That should prevent various mis-queueings. If the timer is running, the
queue will get processed once the timer times out.
CCBUG: 342605
---
.../notifications/plugin/notificationshelper.cpp | 25 +++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/applets/notifications/plugin/notificationshelper.cpp b/applets/notifications/plugin/notificationshelper.cpp
index 37375d01b09ed399a4f0fe01c60821bc53f7f151..b56e3933bc5ee23bb53892126c5af91caee74cc6 100644
--- a/applets/notifications/plugin/notificationshelper.cpp
+++ b/applets/notifications/plugin/notificationshelper.cpp
@@ -164,7 +164,9 @@ void NotificationsHelper::processShow()
repositionPopups();
QTimer::singleShot(300, popup, SLOT(show()));
- m_dispatchTimer->start();
+ if (!m_dispatchTimer->isActive()) {
+ m_dispatchTimer->start();
+ }
}
void NotificationsHelper::processHide()
@@ -204,7 +206,9 @@ void NotificationsHelper::processHide()
repositionPopups();
}
- m_dispatchTimer->start();
+ if (!m_dispatchTimer->isActive()) {
+ m_dispatchTimer->start();
+ }
}
void NotificationsHelper::displayNotification(const QVariantMap &notificationData)
@@ -243,7 +247,12 @@ void NotificationsHelper::displayNotification(const QVariantMap &notificationDat
m_showQueue.append(notificationData);
m_mutex->unlock();
- processQueues();
+ if (!m_dispatchTimer->isActive()) {
+ // If the dispatch timer is not already running, process
+ // the queues directly, that should cut the time between
+ // notification emitting the event and popup displaying
+ processQueues();
+ }
}
void NotificationsHelper::closePopup(const QString &sourceName)
@@ -258,7 +267,10 @@ void NotificationsHelper::closePopup(const QString &sourceName)
m_mutex->lockForWrite();
m_hideQueue.append(popup);
m_mutex->unlock();
- processQueues();
+
+ if (!m_dispatchTimer->isActive()) {
+ processQueues();
+ }
}
}
@@ -274,7 +286,10 @@ void NotificationsHelper::onPopupClosed()
m_mutex->lockForWrite();
m_hideQueue << popup;
m_mutex->unlock();
- processQueues();
+
+ if (!m_dispatchTimer->isActive()) {
+ processQueues();
+ }
}
}
--
2.3.5