From 8ce7667da6cee9e294bf1a832d49f306c9d5ab01 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 7 Dec 2023 15:23:02 +0900 Subject: [PATCH] [Tizen] 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 +- .../offscreen/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 c64cbdc..6001eb6 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 279ff14..98d1dbc 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 6ca95b2..c8d17ee 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 0f18afa..44d4146 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 1b2545a..f1fc2e7 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.7.4