// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/style-monitor.h>
#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/internal/system/common/command-line-options.h>
#include <dali/internal/adaptor/common/framework.h>
#include <dali/internal/system/common/singleton-service-impl.h>
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
mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
CreateAdaptorBuilder();
-
// If an application was pre-initialized, a window was made in advance
if( mLaunchpadState == Launchpad::NONE )
{
// 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 );
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);
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;