Merge "DALi Version 2.3.2" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / adaptor.cpp
old mode 100755 (executable)
new mode 100644 (file)
index a0747df..c8d17ee
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 // CLASS HEADER
-#include <dali/integration-api/adaptor.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/public-api/object/object-registry.h>
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
 #include <dali/devel-api/adaptor-framework/style-monitor.h>
-#include <dali/integration-api/render-surface.h>
+#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
+#include <dali/integration-api/adaptor-framework/scene-holder.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/adaptor/common/thread-controller-interface.h>
+#include <dali/internal/window-system/common/window-impl.h>
 
 namespace Dali
 {
-
-Adaptor& Adaptor::New( Window window )
+Adaptor& Adaptor::New(Window window)
 {
-  return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
+  Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation(window);
+  Adaptor*                        adaptor     = Internal::Adaptor::Adaptor::New(Dali::Integration::SceneHolder(sceneHolder), NULL);
+  return *adaptor;
 }
 
-Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
+Adaptor& Adaptor::New(Window window, const Dali::RenderSurfaceInterface& surface)
 {
-  Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
+  Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation(window);
+  Dali::RenderSurfaceInterface*   pSurface    = const_cast<Dali::RenderSurfaceInterface*>(&surface);
+  Adaptor*                        adaptor     = Internal::Adaptor::Adaptor::New(Dali::Integration::SceneHolder(sceneHolder), pSurface, NULL, Dali::Internal::Adaptor::ThreadMode::NORMAL);
   return *adaptor;
 }
 
-Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
+Adaptor& Adaptor::New(Dali::Integration::SceneHolder window)
 {
-  return New( nativeWindow, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
+  Adaptor* adaptor = Internal::Adaptor::Adaptor::New(window, NULL);
+  return *adaptor;
 }
 
-Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
+Adaptor& Adaptor::New(Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface)
 {
-  Dali::RenderSurface* pSurface = const_cast<Dali::RenderSurface *>(&surface);
-  Adaptor* adaptor = Internal::Adaptor::Adaptor::New( nativeWindow, pSurface, configuration, NULL );
+  Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface*>(&surface);
+  Adaptor*                      adaptor  = Internal::Adaptor::Adaptor::New(window, pSurface, NULL, Dali::Internal::Adaptor::ThreadMode::NORMAL);
   return *adaptor;
 }
 
@@ -78,19 +85,39 @@ void Adaptor::Stop()
   mImpl->Stop();
 }
 
-bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
+bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
+{
+  DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
+  return mImpl->AddIdle(callback, hasReturnValue);
+}
+
+bool Adaptor::AddWindow(Dali::Integration::SceneHolder childWindow)
 {
-  return mImpl->AddIdle( callback, hasReturnValue, false );
+  DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
+  return mImpl->AddWindow(childWindow);
 }
 
-void Adaptor::RemoveIdle( CallbackBase* callback )
+void Adaptor::RemoveIdle(CallbackBase* callback)
 {
-  mImpl->RemoveIdle( callback );
+  DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
+  mImpl->RemoveIdle(callback);
 }
 
-void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
+void Adaptor::ProcessIdle()
 {
-  mImpl->ReplaceSurface(nativeWindow, surface);
+  DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
+  mImpl->ProcessIdle();
+}
+
+void Adaptor::ReplaceSurface(Window window, Dali::RenderSurfaceInterface& surface)
+{
+  Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation(window);
+  mImpl->ReplaceSurface(Dali::Integration::SceneHolder(sceneHolder), surface);
+}
+
+void Adaptor::ReplaceSurface(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface)
+{
+  mImpl->ReplaceSurface(window, surface);
 }
 
 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
@@ -103,7 +130,12 @@ Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
   return mImpl->LanguageChangedSignal();
 }
 
-RenderSurface& Adaptor::GetSurface()
+Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
+{
+  return mImpl->WindowCreatedSignal();
+}
+
+Dali::RenderSurfaceInterface& Adaptor::GetSurface()
 {
   return mImpl->GetSurface();
 }
@@ -113,6 +145,11 @@ Any Adaptor::GetNativeWindowHandle()
   return mImpl->GetNativeWindowHandle();
 }
 
+Any Adaptor::GetNativeWindowHandle(Actor actor)
+{
+  return mImpl->GetNativeWindowHandle(actor);
+}
+
 Any Adaptor::GetGraphicsDisplay()
 {
   return mImpl->GetGraphicsDisplay();
@@ -123,19 +160,14 @@ void Adaptor::ReleaseSurfaceLock()
   mImpl->ReleaseSurfaceLock();
 }
 
-void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
-{
-  mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
-}
-
-void Adaptor::SetPreRenderCallback( CallbackBase* callback )
+void Adaptor::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender)
 {
-  mImpl->SetPreRenderCallback( callback );
+  mImpl->SetRenderRefreshRate(numberOfVSyncsPerRender);
 }
 
-void Adaptor::SetUseHardwareVSync(bool useHardware)
+void Adaptor::SetPreRenderCallback(CallbackBase* callback)
 {
-  mImpl->SetUseHardwareVSync( useHardware );
+  mImpl->SetPreRenderCallback(callback);
 }
 
 Adaptor& Adaptor::Get()
@@ -158,22 +190,17 @@ void Adaptor::NotifyLanguageChanged()
   mImpl->NotifyLanguageChanged();
 }
 
-void Adaptor::SetMinimumPinchDistance(float distance)
-{
-  mImpl->SetMinimumPinchDistance(distance);
-}
-
-void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
+void Adaptor::FeedTouchPoint(TouchPoint& point, int timeStamp)
 {
   mImpl->FeedTouchPoint(point, timeStamp);
 }
 
-void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
+void Adaptor::FeedWheelEvent(WheelEvent& wheelEvent)
 {
   mImpl->FeedWheelEvent(wheelEvent);
 }
 
-void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
+void Adaptor::FeedKeyEvent(KeyEvent& keyEvent)
 {
   mImpl->FeedKeyEvent(keyEvent);
 }
@@ -183,18 +210,78 @@ void Adaptor::SceneCreated()
   mImpl->SceneCreated();
 }
 
+void Adaptor::SurfaceResizePrepare(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
+{
+  mImpl->SurfaceResizePrepare(surface, surfaceSize);
+}
+
+void Adaptor::SurfaceResizeComplete(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
+{
+  mImpl->SurfaceResizeComplete(surface, surfaceSize);
+}
+
 void Adaptor::RenderOnce()
 {
   mImpl->RenderOnce();
 }
 
+void Adaptor::FlushUpdateMessages()
+{
+  mImpl->FlushUpdateMessages();
+}
+
+void Adaptor::RequestProcessEventsOnIdle()
+{
+  mImpl->RequestProcessEventsOnIdle();
+}
+
 const LogFactoryInterface& Adaptor::GetLogFactory()
 {
   return mImpl->GetLogFactory();
 }
 
+const TraceFactoryInterface& Adaptor::GetTraceFactory()
+{
+  return mImpl->GetTraceFactory();
+}
+
+void Adaptor::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
+{
+  mImpl->RegisterProcessor(processor, postProcessor);
+}
+
+void Adaptor::UnregisterProcessor(Integration::Processor& processor, bool postProcessor)
+{
+  mImpl->UnregisterProcessor(processor, postProcessor);
+}
+
+Dali::WindowContainer Adaptor::GetWindows() const
+{
+  return mImpl->GetWindows();
+}
+
+SceneHolderList Adaptor::GetSceneHolders() const
+{
+  return mImpl->GetSceneHolders();
+}
+
+Dali::ObjectRegistry Adaptor::GetObjectRegistry() const
+{
+  return mImpl->GetObjectRegistry();
+}
+
+void Adaptor::OnWindowShown()
+{
+  mImpl->OnWindowShown();
+}
+
+void Adaptor::OnWindowHidden()
+{
+  mImpl->OnWindowHidden();
+}
+
 Adaptor::Adaptor()
-: mImpl( NULL )
+: mImpl(NULL)
 {
 }