namespace Adaptor
{
+ApplicationPtr Application::gPreInitializedApplication( NULL );
+
ApplicationPtr Application::New(
int* argc,
char **argv[],
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
+ }
+}
+
Application::Application( int* argc, char** argv[], const std::string& stylesheet,
Dali::Application::WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType )
: mInitSignal(),
mStylesheet( stylesheet ),
mEnvironmentOptions(),
mWindowPositionSize( positionSize ),
+ mLaunchpadState( Launchpad::NONE ),
mSlotDelegate( this )
{
// Get mName from environment options
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
return Internal::Adaptor::Framework::GetResourcePath();
}
+void Application::SetStyleSheet( const std::string& stylesheet )
+{
+ mStylesheet = stylesheet;
+}
+
+
+ApplicationPtr Application::GetPreInitializedApplication()
+{
+ return gPreInitializedApplication;
+}
+
} // namespace Adaptor
} // namespace Internal
namespace Adaptor
{
+
+namespace Launchpad
+{
+
+/**
+ * @brief Launchpad is used to improve application launch performance.
+ * When an application is pre-initialized, so files are preloaded, some functions are initialized and a window is made in advance.
+ */
+enum State
+{
+ NONE, ///< The default state
+ PRE_INITIALIZED ///< Application is pre-initialized.
+};
+
+} // namespace Launchpad
+
class CommandLineOptions;
class EventLoop;
class Application : public BaseObject, public Framework::Observer
{
public:
+
typedef Dali::Application::AppSignalType AppSignalType;
typedef Dali::Application::AppControlSignalType AppControlSignalType;
typedef Dali::Application::WINDOW_MODE WINDOW_MODE;
static ApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet,
WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType );
+ /**
+ * @copydoc Dali::DevelApplication::PreInitialize()
+ */
+ static void PreInitialize( int* argc, char** argv[] );
+
public:
/**
*/
static std::string GetResourcePath();
+ /**
+ * Retrieves the pre-initialized application.
+ *
+ * @return A pointer to the pre-initialized application
+ */
+ static ApplicationPtr GetPreInitializedApplication();
+
public: // Stereoscopy
/**
*/
void OnResize(Dali::Adaptor& adaptor);
+ /**
+ * Sets a user defined theme file.
+ * This should be called before initialization.
+ * @param[in] stylesheet The path to user defined theme file
+ */
+ void SetStyleSheet( const std::string& stylesheet );
+
public: // Signals
/**
std::string mStylesheet;
EnvironmentOptions mEnvironmentOptions;
PositionSize mWindowPositionSize;
+ Launchpad::State mLaunchpadState;
bool mUseRemoteSurface;
SlotDelegate< Application > mSlotDelegate;
+
+ static ApplicationPtr gPreInitializedApplication;
};
inline Application& GetImplementation(Dali::Application& application)
Dali::DevelWindow::WindowPosition GetPosition();
/**
+ * @copydoc Dali::DevelWindow::SetTransparency()
+ */
+ void SetTransparency( bool transparent );
+
+ /**
* Called from Orientation after the Change signal has been sent
*/
void RotationDone( int orientation, int width, int height );
// INTERNAL INCLUDES
#include <adaptors/devel-api/adaptor-framework/application-devel.h>
+#include <adaptors/devel-api/adaptor-framework/window-devel.h>
#include <adaptors/common/application-impl.h>
namespace Dali
Application New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize )
{
- Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL );
- return Application( internal.Get() );
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
+ if( internal )
+ {
+ if( argc && ( *argc > 0 ) )
+ {
+ internal->GetWindow().SetClass( (*argv)[0], "" );
+ }
+ internal->SetStyleSheet( stylesheet );
+
+ DevelWindow::SetTransparency( internal->GetWindow(), ( windowMode == Application::OPAQUE ? false : true ) );
+ DevelWindow::SetSize( internal->GetWindow(), DevelWindow::WindowSize( positionSize.width, positionSize.height ) );
+ DevelWindow::SetPosition( internal->GetWindow(), DevelWindow::WindowPosition( positionSize.x, positionSize.y ) );
+
+ return Application( internal.Get() );
+ }
+ else
+ {
+ internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL );
+ return Application( internal.Get() );
+ }
+}
+
+void PreInitialize( int* argc, char** argv[] )
+{
+ Internal::Adaptor::Application::PreInitialize( argc, argv );
}
} // namespace DevelApplication
*/
DALI_IMPORT_API Application New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize );
+/**
+ * @brief This is used to improve application launch performance.
+ * It preloads so files, initializes some functions in advance and makes a window in advance.
+ *
+ * @param[in,out] argc A pointer to the number of arguments
+ * @param[in,out] argv A pointer to the argument list
+ */
+DALI_IMPORT_API void PreInitialize( int* argc, char** argv[] );
+
} // namespace DevelApplication
} // namespace Dali
return GetImplementation( window ).GetPosition();
}
+void SetTransparency( Window window, bool transparent )
+{
+ GetImplementation( window ).SetTransparency( transparent );
+}
+
} // namespace DevelWindow
} // namespace Dali
*/
DALI_IMPORT_API WindowPosition GetPosition( Window window );
+/**
+ * @brief Sets whether the window is transparent or not.
+ *
+ * @param[in] window The window to set transparency
+ * @param[in] transparent Whether the window is transparent
+ */
+DALI_IMPORT_API void SetTransparency( Window window, bool transparent );
+
} // namespace DevelWindow
} // namespace Dali
return Dali::DevelWindow::WindowPosition( positionSize.x, positionSize.y );
}
+void Window::SetTransparency( bool transparent )
+{
+ ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
+ wlSurface->SetTransparency( transparent );
+}
+
} // Adaptor
} // Internal
}
}
+void WindowRenderSurface::SetTransparency( bool transparent )
+{
+ ecore_wl_window_alpha_set( mWlWindow, transparent );
+}
+
void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
{
DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
*/
void RequestRotation( Dali::Window::WindowOrientation orientation, int width, int height );
+ /**
+ * @brief Sets whether the surface is transparent or not.
+ *
+ * @param[in] transparent Whether the surface is transparent
+ */
+ void SetTransparency( bool transparent );
+
public: // from Dali::RenderSurface
/**
Application Application::New( int* argc, char **argv[] )
{
- Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(),
- Internal::Adaptor::Framework::NORMAL);
- return Application(internal.Get());
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
+ if( internal )
+ {
+ if( argc && ( *argc > 0 ) )
+ {
+ internal->GetWindow().SetClass( (*argv)[0], "" );
+ }
+
+ return Application( internal.Get() );
+ }
+ else
+ {
+ internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(),
+ Internal::Adaptor::Framework::NORMAL);
+ return Application(internal.Get());
+ }
}
Application Application::New( int* argc, char **argv[], const std::string& stylesheet )
{
- Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(),
- Internal::Adaptor::Framework::NORMAL);
- return Application(internal.Get());
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
+ if( internal )
+ {
+ if( argc && ( *argc > 0 ) )
+ {
+ internal->GetWindow().SetClass( (*argv)[0], "" );
+ }
+ internal->SetStyleSheet( stylesheet );
+
+ return Application( internal.Get() );
+ }
+ else
+ {
+ internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(),
+ Internal::Adaptor::Framework::NORMAL);
+ return Application(internal.Get());
+ }
}
Application Application::New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode )
{
- Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(),
- Internal::Adaptor::Framework::NORMAL);
- return Application(internal.Get());
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
+ if( internal )
+ {
+ if( argc && ( *argc > 0 ) )
+ {
+ internal->GetWindow().SetClass( (*argv)[0], "" );
+ }
+ internal->SetStyleSheet( stylesheet );
+
+ DevelWindow::SetTransparency( internal->GetWindow(), ( windowMode == Application::OPAQUE ? false : true ) );
+
+ return Application( internal.Get() );
+ }
+ else
+ {
+ internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(),
+ Internal::Adaptor::Framework::NORMAL);
+ return Application(internal.Get());
+ }
}
Application::~Application()
return Dali::DevelWindow::WindowPosition( positionSize.x, positionSize.y );
}
+void Window::SetTransparency( bool transparent )
+{
+}
+
} // Adaptor
} // Internal
} // Dali
return Dali::DevelWindow::WindowPosition( positionSize.x, positionSize.y );
}
+void Window::SetTransparency( bool transparent )
+{
+}
+
} // Adaptor
} // Internal