From: Eunki, Hong Date: Thu, 10 Nov 2022 13:00:02 +0000 (+0900) Subject: Repeat ProcessEvents idler if requested. X-Git-Tag: dali_2.2.35~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5feb05d93b227c8ccc2416b74fdccec45015ab52;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Repeat ProcessEvents idler if requested. If someone request ProcessEvents during ProcessEventsOnIdle API, that request was ignored. To make all requested events process well, make we idler run again. TODO : WinCallbackManager don't consider repeat idle case. We should fix it somedays. Change-Id: I74b1f5d50b2f16ee539350eaf570d558e445cf15 Signed-off-by: Eunki, Hong --- diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 3fc83d0..5268156 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -973,11 +973,20 @@ void Adaptor::RequestUpdate() void Adaptor::RequestProcessEventsOnIdle() { - // Only request a notification if we haven't installed the idle notification // We want to run the processes even when paused - if(!mNotificationOnIdleInstalled && STOPPED != mState) + if(STOPPED != mState) { - mNotificationOnIdleInstalled = AddIdleEnterer(MakeCallback(this, &Adaptor::ProcessCoreEventsFromIdle), true); + if(!mNotificationOnIdleInstalled) + { + // If we haven't installed the idle notification, install it idle enterer. + mNotificationOnIdleInstalled = AddIdleEnterer(MakeCallback(this, &Adaptor::ProcessCoreEventsFromIdle), true); + } + else + { + // Request comes during ProcessCoreEventsFromIdle running. + // Mark as we need to call ProcessEvents in next idle events. + mRequiredIdleRepeat = true; + } } } @@ -1170,12 +1179,20 @@ void Adaptor::RequestUpdateOnce() bool Adaptor::ProcessCoreEventsFromIdle() { + // Reset repeat idler flag. + mRequiredIdleRepeat = false; ProcessCoreEvents(); - // the idle handle automatically un-installs itself - mNotificationOnIdleInstalled = false; + // If someone request ProcessCoreEvents during above ProcessCoreEvents call, we might need to run idle one more times. + // Else, the idle handle automatically un-installs itself + mNotificationOnIdleInstalled = mRequiredIdleRepeat; - return false; + if(mRequiredIdleRepeat) + { + DALI_LOG_DEBUG_INFO("Required ProcessCoreEvents one more times\n"); + } + + return mRequiredIdleRepeat; } Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow(Dali::Actor& actor) @@ -1247,6 +1264,7 @@ Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, mPlatformAbstraction(nullptr), mCallbackManager(nullptr), mNotificationOnIdleInstalled(false), + mRequiredIdleRepeat(false), mNotificationTrigger(nullptr), mDaliFeedbackPlugin(), mFeedbackController(nullptr), diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index e058047..a1e5be6 100644 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -691,6 +691,7 @@ private: // Data std::unique_ptr mCallbackManager; ///< Used to install callbacks bool mNotificationOnIdleInstalled; ///< whether the idle handler is installed to send an notification event + bool mRequiredIdleRepeat; ///< whether we need to repeat installed notification event in idle handler TriggerEventInterface* mNotificationTrigger; ///< Notification event trigger FeedbackPluginProxy* mDaliFeedbackPlugin; ///< Used to access feedback support FeedbackController* mFeedbackController; ///< Plays feedback effects for Dali-Toolkit UI Controls. diff --git a/dali/internal/system/libuv/callback-manager-libuv.cpp b/dali/internal/system/libuv/callback-manager-libuv.cpp index 72326f9..9a6ae75 100644 --- a/dali/internal/system/libuv/callback-manager-libuv.cpp +++ b/dali/internal/system/libuv/callback-manager-libuv.cpp @@ -111,6 +111,9 @@ void IdleCallback(uv_idle_t* handle) { // remove callback data from the container CallbackBase::Execute(*callbackData->mRemoveFromContainerFunction, callbackData); + + // will clear up the handle + delete callbackData; } } else @@ -120,10 +123,10 @@ void IdleCallback(uv_idle_t* handle) // run the function CallbackBase::Execute(*callbackData->mCallback); - } - // will clear up the handle - delete callbackData; + // will clear up the handle + delete callbackData; + } } } // namespace diff --git a/dali/internal/system/windows/callback-manager-win.cpp b/dali/internal/system/windows/callback-manager-win.cpp index 7871819..f57945a 100644 --- a/dali/internal/system/windows/callback-manager-win.cpp +++ b/dali/internal/system/windows/callback-manager-win.cpp @@ -78,6 +78,7 @@ bool WinCallbackManager::ProcessIdle() { const bool idleProcessed = !mCallbacks.empty(); + // @todo : Need to consider callback with return & don't erase callback when it return true. for(CallbackBase* cb : mCallbacks) { Dali::CallbackBase::Execute(*cb);