From a1d1376266f78c4b4ac64d823c5e20826bae358c Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Thu, 14 Mar 2019 11:29:26 +0000 Subject: [PATCH] Deprecate Application::ReplaceWindow Change-Id: I1b159c803887ffaecf7b69762fba095c24dd64dd --- dali/internal/adaptor/common/application-impl.cpp | 15 ++++++++------- dali/internal/adaptor/common/application-impl.h | 2 ++ dali/public-api/adaptor-framework/application.cpp | 2 ++ dali/public-api/adaptor-framework/application.h | 5 +++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index 0cf2228..4828729 100755 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -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 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() diff --git a/dali/internal/adaptor/common/application-impl.h b/dali/internal/adaptor/common/application-impl.h index f7097ae..1c1673d 100755 --- a/dali/internal/adaptor/common/application-impl.h +++ b/dali/internal/adaptor/common/application-impl.h @@ -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; diff --git a/dali/public-api/adaptor-framework/application.cpp b/dali/public-api/adaptor-framework/application.cpp index 3405faf..676d658 100644 --- a/dali/public-api/adaptor-framework/application.cpp +++ b/dali/public-api/adaptor-framework/application.cpp @@ -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); } diff --git a/dali/public-api/adaptor-framework/application.h b/dali/public-api/adaptor-framework/application.h index 7488f5a..b5a0666 100644 --- a/dali/public-api/adaptor-framework/application.h +++ b/dali/public-api/adaptor-framework/application.h @@ -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 -- 2.7.4