From b52dc2f84e3fa46834cdabc6c15a83e3995865e2 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 7 Dec 2023 15:23:02 +0900 Subject: [PATCH] Allow to add idler even if adaptor paused 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 --- dali/internal/adaptor/common/adaptor-impl.cpp | 14 +++++++------- dali/internal/adaptor/common/adaptor-impl.h | 4 ++-- dali/internal/adaptor/common/adaptor.cpp | 2 +- dali/internal/adaptor/common/application-impl.cpp | 2 +- .../common/offscreen-application-impl.cpp | 3 +-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index c64cbdc07..6001eb62f 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -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); } diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index 279ff142b..98d1dbc8e 100644 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -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. diff --git a/dali/internal/adaptor/common/adaptor.cpp b/dali/internal/adaptor/common/adaptor.cpp index 6ca95b2bc..c8d17eee7 100644 --- a/dali/internal/adaptor/common/adaptor.cpp +++ b/dali/internal/adaptor/common/adaptor.cpp @@ -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) diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index 0f18afa84..44d414601 100644 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -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() diff --git a/dali/internal/offscreen/common/offscreen-application-impl.cpp b/dali/internal/offscreen/common/offscreen-application-impl.cpp index 1b2545a99..f1fc2e72c 100644 --- a/dali/internal/offscreen/common/offscreen-application-impl.cpp +++ b/dali/internal/offscreen/common/offscreen-application-impl.cpp @@ -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() -- 2.34.1