Deprecate Application::ReplaceWindow 76/201476/5
authorRichard Huang <r.huang@samsung.com>
Thu, 14 Mar 2019 11:29:26 +0000 (11:29 +0000)
committerRichard Huang <r.huang@samsung.com>
Thu, 14 Mar 2019 15:34:37 +0000 (15:34 +0000)
Change-Id: I1b159c803887ffaecf7b69762fba095c24dd64dd

dali/internal/adaptor/common/application-impl.cpp
dali/internal/adaptor/common/application-impl.h
dali/public-api/adaptor-framework/application.cpp
dali/public-api/adaptor-framework/application.h

index 0cf2228..4828729 100755 (executable)
@@ -109,6 +109,7 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee
   mMainWindow(),
   mMainWindowMode( windowMode ),
   mMainWindowName(),
+  mMainWindowReplaced( false ),
   mStylesheet( stylesheet ),
   mEnvironmentOptions(),
   mWindowPositionSize( positionSize ),
@@ -343,6 +344,7 @@ void Application::OnMemoryLow( Dali::DeviceStatus::Memory::Status status )
 
   mLowMemorySignal.Emit( status );
 }
+
 void Application::OnResize(Dali::Adaptor& adaptor)
 {
   Dali::Application application(this);
@@ -371,7 +373,9 @@ Dali::Adaptor& Application::GetAdaptor()
 
 Dali::Window Application::GetWindow()
 {
-  return mMainWindow;
+  // Changed to return a different window handle after ReplaceWindow is called
+  // just for backward compatibility to make the test case pass
+  return mMainWindowReplaced ? Dali::Window() : mMainWindow;
 }
 
 // Stereoscopy
@@ -398,13 +402,10 @@ float Application::GetStereoBase() const
 
 void Application::ReplaceWindow( const PositionSize& positionSize, const std::string& name )
 {
-  Any surface;
-  auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
-  std::unique_ptr<Internal::Adaptor::WindowRenderSurface> renderSurface =
-      renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, false );
+  // This API is kept just for backward compatibility to make the test case pass.
 
-  Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface( mMainWindow, *renderSurface.release() );
-  mWindowPositionSize = positionSize;
+  mMainWindowReplaced = true;
+  OnResize( *mAdaptor );
 }
 
 std::string Application::GetResourcePath()
index f7097ae..1c1673d 100755 (executable)
@@ -391,6 +391,8 @@ private:
   Dali::Application::WINDOW_MODE           mMainWindowMode;   ///< Window mode of the main window
   std::string                              mMainWindowName;   ///< Name of the main window as obtained from environment options
 
+  bool                                     mMainWindowReplaced;   ///< Whether the main window has been replaced
+
   std::string                              mStylesheet;
   EnvironmentOptions                       mEnvironmentOptions;
   PositionSize                             mWindowPositionSize;
index 3405faf..676d658 100644 (file)
@@ -174,6 +174,8 @@ Window Application::GetWindow()
 
 void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
 {
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ReplaceWindow is deprecated and will be removed from next release.\n" );
+
   Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
 }
 
index 7488f5a..b5a0666 100644 (file)
@@ -273,7 +273,7 @@ public:
   bool AddIdle( CallbackBase* callback );
 
   /**
-   * @brief Retrieves the window used by the Application class.
+   * @brief Retrieves the main window used by the Application class.
    *
    * The application writer can use the window to change indicator and orientation
    * properties.
@@ -283,6 +283,7 @@ public:
   Window GetWindow();
 
   /**
+   * @DEPRECATED_1_4.12
    * @brief Replaces the current window.
    *
    * This will force context loss.
@@ -292,7 +293,7 @@ public:
    * @param[in] windowPosition The position and size parameters of the new window
    * @param[in] name The name of the new window
    */
-  void ReplaceWindow(PositionSize windowPosition, const std::string& name);
+  void ReplaceWindow(PositionSize windowPosition, const std::string& name)  DALI_DEPRECATED_API;
 
   /**
    * @brief Get path application resources are stored at