+
+ // Application is created in Main thread whether UI Threading is enabled or not.
+ // But some resources are created in Main thread or UI thread.
+ // The below code is for the resource are created in Main thread.
+ if(!mUseUiThread)
+ {
+ delete mAdaptor;
+ delete mAdaptorBuilder;
+ if(mIsSystemInitialized)
+ {
+ WindowSystem::Shutdown();
+ }
+ }
+ else
+ {
+ if(mUIThreadLoader)
+ {
+ delete mUIThreadLoader;
+ }
+ }
+}
+
+void Application::StoreWindowPositionSize(PositionSize positionSize)
+{
+ mWindowPositionSize = positionSize;
+}
+
+void Application::StoreFrontBufferRendering(bool enable)
+{
+ mIsMainWindowFrontBufferRendering = enable;
+}
+
+void Application::ChangePreInitializedWindowInfo()
+{
+ // Set window name
+ auto windowClassName = mEnvironmentOptions->GetWindowClassName();
+ auto windowName = mEnvironmentOptions->GetWindowName();
+ if(!windowName.empty())
+ {
+ mMainWindowName = windowName;
+ }
+ mMainWindow.SetClass(mMainWindowName, windowClassName);
+
+ // The real screen size may be different from the value of the preinitialized state. Update it.
+ Dali::Internal::Adaptor::WindowSystem::UpdateScreenSize();
+
+ int screenWidth, screenHeight;
+ Dali::Internal::Adaptor::WindowSystem::GetScreenSize(screenWidth, screenHeight);
+
+ // Set window position / size
+ if(mWindowPositionSize != PositionSize(0, 0, 0, 0))
+ {
+ Dali::DevelWindow::SetPositionSize(mMainWindow, mWindowPositionSize);
+ }
+ else if(mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0)
+ {
+ // Command line options override environment options and full screen
+ mWindowPositionSize.width = mCommandLineOptions->stageWidth;
+ mWindowPositionSize.height = mCommandLineOptions->stageHeight;
+ mMainWindow.SetSize(Dali::Window::WindowSize(mWindowPositionSize.width, mWindowPositionSize.height));
+ }
+ else if(mEnvironmentOptions->GetWindowWidth() && mEnvironmentOptions->GetWindowHeight())
+ {
+ // Environment options override full screen functionality if command line arguments not provided
+ mWindowPositionSize.width = mEnvironmentOptions->GetWindowWidth();
+ mWindowPositionSize.height = mEnvironmentOptions->GetWindowHeight();
+ mMainWindow.SetSize(Dali::Window::WindowSize(mWindowPositionSize.width, mWindowPositionSize.height));
+ }
+ else if(screenWidth != mWindowPositionSize.width || screenHeight != mWindowPositionSize.height)
+ {
+ // Some apps can receive screen size differently after launching by specifying size in manifest.
+ mWindowPositionSize.width = screenWidth;
+ mWindowPositionSize.height = screenHeight;
+ mMainWindow.SetSize(Dali::Window::WindowSize(mWindowPositionSize.width, mWindowPositionSize.height));
+ }
+
+ // Set front buffer rendering
+ Dali::DevelWindow::SetFrontBufferRendering(mMainWindow, mIsMainWindowFrontBufferRendering);