Add Awake API in ProcessController to call Process hard. 23/268723/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 30 Dec 2021 09:31:47 +0000 (18:31 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 31 Dec 2021 08:30:24 +0000 (17:30 +0900)
When DALi-related API doesn't called, DALi think there is nothing to update
--> ProcessController doesn't call the callback functions.

This patch make Awake API so NUI can awak DALi event & update thread hardly.

Change-Id: Ia21ffd48c5ae46ae6f6c58b5baa0261e2563f4da
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-csharp-binder/src/processor-controller.cpp
dali-csharp-binder/src/processor-controller.h

index a355aae..cceb87c 100644 (file)
@@ -19,6 +19,7 @@
 #include "processor-controller.h"
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/common/stage-devel.h>
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 
 #ifdef __cplusplus
@@ -26,7 +27,8 @@ extern "C" {
 #endif
 
 ProcessorController::ProcessorController()
-: mHandler(nullptr)
+: mHandler(nullptr),
+  mKeepRenderingApplied(false)
 {
   {
     try
@@ -51,6 +53,7 @@ ProcessorController::~ProcessorController()
 void ProcessorController::Process(bool postProcessor)
 {
   mHandler();
+  mKeepRenderingApplied = false;
 }
 
 void ProcessorController::SetCallback(  ProcessorControllerProcessCallback callback )
@@ -63,6 +66,19 @@ void ProcessorController::RemoveCallback(  ProcessorControllerProcessCallback ca
   mHandler = nullptr;
 }
 
+void ProcessorController::Awake()
+{
+  if(DALI_UNLIKELY(!mKeepRenderingApplied))
+  {
+    if(DALI_LIKELY(Dali::Stage::IsInstalled()))
+    {
+      auto stage = Dali::Stage::GetCurrent();
+      stage.KeepRendering(0.0f);
+      mKeepRenderingApplied = true;
+    }
+  }
+}
+
 // ProcessorController Bindings
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_ProcessorController() {
 
@@ -107,6 +123,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ProcessorController_RemoveCallback( void
   }
 }
 
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ProcessorController_Awake( void* jarg1 )
+{
+  ProcessorController* processorController = (ProcessorController *) jarg1;
+
+  if( processorController )
+  {
+    processorController->Awake();
+  }
+}
+
 #ifdef __cplusplus
 }
 #endif
\ No newline at end of file
index 807e479..ddeef5a 100644 (file)
@@ -66,9 +66,15 @@ public:
     */
   void RemoveCallback( ProcessorControllerProcessCallback callback );
 
+   /**
+    * @brief Awake update thread so dali-core calls the overriden Process() api.
+    */
+  void Awake();
+
 private:
 
   ProcessorControllerProcessCallback mHandler;
+  bool                               mKeepRenderingApplied; ///< True if we call Stage::KeepRendering(0.0f). It need to avoid duplicated keep rendering call
 };
 
 #endif // CSHARP_PROCESSOR_CONTROLLER_H
\ No newline at end of file