X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fapplication-impl.cpp;h=98ef0db9e862fa75f17d26a67cdddc3d3644da4a;hb=aae144428d03c9e315384225ad33c057b42ea408;hp=6f58fbaf45ccfdc97091b4e2c22afd4c8f1fde51;hpb=34aec01c5e704ac218b08d007426da6f941b801e;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 6f58fba..98ef0db 100755 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -20,13 +20,14 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include #include +#include #include #include -#include #include #include #include @@ -80,9 +81,7 @@ 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 @@ -109,7 +108,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(), @@ -139,7 +137,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; @@ -229,7 +232,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 ) { @@ -241,12 +243,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 ); @@ -355,6 +351,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); @@ -441,6 +461,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;