Allow to add idler even if adaptor paused 63/302463/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 7 Dec 2023 06:23:02 +0000 (15:23 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 7 Dec 2023 06:23:02 +0000 (15:23 +0900)
Let we install idler function even if Adaptor is paused.

Since the Adaptor pause state depend on by Windows visibility, not app state,
Application::AddIdle() API usage make some confused.

For example, We cannot call AddIdle() at Application::OnResume callback
because the Window::OnIconifyChanged signal still not comed.

To avoid it, let we just allow Idler function add even Adator is paused.

Change-Id: I943ef76d4e759e282675fbcbc06f0a87d95e9fea
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/adaptor.cpp
dali/internal/adaptor/common/application-impl.cpp
dali/internal/offscreen/common/offscreen-application-impl.cpp

index c64cbdc07cc7859014333424399317613f5fa5bd..6001eb62f740501ef86e685f8b1e1cefa4295e7e 100644 (file)
@@ -663,12 +663,12 @@ Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
   return mTtsPlayers[mode];
 }
 
-bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue, bool forceAdd)
+bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
 {
   bool idleAdded(false);
 
-  // Only add an idle if the Adaptor is actually running
-  if(RUNNING == mState || READY == mState || forceAdd)
+  // We want to run the processes even when paused
+  if(STOPPED != mState)
   {
     idleAdded = mCallbackManager->AddIdleCallback(callback, hasReturnValue);
   }
@@ -1004,7 +1004,7 @@ void Adaptor::RequestProcessEventsOnIdle()
     if(!mNotificationOnIdleInstalled)
     {
       // If we haven't installed the idle notification, install it idle enterer.
-      mNotificationOnIdleInstalled = AddIdleEnterer(MakeCallback(this, &Adaptor::ProcessCoreEventsFromIdle), true);
+      mNotificationOnIdleInstalled = AddIdleEnterer(MakeCallback(this, &Adaptor::ProcessCoreEventsFromIdle));
     }
     else
     {
@@ -1337,12 +1337,12 @@ void Adaptor::SetRootLayoutDirection(std::string locale)
   }
 }
 
-bool Adaptor::AddIdleEnterer(CallbackBase* callback, bool forceAdd)
+bool Adaptor::AddIdleEnterer(CallbackBase* callback)
 {
   bool idleAdded(false);
 
-  // Only add an idle if the Adaptor is actually running
-  if(RUNNING == mState || READY == mState || forceAdd)
+  // We want to run the processes even when paused
+  if(STOPPED != mState)
   {
     idleAdded = mCallbackManager->AddIdleEntererCallback(callback);
   }
index 279ff142b0399c77d2f983728365efc02b813ca6..98d1dbc8ee9f2ea4b31d4f4e5d461cf592ce52f6 100644 (file)
@@ -249,7 +249,7 @@ public: // AdaptorInternalServices implementation
   /**
    * @copydoc Dali::Adaptor::AddIdle()
    */
-  virtual bool AddIdle(CallbackBase* callback, bool hasReturnValue, bool forceAdd);
+  virtual bool AddIdle(CallbackBase* callback, bool hasReturnValue);
 
   /**
    * Adds a new Window instance to the Adaptor
@@ -652,7 +652,7 @@ private:
    * @endcode
    * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
    */
-  bool AddIdleEnterer(CallbackBase* callback, bool forceAdd);
+  bool AddIdleEnterer(CallbackBase* callback);
 
   /**
    * Removes a previously added the idle enterer callback.
index 6ca95b2bcea5ec7a93d3d64117ba027e4061c427..c8d17eee7412cdd1d64494409f2725783638c597 100644 (file)
@@ -88,7 +88,7 @@ void Adaptor::Stop()
 bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
 {
   DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
-  return mImpl->AddIdle(callback, hasReturnValue, false);
+  return mImpl->AddIdle(callback, hasReturnValue);
 }
 
 bool Adaptor::AddWindow(Dali::Integration::SceneHolder childWindow)
index 0f18afa847c6db95294526fdaf2576203a87cded..44d4146015cad2de06ab960539e6580c8065bfd2 100644 (file)
@@ -346,7 +346,7 @@ void Application::Quit()
 {
   // Actually quit the application.
   // Force a call to Quit even if adaptor is not running.
-  Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).AddIdle(MakeCallback(this, &Application::QuitFromMainLoop), false, true);
+  Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).AddIdle(MakeCallback(this, &Application::QuitFromMainLoop), false);
 }
 
 void Application::QuitFromMainLoop()
index 1b2545a992e2d7a3fadedb146b75f903e4660f52..f1fc2e72cd5445259dde12599d7e4db6bef973e5 100644 (file)
@@ -89,8 +89,7 @@ void OffscreenApplication::MainLoop()
 void OffscreenApplication::Quit()
 {
   // Actually quit the application.
-  // Force a call to Quit even if adaptor is not running.
-  Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).AddIdle(MakeCallback(this, &OffscreenApplication::QuitFromMainLoop), false, true);
+  Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).AddIdle(MakeCallback(this, &OffscreenApplication::QuitFromMainLoop), false);
 }
 
 Dali::OffscreenWindow OffscreenApplication::GetWindow()