#include <style-monitor.h>
#include <command-line-options.h>
#include <common/adaptor-impl.h>
+#include <common/framework.h>
#include <singleton-service-impl.h>
#include <lifecycle-controller-impl.h>
mCommandLineOptions = new CommandLineOptions(argc, argv);
mFramework = new Framework( *this, argc, argv, applicationType );
+ mUseRemoteSurface = (applicationType == Framework::WATCH);
}
Application::~Application()
{
mSingletonService.UnregisterAll();
- delete mFramework;
- delete mCommandLineOptions;
- delete mAdaptor;
mWindow.Reset();
+ delete mAdaptor;
+ delete mCommandLineOptions;
+ delete mFramework;
}
void Application::CreateWindow()
mAdaptor = Dali::Internal::Adaptor::Adaptor::New( mWindow, mContextLossConfiguration, &mEnvironmentOptions );
mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize );
+
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetUseRemoteSurface( mUseRemoteSurface );
}
void Application::MainLoop(Dali::Configuration::ContextLoss configuration)
// This will trigger OnTerminate(), below, after the main loop has completed.
}
-void Application::OnInit()
+void Application::DoInit()
{
- mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
-
CreateWindow();
CreateAdaptor();
// Run the adaptor
mAdaptor->Start();
- // Check if user requires no vsyncing and set on X11 Adaptor
+ // Check if user requires no vsyncing and set Adaptor
if (mCommandLineOptions->noVSyncOnRender)
{
mAdaptor->SetUseHardwareVSync(false);
{
Dali::StyleMonitor::Get().SetTheme( mStylesheet );
}
+}
+
+void Application::DoStart()
+{
+ mAdaptor->NotifySceneCreated();
+}
+
+void Application::DoTerminate()
+{
+ if( mAdaptor )
+ {
+ // Ensure that the render-thread is not using the surface(window) after we delete it
+ mAdaptor->Stop();
+ }
+
+ mWindow.Reset();
+}
+
+void Application::DoPause()
+{
+ mAdaptor->Pause();
+}
+
+void Application::DoResume()
+{
+ mAdaptor->Resume();
+}
+
+void Application::DoLanguageChange()
+{
+ mAdaptor->NotifyLanguageChanged();
+}
+
+void Application::OnInit()
+{
+ mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
+
+ DoInit();
// Wire up the LifecycleController
Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
Dali::Application application(this);
mInitSignal.Emit( application );
- mAdaptor->NotifySceneCreated();
+ DoStart();
}
void Application::OnTerminate()
Dali::Application application(this);
mTerminateSignal.Emit( application );
- if( mAdaptor )
- {
- // Ensure that the render-thread is not using the surface(window) after we delete it
- mAdaptor->Stop();
- }
-
- mWindow.Reset();
+ DoTerminate();
}
void Application::OnPause()
{
- mAdaptor->Pause();
+ // A DALi app should handle Pause/Resume events.
+ // DALi just delivers the framework Pause event to the application, but not actually pause DALi core.
+ // Pausing DALi core only occurs on the Window Hidden framework event
Dali::Application application(this);
mPauseSignal.Emit( application );
}
// This ensures we do not just redraw the last frame before pausing if that's not required
Dali::Application application(this);
mResumeSignal.Emit( application );
- mAdaptor->Resume();
+
+ // DALi just delivers the framework Resume event to the application.
+ // Resuming DALi core only occurs on the Window Show framework event
}
void Application::OnReset()
void Application::OnLanguageChanged()
{
- mAdaptor->NotifyLanguageChanged();
+ DoLanguageChange();
Dali::Application application(this);
mLanguageChangedSignal.Emit( application );
}
Dali::RenderSurface* renderSurface = windowImpl.GetSurface();
Any nativeWindow = newWindow.GetNativeHandle();
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SurfaceSizeChanged( windowPosition );
Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(nativeWindow, *renderSurface);
mWindow = newWindow;
}
+std::string Application::GetResourcePath()
+{
+ return Internal::Adaptor::Framework::GetResourcePath();
+}
+
} // namespace Adaptor
} // namespace Internal