[AT-SPI] Fixing reseting of delay for CoalescableMessages
[platform/core/uifw/dali-adaptor.git] / dali / internal / accessibility / bridge / bridge-base.cpp
index d25a2f6..261d5f4 100644 (file)
@@ -46,15 +46,17 @@ void BridgeBase::AddCoalescableMessage(CoalescableMessages kind, Dali::Accessibi
   {
     delay = 0;
   }
+  auto countdownBase = static_cast<unsigned int>(delay * 10);
 
-  auto it = mCoalescableMessages.insert({{kind, obj}, {static_cast<unsigned int>(delay * 10), {}}});
+  auto it = mCoalescableMessages.insert({{kind, obj}, {countdownBase, countdownBase, {}}});
   if(it.second)
   {
     functor();
   }
   else
   {
-    it.first->second.second = std::move(functor);
+    std::get<1>(it.first->second) = countdownBase;
+    std::get<2>(it.first->second) = std::move(functor);
   }
 
   if(!tickTimer)
@@ -73,16 +75,20 @@ bool BridgeBase::TickCoalescableMessages()
 {
   for(auto it = mCoalescableMessages.begin(); it != mCoalescableMessages.end();)
   {
-    if(it->second.first)
+    auto& countdown     = std::get<0>(it->second);
+    auto  countdownBase = std::get<1>(it->second);
+    auto& functor       = std::get<2>(it->second);
+    if(countdown)
     {
-      --it->second.first;
+      --countdown;
     }
     else
     {
-      if(it->second.second)
+      if(functor)
       {
-        it->second.second();
-        it->second.second = {};
+        functor();
+        functor = {};
+        countdown = countdownBase;
       }
       else
       {