projects
/
platform
/
core
/
uifw
/
dali-adaptor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move ELDbus init & shutdown to DALi::Application
[platform/core/uifw/dali-adaptor.git]
/
adaptors
/
common
/
application-impl.cpp
diff --git
a/adaptors/common/application-impl.cpp
b/adaptors/common/application-impl.cpp
index
0407b78
..
dece482
100644
(file)
--- a/
adaptors/common/application-impl.cpp
+++ b/
adaptors/common/application-impl.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 201
4
Samsung Electronics Co., Ltd.
+ * Copyright (c) 201
6
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-28,6
+28,11
@@
#include <singleton-service-impl.h>
#include <lifecycle-controller-impl.h>
#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 Dali
{
@@
-47,17
+52,26
@@
namespace Internal
namespace Adaptor
{
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,
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;
}
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(),
: mInitSignal(),
mTerminateSignal(),
mPauseSignal(),
@@
-80,7
+94,6
@@
Application::Application( int* argc, char** argv[], const std::string& styleshee
mName(),
mStylesheet( stylesheet ),
mEnvironmentOptions(),
mName(),
mStylesheet( stylesheet ),
mEnvironmentOptions(),
- mInitialized( false ),
mSlotDelegate( this )
{
// Get mName from environment options
mSlotDelegate( this )
{
// Get mName from environment options
@@
-92,8
+105,8
@@
Application::Application( int* argc, char** argv[], const std::string& styleshee
}
mCommandLineOptions = new CommandLineOptions(argc, argv);
}
mCommandLineOptions = new CommandLineOptions(argc, argv);
-
- m
Framework = new Framework( *this, argc, argv
);
+ mFramework = new Framework( *this, argc, argv, applicationType );
+ m
UseRemoteSurface = (applicationType == Framework::WATCH
);
}
Application::~Application()
}
Application::~Application()
@@
-103,6
+116,13
@@
Application::~Application()
delete mFramework;
delete mCommandLineOptions;
delete mAdaptor;
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();
}
mWindow.Reset();
}
@@
-123,6
+143,9
@@
void Application::CreateWindow()
const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
mWindow = Dali::Window::New( windowPosition, mName, windowClassName, mWindowMode == Dali::Application::TRANSPARENT );
const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
mWindow = Dali::Window::New( windowPosition, mName, windowClassName, mWindowMode == Dali::Application::TRANSPARENT );
+
+ // Quit the application when the window is closed
+ GetImplementation( mWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
}
void Application::CreateAdaptor()
}
void Application::CreateAdaptor()
@@
-132,6
+155,8
@@
void Application::CreateAdaptor()
mAdaptor = Dali::Internal::Adaptor::Adaptor::New( mWindow, mContextLossConfiguration, &mEnvironmentOptions );
mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize );
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)
}
void Application::MainLoop(Dali::Configuration::ContextLoss configuration)
@@
-158,12
+183,8
@@
void Application::QuitFromMainLoop()
{
mAdaptor->Stop();
{
mAdaptor->Stop();
- Dali::Application application(this);
- mTerminateSignal.Emit( application );
-
mFramework->Quit();
// This will trigger OnTerminate(), below, after the main loop has completed.
mFramework->Quit();
// This will trigger OnTerminate(), below, after the main loop has completed.
- mInitialized = false;
}
void Application::OnInit()
}
void Application::OnInit()
@@
-171,9
+192,15
@@
void Application::OnInit()
mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
CreateWindow();
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
mAdaptor->Start();
// Check if user requires no vsyncing and set on X11 Adaptor
@@
-198,8
+225,6
@@
void Application::OnInit()
Dali::StyleMonitor::Get().SetTheme( mStylesheet );
}
Dali::StyleMonitor::Get().SetTheme( mStylesheet );
}
- mInitialized = true;
-
// Wire up the LifecycleController
Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
// Wire up the LifecycleController
Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
@@
-222,8
+247,16
@@
void Application::OnTerminate()
// 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
// 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
+ mAdaptor->Stop();
+ }
+
mWindow.Reset();
mWindow.Reset();
- mInitialized = false;
}
void Application::OnPause()
}
void Application::OnPause()
@@
-235,9
+268,11
@@
void Application::OnPause()
void Application::OnResume()
{
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 );
Dali::Application application(this);
mResumeSignal.Emit( application );
+ mAdaptor->Resume();
}
void Application::OnReset()
}
void Application::OnReset()
@@
-248,8
+283,6
@@
void Application::OnReset()
*/
Dali::Application application(this);
mResetSignal.Emit( application );
*/
Dali::Application application(this);
mResetSignal.Emit( application );
-
- mWindow.Raise();
}
void Application::OnAppControl(void *data)
}
void Application::OnAppControl(void *data)