X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fadaptor-impl.h;h=428680cb546fc9793bc343619a38c855dea863cb;hb=e8e185f7d90010214890c2cb78bdd52c732f63ba;hp=8d70b83b67caa9e7bd47097ded29b83bc8e77c1a;hpb=761f75cd51351b7a4e072130f4a2ad0b3e3231bb;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h old mode 100644 new mode 100755 index 8d70b83..428680c --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_ADAPTOR_IMPL_H__ -#define __DALI_INTERNAL_ADAPTOR_IMPL_H__ +#ifndef DALI_INTERNAL_ADAPTOR_IMPL_H +#define DALI_INTERNAL_ADAPTOR_IMPL_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -28,11 +28,11 @@ // INTERNAL INCLUDES #include -#include #include -#include #include +#include + #include #include #include @@ -45,16 +45,18 @@ #include #include + namespace Dali { -class RenderSurface; +class RenderSurfaceInterface; class Window; namespace Integration { class Core; class GlAbstraction; +class Processor; } namespace Internal @@ -62,8 +64,9 @@ namespace Internal namespace Adaptor { +class DisplayConnection; +class GraphicsFactory; class EventHandler; -class EglFactory; class GestureManager; class GlImplementation; class GlSyncImplementation; @@ -103,7 +106,7 @@ public: * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. */ static Dali::Adaptor* New( Any nativeWindow, - RenderSurface* surface, + Dali::RenderSurfaceInterface* surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ); @@ -113,12 +116,44 @@ public: * @param[in] configuration The context loss configuration ( to choose resource discard policy ) * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. */ - static Dali::Adaptor* New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ); + static Dali::Adaptor* New( Dali::Window window, + Dali::Configuration::ContextLoss configuration, + EnvironmentOptions* environmentOptions ); + + /** + * Creates a New Adaptor + * @param[in] graphicsFactory A factory that creates the graphics interface + * @param[in] nativeWindow Native window handle + * @param[in] surface A render surface can be one of the following + * - Pixmap, adaptor will use existing Pixmap to draw on to + * - Window, adaptor will use existing Window to draw on to + * @param[in] configuration The context loss configuration ( to choose resource discard policy ) + * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. + */ + static Dali::Adaptor* New( GraphicsFactory& graphicsFactory, + Any nativeWindow, + Dali::RenderSurfaceInterface* surface, + Dali::Configuration::ContextLoss configuration, + EnvironmentOptions* environmentOptions ); + + /** + * Creates a New Adaptor + * @param[in] graphicsFactory A factory that creates the graphics interface + * @param[in] nativeWindow native window handle + * @param[in] configuration The context loss configuration ( to choose resource discard policy ) + * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. + */ + static Dali::Adaptor* New( GraphicsFactory& graphicsFactory, + Dali::Window window, + Dali::Configuration::ContextLoss configuration, + EnvironmentOptions* environmentOptions ); /** * 2-step initialisation, this should be called after creating an adaptor instance. + * @param[in] graphicsFactory A factory that creates the graphics interface + * @param[in] configuration The context loss configuration ( to choose resource discard policy ) */ - void Initialize(Dali::Configuration::ContextLoss configuration); + void Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration::ContextLoss configuration ); /** * Virtual destructor. @@ -189,12 +224,12 @@ public: // AdaptorInternalServices implementation /** * @copydoc AdaptorInterface::ReplaceSurface() */ - virtual void ReplaceSurface( Any nativeWindow, RenderSurface& surface ); + virtual void ReplaceSurface( Any nativeWindow, Dali::RenderSurfaceInterface& surface ); /** * @copydoc Dali::Adaptor::GetSurface() */ - virtual RenderSurface& GetSurface() const; + virtual Dali::RenderSurfaceInterface& GetSurface() const; /** * @copydoc Dali::Adaptor::ReleaseSurfaceLock() @@ -211,13 +246,49 @@ public: // AdaptorInternalServices implementation /** * @copydoc Dali::Adaptor::AddIdle() */ - virtual bool AddIdle( CallbackBase* callback, bool forceAdd ); + virtual bool AddIdle( CallbackBase* callback, bool hasReturnValue, bool forceAdd ); + + /** + * Adds a new Window instance to the Adaptor + * @param[in] childWindow The child window instance + * @param[in] childWindowName The child window title/name + * @param[in] childWindowClassName The class name that the child window belongs to + * @param[in] childWindowMode The mode of the child window + */ + virtual bool AddWindow( Dali::Window* childWindow, + const std::string& childWindowName, + const std::string& childWindowClassName, + const bool& childWindowMode ); + + /** + * Removes an existing Window instance from the Adaptor + * @param[in] window The Window instance + */ + virtual bool RemoveWindow( Dali::Window* childWindow ); + + /** + * Removes an existing Window instance from the Adaptor + * @param[in] windowName The Window name + * @note If two Windows have the same name, the first one that matches will be removed + */ + virtual bool RemoveWindow( std::string childWindowName ); /** * @copydoc Dali::Adaptor::RemoveIdle() */ virtual void RemoveIdle( CallbackBase* callback ); + /** + * Sets a pre-render callback. + */ + void SetPreRenderCallback( CallbackBase* callback ); + + /** + * Removes an existing Window instance from the Adaptor + * @param[in] childWindow The Window instance + */ + bool RemoveWindow( Dali::Internal::Adaptor::Window* childWindow ); + public: /** @@ -236,17 +307,6 @@ public: void SetUseHardwareVSync(bool useHardware); /** - * @return reference to EglFactory class - */ - EglFactory& GetEGLFactory() const; - - /** - * Return GlAbstraction. - * @return the GlAbstraction. - */ - Integration::GlAbstraction& GetGlAbstraction() const; - - /** * Return the PlatformAbstraction. * @return The PlatformAbstraction. */ @@ -266,7 +326,7 @@ public: void SetRotationObserver( RotationObserver* observer ); /** - * Destroy the TtsPlayer of sepcific mode. + * Destroy the TtsPlayer of specific mode. * @param[in] mode The mode of TtsPlayer to destroy */ void DestroyTtsPlayer(Dali::TtsPlayer::Mode mode); @@ -287,7 +347,14 @@ public: Any GetNativeWindowHandle(); /** - * Sets use remote surface for eglSurface output + * Get the native display associated with the graphics backend + * + * @return A handle to the native display + */ + Any GetGraphicsDisplay(); + + /** + * Sets use remote surface for Surface output * @param[in] useRemoteSurface True if the remote surface is used */ void SetUseRemoteSurface(bool useRemoteSurface); @@ -319,11 +386,6 @@ public: void RequestUpdateOnce(); /** - * Request adaptor to update indicator's height - */ - void IndicatorSizeChanged(int height); - - /** * @copydoc Dali::Adaptor::NotifySceneCreated() */ void NotifySceneCreated(); @@ -341,12 +403,12 @@ public: /** * Informs core the surface size has changed */ - void SurfaceResizePrepare( SurfaceSize surfaceSize ); + void SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize ); /** * Informs ThreadController the surface size has changed */ - void SurfaceResizeComplete( SurfaceSize surfaceSize ); + void SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize ); /** * Sets layout direction of root by system language @@ -359,6 +421,21 @@ public: */ void RenderOnce(); + /** + * @copydoc Dali::Adaptor::GetLogFactory + */ + const LogFactoryInterface& GetLogFactory(); + + /** + * @copydoc Dali::Adaptor::RegisterProcessor + */ + void RegisterProcessor( Integration::Processor& processor ); + + /** + * @coydoc Dali::Adaptor::UnregisterProcessor + */ + void UnregisterProcessor( Integration::Processor& processor ); + public: //AdaptorInternalServices /** @@ -367,14 +444,14 @@ public: //AdaptorInternalServices virtual Dali::Integration::PlatformAbstraction& GetPlatformAbstractionInterface(); /** - * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetGlesInterface() + * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetDisplayConnectionInterface() */ - virtual Dali::Integration::GlAbstraction& GetGlesInterface(); + virtual Dali::DisplayConnection& GetDisplayConnectionInterface(); /** - * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetEGLFactoryInterface() - */ - virtual EglFactoryInterface& GetEGLFactoryInterface() const; + * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetGraphicsInterface() + */ + virtual GraphicsInterface& GetGraphicsInterface(); /** * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetTriggerEventInterface() @@ -394,7 +471,7 @@ public: //AdaptorInternalServices /** * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetRenderSurfaceInterface() */ - virtual RenderSurface* GetRenderSurfaceInterface(); + virtual Dali::RenderSurfaceInterface* GetRenderSurfaceInterface(); /** * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetVSyncMonitorInterface() @@ -416,28 +493,6 @@ public: //AdaptorInternalServices */ virtual TraceInterface& GetSystemTraceInterface(); -public: // Stereoscopy - - /** - * @copydoc Dali::Integration::Core::SetViewMode() - */ - void SetViewMode( ViewMode viewMode ); - - /** - * @copydoc Dali::Integration::Core::GetViewMode() - */ - ViewMode GetViewMode() const; - - /** - * @copydoc Dali::Integration::Core::SetStereoBase() - */ - void SetStereoBase( float stereoBase ); - - /** - * @copydoc Dali::Integration::Core::GetStereoBase() - */ - float GetStereoBase() const; - public: // Signals /** @@ -502,8 +557,8 @@ private: // From Dali::Internal::Adaptor::DamageObserver private: // Undefined - Adaptor(const Adaptor&); - Adaptor& operator=(Adaptor&); + Adaptor(const Adaptor&) = delete; + Adaptor& operator=(Adaptor&) = delete; private: @@ -511,7 +566,7 @@ private: * Assigns the render surface to the adaptor * */ - void SetSurface(RenderSurface *surface); + void SetSurface(Dali::RenderSurfaceInterface *surface); /** * called after surface is created @@ -521,7 +576,7 @@ private: /** * Sends an notification message from main loop idle handler */ - void ProcessCoreEventsFromIdle(); + bool ProcessCoreEventsFromIdle(); /** * Gets path for data/resource storage. @@ -534,6 +589,22 @@ private: */ void SetupSystemInformation(); + /** + * Adds a callback to be run when entering an idle state. + * + * A callback of the following type should be used: + * @code + * bool MyFunction(); + * @endcode + * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback. + */ + bool AddIdleEnterer( CallbackBase* callback, bool forceAdd ); + + /** + * Removes a previously added the idle enterer callback. + */ + void RemoveIdleEnterer( CallbackBase* callback ); + private: /** @@ -545,7 +616,7 @@ private: * - Window, adaptor will use existing Window to draw on to * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. */ - Adaptor( Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions ); + Adaptor( Any nativeWindow, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions ); private: // Types @@ -558,6 +629,20 @@ private: // Types STOPPED, ///< Adaptor has been stopped. }; + // A structure to encapsulate each Window instance for the Adaptor to track them + typedef struct WindowPane + { + Dali::Window* instance; ///< Window object + std::string window_name; ///< Name (title)_of the window + std::string class_name; ///< Class name that the window belongs to + bool window_mode; ///< Display mode of the window + Any nativeWindow; ///< window identifier + uint32_t id; ///< unique Window ID + Dali::RenderSurfaceInterface* surface; ///< The surface the Window is bound to + } WindowPane; + + typedef std::vector WindowFrames; + typedef std::vector ObserverContainer; private: // Data @@ -570,12 +655,11 @@ private: // Data Dali::Integration::Core* mCore; ///< Dali Core ThreadController* mThreadController; ///< Controls the threads VSyncMonitor* mVSyncMonitor; ///< Monitors VSync events - GlImplementation* mGLES; ///< GL implementation - GlSyncImplementation* mGlSync; ///< GL Sync implementation - EglFactory* mEglFactory; ///< EGL Factory - Any mNativeWindow; ///< window identifier - RenderSurface* mSurface; ///< Current surface + GraphicsInterface* mGraphics; ///< Graphics interface + Dali::DisplayConnection* mDisplayConnection; ///< Display connection + WindowFrames mWindowFrame; ///< A container of all the Windows that are currently created + TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction EventHandler* mEventHandler; ///< event handler @@ -598,8 +682,9 @@ private: // Data SocketFactory mSocketFactory; ///< Socket factory const bool mEnvironmentOptionsOwned:1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it) bool mUseRemoteSurface; ///< whether the remoteSurface is used or not + public: - inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) {return *adaptor.mImpl;} + inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) { return *adaptor.mImpl; } }; } // namespace Internal @@ -608,4 +693,4 @@ public: } // namespace Dali -#endif // __DALI_INTERNAL_ADAPTOR_IMPL_H__ +#endif // DALI_INTERNAL_ADAPTOR_IMPL_H