Revert "[4.0] Enhance application device signal"
[platform/core/uifw/dali-adaptor.git] / adaptors / common / application-impl.cpp
index cd05c95..5e73d5e 100644 (file)
@@ -48,6 +48,8 @@ namespace Internal
 namespace Adaptor
 {
 
+ApplicationPtr Application::gPreInitializedApplication( NULL );
+
 ApplicationPtr Application::New(
   int* argc,
   char **argv[],
@@ -60,6 +62,18 @@ ApplicationPtr Application::New(
   return application;
 }
 
+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;
+  }
+}
+
 Application::Application( int* argc, char** argv[], const std::string& stylesheet,
   Dali::Application::WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType )
 : mInitSignal(),
@@ -85,6 +99,7 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee
   mStylesheet( stylesheet ),
   mEnvironmentOptions(),
   mWindowPositionSize( positionSize ),
+  mLaunchpadState( Launchpad::NONE ),
   mSlotDelegate( this )
 {
   // Get mName from environment options
@@ -176,7 +191,12 @@ void Application::QuitFromMainLoop()
 
 void Application::DoInit()
 {
-  CreateWindow();
+  // If an application was pre-initialized, a window was made in advance
+  if( mLaunchpadState == Launchpad::NONE )
+  {
+    CreateWindow();
+  }
+
   CreateAdaptor();
 
   // Run the adaptor
@@ -384,7 +404,6 @@ void Application::ReplaceWindow( const PositionSize& positionSize, const std::st
   Dali::RenderSurface* renderSurface = windowImpl.GetSurface();
 
   Any nativeWindow = newWindow.GetNativeHandle();
-  Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SurfaceSizeChanged( Dali::Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
   Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(nativeWindow, *renderSurface);
   mWindow = newWindow;
   mWindowPositionSize = positionSize;
@@ -395,6 +414,17 @@ std::string Application::GetResourcePath()
   return Internal::Adaptor::Framework::GetResourcePath();
 }
 
+void Application::SetStyleSheet( const std::string& stylesheet )
+{
+  mStylesheet = stylesheet;
+}
+
+
+ApplicationPtr Application::GetPreInitializedApplication()
+{
+  return gPreInitializedApplication;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal