X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fapplication-impl.cpp;h=28ac1a38991932c5534b4a0f8643a9d0b04cca2c;hb=9b4a4c99a96f770fbed93a3fd03583c780ee641f;hp=2a7fc31bb91794c45c58aab5d37c18f0476a51b4;hpb=b2ec2f8a7c63ea624d25081dddf885b9d1d508f7;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index 2a7fc31..28ac1a3 100755 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include @@ -27,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -81,15 +81,8 @@ void Application::PreInitialize( int* argc, char** argv[] ) if( !gPreInitializedApplication ) { gPreInitializedApplication = new Application ( argc, argv, "", Dali::Application::OPAQUE, PositionSize(), Framework::NORMAL ); - gPreInitializedApplication->CreateWindow(); // Only create window - gPreInitializedApplication->mLaunchpadState = Launchpad::PRE_INITIALIZED; - - //Make DefaultFontDescription cached - Dali::TextAbstraction::FontClient fontClient = Dali::TextAbstraction::FontClient::Get(); - Dali::TextAbstraction::FontDescription defaultFontDescription; - fontClient.GetDefaultPlatformFontDescription( defaultFontDescription ); } } @@ -110,7 +103,6 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee mFramework( nullptr ), mContextLossConfiguration( Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ), mCommandLineOptions( nullptr ), - mSingletonService( SingletonService::New() ), mAdaptorBuilder( nullptr ), mAdaptor( nullptr ), mMainWindow(), @@ -140,7 +132,12 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee Application::~Application() { - mSingletonService.UnregisterAll(); + SingletonService service = SingletonService::Get(); + // Note this can be false i.e. if Application has never created a Core instance + if( service ) + { + service.UnregisterAll(); + } mMainWindow.Reset(); delete mAdaptor; @@ -230,7 +227,6 @@ void Application::OnInit() mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) ); CreateAdaptorBuilder(); - // If an application was pre-initialized, a window was made in advance if( mLaunchpadState == Launchpad::NONE ) { @@ -242,12 +238,6 @@ void Application::OnInit() // Run the adaptor mAdaptor->Start(); - // Check if user requires no vsyncing and set Adaptor - if (mCommandLineOptions->noVSyncOnRender) - { - mAdaptor->SetUseHardwareVSync(false); - } - if( ! mStylesheet.empty() ) { Dali::StyleMonitor::Get().SetTheme( mStylesheet ); @@ -356,6 +346,30 @@ void Application::OnMemoryLow( Dali::DeviceStatus::Memory::Status status ) mLowMemorySignal.Emit( status ); } +void Application::OnSurfaceCreated( Any newSurface ) +{ + void* newWindow = AnyCast< void* >( newSurface ); + void* oldWindow = AnyCast< void* >( mMainWindow.GetNativeHandle() ); + if( oldWindow != newWindow ) + { + auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory(); + std::unique_ptr< WindowRenderSurface > newSurfacePtr + = renderSurfaceFactory->CreateWindowRenderSurface( PositionSize(), newSurface, true ); + + mAdaptor->ReplaceSurface( mMainWindow, *newSurfacePtr.release() ); + } +} + +void Application::OnSurfaceDestroyed( Any surface ) +{ + void* windowToDelete = AnyCast< void* >( surface ); + void* oldWindow = AnyCast< void* >( mMainWindow.GetNativeHandle() ); + if( oldWindow == windowToDelete ) + { + mAdaptor->DeleteSurface( mAdaptor->GetSurface() ); + } +} + void Application::OnResize(Dali::Adaptor& adaptor) { Dali::Application application(this); @@ -442,6 +456,15 @@ void Application::SetStyleSheet( const std::string& stylesheet ) mStylesheet = stylesheet; } +void Application::SetCommandLineOptions( int* argc, char **argv[] ) +{ + delete mCommandLineOptions; + + mCommandLineOptions = new CommandLineOptions( argc, argv ); + + mFramework->SetCommandLineOptions( argc, argv ); +} + ApplicationPtr Application::GetPreInitializedApplication() { return gPreInitializedApplication;