[4.0] Call RequestUpdateOnce after pause callback
[platform/core/uifw/dali-adaptor.git] / adaptors / common / adaptor-impl.cpp
index 7261e4e..7675c90 100644 (file)
@@ -20,6 +20,9 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/devel-api/actors/actor-devel.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/core.h>
 #include <dali/integration-api/context-notifier.h>
@@ -55,6 +58,8 @@
 #include <tizen-logging.h>
 #include <image-loading.h>
 
+#include <locale-utils.h>
+
 using Dali::TextAbstraction::FontClient;
 
 namespace Dali
@@ -68,7 +73,7 @@ namespace Adaptor
 
 namespace
 {
-__thread Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
+thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
 } // unnamed namespace
 
 Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
@@ -85,7 +90,6 @@ Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Con
 Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
 {
   Any winId = window.GetNativeHandle();
-
   Window& windowImpl = Dali::GetImplementation(window);
   Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
   windowImpl.SetAdaptor(*adaptor);
@@ -190,6 +194,8 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
   {
     Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
   }
+
+  SetupSystemInformation();
 }
 
 Adaptor::~Adaptor()
@@ -298,6 +304,9 @@ void Adaptor::Pause()
     mThreadController->Pause();
     mCore->Suspend();
     mState = PAUSED;
+
+    // Process remained events and rendering in the update thread
+    RequestUpdateOnce();
   }
 }
 
@@ -703,7 +712,7 @@ void Adaptor::OnDamaged( const DamageArea& area )
   RequestUpdate();
 }
 
-void Adaptor::SurfaceResizePrepare( Dali::Adaptor::SurfaceSize surfaceSize )
+void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
 {
   // let the core know the surface size has changed
   mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
@@ -711,7 +720,7 @@ void Adaptor::SurfaceResizePrepare( Dali::Adaptor::SurfaceSize surfaceSize )
   mResizedSignal.Emit( mAdaptor );
 }
 
-void Adaptor::SurfaceResizeComplete( Dali::Adaptor::SurfaceSize surfaceSize )
+void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
 {
   // flush the event queue to give the update-render thread chance
   // to start processing messages for new camera setup etc as soon as possible
@@ -737,6 +746,11 @@ void Adaptor::NotifyLanguageChanged()
   mLanguageChangedSignal.Emit( mAdaptor );
 }
 
+void Adaptor::RenderOnce()
+{
+  RequestUpdateOnce();
+}
+
 void Adaptor::RequestUpdateOnce()
 {
   if( PAUSED_WHILE_HIDDEN != mState )
@@ -824,6 +838,14 @@ float Adaptor::GetStereoBase() const
   return mCore->GetStereoBase();
 }
 
+void Adaptor::SetRootLayoutDirection( std::string locale )
+{
+  Dali::Stage stage = Dali::Stage::GetCurrent();
+
+  stage.GetRootLayer().SetProperty( DevelActor::Property::LAYOUT_DIRECTION,
+                                    static_cast< DevelActor::LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
+}
+
 } // namespace Adaptor
 
 } // namespace Internal