/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <singleton-service-impl.h>
#include <lifecycle-controller-impl.h>
+// CONDITIONAL INCLUDES
+#ifdef DALI_ELDBUS_AVAILABLE
+#include <Eldbus.h>
+#endif // DALI_ELDBUS_AVAILABLE
+
namespace Dali
{
namespace Adaptor
{
+#if defined(DEBUG_ENABLED)
+namespace
+{
+Integration::Log::Filter* gDBusLogging = Integration::Log::Filter::New( Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_DBUS" );
+} // anonymous namespace
+#endif
+
ApplicationPtr Application::New(
int* argc,
char **argv[],
const std::string& stylesheet,
- Dali::Application::WINDOW_MODE windowMode)
+ Dali::Application::WINDOW_MODE windowMode,
+ Framework::Type applicationType)
{
- ApplicationPtr application ( new Application (argc, argv, stylesheet, windowMode ) );
+ ApplicationPtr application ( new Application (argc, argv, stylesheet, windowMode, applicationType ) );
return application;
}
-Application::Application( int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode )
+Application::Application( int* argc, char** argv[], const std::string& stylesheet,
+ Dali::Application::WINDOW_MODE windowMode, Framework::Type applicationType )
: mInitSignal(),
mTerminateSignal(),
mPauseSignal(),
}
mCommandLineOptions = new CommandLineOptions(argc, argv);
-
- mFramework = new Framework( *this, argc, argv );
+ mFramework = new Framework( *this, argc, argv, applicationType );
+ mUseRemoteSurface = (applicationType == Framework::WATCH);
}
Application::~Application()
delete mFramework;
delete mCommandLineOptions;
delete mAdaptor;
+
+#ifdef DALI_ELDBUS_AVAILABLE
+ // Shutdown ELDBus.
+ DALI_LOG_INFO( gDBusLogging, Debug::General, "Shutting down DBus\n" );
+ eldbus_shutdown();
+#endif
+
mWindow.Reset();
}
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)
{
mAdaptor->Stop();
- Dali::Application application(this);
- mTerminateSignal.Emit( application );
-
mFramework->Quit();
// This will trigger OnTerminate(), below, after the main loop has completed.
}
mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
CreateWindow();
- CreateAdaptor();
- // Run the adaptor
+#ifdef DALI_ELDBUS_AVAILABLE
+ // Initialize ElDBus.
+ DALI_LOG_INFO( gDBusLogging, Debug::General, "Starting DBus Initialization\n" );
+ eldbus_init();
+#endif
+
+ // Start the adaptor
+ CreateAdaptor();
mAdaptor->Start();
// Check if user requires no vsyncing and set on X11 Adaptor
// we've been told to quit by AppCore, ecore_x_destroy has been called, need to quit synchronously
// delete the window as ecore_x has been destroyed by AppCore
+ Dali::Application application(this);
+ mTerminateSignal.Emit( application );
+
if( mAdaptor )
{
// Ensure that the render-thread is not using the surface(window) after we delete it
void Application::OnResume()
{
- mAdaptor->Resume();
+ // Emit the signal first so the application can queue any messages before we do an update/render
+ // 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();
}
void Application::OnReset()
*/
Dali::Application application(this);
mResetSignal.Emit( application );
-
- mWindow.Raise();
}
void Application::OnAppControl(void *data)
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;
}