[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kidletime] src: handle the case of exact timeouts correctly
From:       Ian Monroe <imonroe () kde ! org>
Date:       2014-05-31 19:38:05
Message-ID: E1Wqp6T-0006kY-Qp () scm ! kde ! org
[Download RAW message or body]

Git commit 4f91aa0eb2c80fba3377ad0cdb8c5f8cfa6d3eb2 by Ian Monroe.
Committed on 27/05/2014 at 19:39.
Pushed by ianmonroe into branch 'master'.

handle the case of exact timeouts correctly

M  +3    -3    src/widgetbasedpoller.cpp

http://commits.kde.org/kidletime/4f91aa0eb2c80fba3377ad0cdb8c5f8cfa6d3eb2

diff --git a/src/widgetbasedpoller.cpp b/src/widgetbasedpoller.cpp
index 81d3529..c0d7c04 100644
--- a/src/widgetbasedpoller.cpp
+++ b/src/widgetbasedpoller.cpp
@@ -114,10 +114,10 @@ int WidgetBasedPoller::poll()
     int idle = getIdleTime();
 
     // Check if we reached a timeout..
-    Q_FOREACH (int i, m_timeouts) {
-        if ((i - idle < 300 && i > idle) || (idle - i < 300 && idle > i)) {
+    Q_FOREACH(int timeOut, m_timeouts) {
+        if ( ( timeOut - idle < 300 && timeOut >= idle ) || ( idle - timeOut < 300 \
&& idle > timeOut ) ) {  // Bingo!
-            emit timeoutReached(i);
+            emit timeoutReached( timeOut );
         }
     }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic