Revert "[Tizen] Temporarily modified so that window is no null if multi-window is...
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / window.cpp
index 2e6a28c..9d8c830 100644 (file)
@@ -33,24 +33,41 @@ class DALI_INTERNAL DragAndDropDetector : public BaseHandle {}; // Empty class o
 
 Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
 {
-  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
-
-  Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
-  Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
-  Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, "", isTransparent );
-
-  return Window(window);
+  return Dali::Window::New(posSize, name, "", isTransparent);
 }
 
 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
 {
-  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
+  Window newWindow;
+
+  const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
+  bool isNewWindowAllowed = true;
+
+  if (isAdaptorAvailable)
+  {
+    Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
+    isNewWindowAllowed = Internal::Adaptor::Adaptor::GetImplementation(adaptor).IsMultipleWindowSupported();
+  }
+
+  if (isNewWindowAllowed)
+  {
+    Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
+
+    Integration::SceneHolder sceneHolder = Integration::SceneHolder(window);
 
-  Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
-  Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
-  Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, className, isTransparent );
+    if (isAdaptorAvailable)
+    {
+      Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
+      Internal::Adaptor::Adaptor::GetImplementation(adaptor).AddWindow(sceneHolder, name, className, isTransparent);
+    }
+    newWindow = Window(window);
+  }
+  else
+  {
+    DALI_LOG_ERROR("This device can't support multiple windows.\n");
+  }
 
-  return Window(window);
+  return newWindow;
 }
 
 Window::Window()
@@ -165,7 +182,7 @@ void Window::RemoveAvailableOrientation( WindowOrientation orientation )
   GetImplementation(*this).RemoveAvailableOrientation( orientation );
 }
 
-void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
+void Window::SetPreferredOrientation( WindowOrientation orientation )
 {
   GetImplementation(*this).SetPreferredOrientation( orientation );
 }
@@ -189,9 +206,15 @@ Any Window::GetNativeHandle() const
 
 Window::FocusSignalType& Window::FocusChangedSignal()
 {
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: FocusChangedSignal is deprecated and will be removed from next release.\n" );
   return GetImplementation(*this).FocusChangedSignal();
 }
 
+Window::FocusChangeSignalType& Window::FocusChangeSignal()
+{
+  return GetImplementation(*this).FocusChangeSignal();
+}
+
 void Window::SetAcceptFocus( bool accept )
 {
   GetImplementation(*this).SetAcceptFocus( accept );
@@ -309,9 +332,15 @@ int Window::GetBrightness() const
 
 Window::ResizedSignalType& Window::ResizedSignal()
 {
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ResizedSignal is deprecated and will be removed from next release.\n" );
   return GetImplementation(*this).ResizedSignal();
 }
 
+Window::ResizeSignalType& Window::ResizeSignal()
+{
+  return GetImplementation(*this).ResizeSignal();
+}
+
 void Window::SetSize( Window::WindowSize size )
 {
   GetImplementation(*this).SetSize( size );