X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fadaptor-impl.h;h=c2a9ad4a0392416563598016f98ddb39b7a4bc46;hb=aecc2d4c642e0cdf360e56accd3e5b96622a707f;hp=9b61083bc45cfaf143e0c3b9923e3e6b5ea01190;hpb=cbd5f6a3aa51671c2fceb1ec93f3576e7ba2a93d;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 index 9b61083..c2a9ad4 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_ADAPTOR_IMPL_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -27,32 +27,27 @@ #include // INTERNAL INCLUDES -#include -#include #include #include - +#include +#include +#include +#include +#include #include - #include -#include -#include +#include #include -#include -#include -#include -#include +#include #include #include -#include -#include - +#include +#include namespace Dali { class RenderSurfaceInterface; -class Window; namespace Integration { @@ -68,7 +63,6 @@ namespace Adaptor { class DisplayConnection; class GraphicsFactory; -class GestureManager; class GlImplementation; class GlSyncImplementation; class ThreadController; @@ -80,6 +74,8 @@ class VSyncMonitor; class PerformanceInterface; class LifeCycleObserver; class ObjectProfiler; +class SceneHolder; +class ConfigurationManager; /** * Implementation of the Adaptor class. @@ -92,9 +88,10 @@ class Adaptor : public Integration::RenderController, { public: - typedef Dali::Adaptor::AdaptorSignalType AdaptorSignalType; + using AdaptorSignalType = Dali::Adaptor::AdaptorSignalType; + using WindowCreatedSignalType = Dali::Adaptor::WindowCreatedSignalType; - typedef Uint16Pair SurfaceSize; ///< Surface size type + using SurfaceSize = Uint16Pair; ///< Surface size type /** * Creates a New Adaptor @@ -105,7 +102,7 @@ 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, + static Dali::Adaptor* New( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface* surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ); @@ -116,7 +113,7 @@ 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, + static Dali::Adaptor* New( Dali::Integration::SceneHolder window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ); @@ -131,7 +128,7 @@ public: * @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::Integration::SceneHolder window, Dali::RenderSurfaceInterface* surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ); @@ -144,7 +141,7 @@ public: * @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::Integration::SceneHolder window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ); @@ -222,9 +219,9 @@ public: // AdaptorInternalServices implementation virtual void FeedKeyEvent( KeyEvent& keyEvent ); /** - * @copydoc AdaptorInterface::ReplaceSurface() + * @copydoc Dali::Adaptor::ReplaceSurface() */ - virtual void ReplaceSurface( Dali::Window window, Dali::RenderSurfaceInterface& surface ); + virtual void ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface ); /** * @copydoc Dali::Adaptor::GetSurface() @@ -255,16 +252,16 @@ public: // AdaptorInternalServices implementation * @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, + virtual bool AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, - const bool& childWindowMode ); + bool childWindowMode ); /** * Removes an existing Window instance from the Adaptor * @param[in] window The Window instance */ - virtual bool RemoveWindow( Dali::Window* childWindow ); + virtual bool RemoveWindow( Dali::Integration::SceneHolder* childWindow ); /** * Removes an existing Window instance from the Adaptor @@ -279,6 +276,11 @@ public: // AdaptorInternalServices implementation virtual void RemoveIdle( CallbackBase* callback ); /** + * @copydoc Dali::Adaptor::ProcessIdle() + */ + virtual void ProcessIdle(); + + /** * Sets a pre-render callback. */ void SetPreRenderCallback( CallbackBase* callback ); @@ -287,7 +289,25 @@ public: // AdaptorInternalServices implementation * Removes an existing Window instance from the Adaptor * @param[in] childWindow The Window instance */ - bool RemoveWindow( Dali::Internal::Adaptor::Window* childWindow ); + bool RemoveWindow( Dali::Internal::Adaptor::SceneHolder* childWindow ); + + /** + * @brief Retrieve the window that the given actor is added to. + * + * @param[in] actor The actor + * @return The window the actor is added to or a null pointer if the actor is not added to any widnow. + */ + Dali::Internal::Adaptor::SceneHolder* GetWindow( Dali::Actor& actor ); + + /** + * @copydoc Dali::Adaptor::GetWindows() + */ + Dali::WindowContainer GetWindows() const; + + /** + * @copydoc Dali::Adaptor::GetSceneHolders() + */ + Dali::SceneHolderList GetSceneHolders() const; public: @@ -302,42 +322,31 @@ public: void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender ); /** - * @copydoc Dali::Adaptor::SetUseHardwareVSync() - */ - void SetUseHardwareVSync(bool useHardware); - - /** * Return the PlatformAbstraction. * @return The PlatformAbstraction. */ Integration::PlatformAbstraction& GetPlatformAbstraction() const; /** - * Sets the Drag & Drop Listener. - * @param[in] detector The detector to send Drag & Drop events to. - */ - void SetDragAndDropDetector( DragAndDropDetectorPtr detector ); - - /** * Destroy the TtsPlayer of specific mode. * @param[in] mode The mode of TtsPlayer to destroy */ void DestroyTtsPlayer(Dali::TtsPlayer::Mode mode); /** - * @brief Sets minimum distance in pixels that the fingers must move towards/away from each other in order to - * trigger a pinch gesture + * Gets native window handle * - * @param[in] distance The minimum pinch distance in pixels + * @return native window handle */ - void SetMinimumPinchDistance(float distance); + Any GetNativeWindowHandle(); /** - * Gets native window handle + * @brief Retrieve native window handle that the given actor is added to. * + * @param[in] actor The actor * @return native window handle */ - Any GetNativeWindowHandle(); + Any GetNativeWindowHandle( Dali::Actor actor ); /** * Get the native display associated with the graphics backend @@ -394,12 +403,12 @@ public: void GetAppId( std::string& appId ); /** - * Informs core the surface size has changed + * @copydoc Dali::Adaptor::SurfaceResizePrepare */ void SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize ); /** - * Informs ThreadController the surface size has changed + * @copydoc Dali::Adaptor::SurfaceResizeComplete */ void SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize ); @@ -429,6 +438,18 @@ public: */ void UnregisterProcessor( Integration::Processor& processor ); + /** + * Check MultipleWindow is supported + */ + bool IsMultipleWindowSupported() const; + + /** + * @brief Checks whether the windows are being rendered in the render thread. + * + * @return true if the windows are being rendered in the render thread, or false if not. + */ + bool IsRenderingWindows() const; + public: //AdaptorInternalServices /** @@ -452,11 +473,6 @@ public: //AdaptorInternalServices virtual TriggerEventInterface& GetProcessCoreEventsTrigger(); /** - * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetTriggerEventFactoryInterface() - */ - virtual TriggerEventFactoryInterface& GetTriggerEventFactoryInterface(); - - /** * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetSocketFactoryInterface() */ virtual SocketFactoryInterface& GetSocketFactoryInterface(); @@ -467,11 +483,6 @@ public: //AdaptorInternalServices virtual Dali::RenderSurfaceInterface* GetRenderSurfaceInterface(); /** - * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetVSyncMonitorInterface() - */ - virtual VSyncMonitorInterface* GetVSyncMonitorInterface(); - - /** * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetPerformanceInterface() */ virtual PerformanceInterface* GetPerformanceInterface(); @@ -486,6 +497,11 @@ public: //AdaptorInternalServices */ virtual TraceInterface& GetSystemTraceInterface(); + /** + * copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetWindowContainerInterface() + */ + virtual void GetWindowContainerInterface( WindowContainer& windows ); + public: // Signals /** @@ -505,25 +521,26 @@ public: // Signals } /** - * Gets the gesture manager. - * @return The GestureManager + * @copydoc Dali::Adaptor::WindowCreatedSignal */ - GestureManager* GetGestureManager() const + WindowCreatedSignalType& WindowCreatedSignal() { - return mGestureManager; + return mWindowCreatedSignal; } -private: // From Dali::Internal::Adaptor::CoreEventInterface +public: // From Dali::Internal::Adaptor::CoreEventInterface /** - * @copydoc Dali::Internal::Adaptor::CoreEventInterface::QueueCoreEvent() + * @copydoc Dali::Internal::Adaptor:CoreEventInterface:::ProcessCoreEvents() */ - virtual void QueueCoreEvent(const Dali::Integration::Event& event); + virtual void ProcessCoreEvents(); + +private: // From Dali::Internal::Adaptor::CoreEventInterface /** - * @copydoc Dali::Internal::Adaptor:CoreEventInterface:::ProcessCoreEvents() + * @copydoc Dali::Internal::Adaptor::CoreEventInterface::QueueCoreEvent() */ - virtual void ProcessCoreEvents(); + virtual void QueueCoreEvent(const Dali::Integration::Event& event); private: // From Dali::Integration::RenderController @@ -537,7 +554,7 @@ private: // From Dali::Integration::RenderController */ virtual void RequestProcessEventsOnIdle( bool forceProcess ); -private: // From Dali::Internal::Adaptor::WindowVisibilityObserver +public: // From Dali::Internal::Adaptor::WindowVisibilityObserver /** * Called when the window becomes fully or partially visible. @@ -618,58 +635,59 @@ 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( Dali::Window window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions ); + Adaptor( Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions ); private: // Types enum State { - READY, ///< Initial state before Adaptor::Start is called. - RUNNING, ///< Adaptor is running. - PAUSED, ///< Adaptor has been paused. - PAUSED_WHILE_HIDDEN, ///< Adaptor is paused while window is hidden (& cannot be resumed until window is shown). - STOPPED, ///< Adaptor has been stopped. + READY, ///< Initial state before Adaptor::Start is called. + RUNNING, ///< Adaptor is running. + PAUSED, ///< Adaptor has been paused. + PAUSED_WHILE_HIDDEN, ///< Adaptor is paused while window is hidden (& cannot be resumed until window is shown). + PAUSED_WHILE_INITIALIZING, ///< Adaptor is paused while application is initializing. + STOPPED, ///< Adaptor has been stopped. }; - using WindowPtr = IntrusivePtr< Window >; - using WindowContainer = std::vector; + // There is no weak handle for BaseHandle in DALi, but we can't ref count the window here, + // so we have to store the raw pointer. + using WindowContainer = std::vector; using ObserverContainer = std::vector; private: // Data AdaptorSignalType mResizedSignal; ///< Resized signal. AdaptorSignalType mLanguageChangedSignal; ///< Language changed signal. + WindowCreatedSignalType mWindowCreatedSignal; ///< Window created signal. Dali::Adaptor& mAdaptor; ///< Reference to public adaptor instance. State mState; ///< Current state of the adaptor Dali::Integration::Core* mCore; ///< Dali Core ThreadController* mThreadController; ///< Controls the threads - VSyncMonitor* mVSyncMonitor; ///< Monitors VSync events GraphicsInterface* mGraphics; ///< Graphics interface Dali::DisplayConnection* mDisplayConnection; ///< Display connection WindowContainer mWindows; ///< A container of all the Windows that are currently created + std::unique_ptr mConfigurationManager; ///< Configuration manager + TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction CallbackManager* mCallbackManager; ///< Used to install callbacks bool mNotificationOnIdleInstalled; ///< whether the idle handler is installed to send an notification event TriggerEventInterface* mNotificationTrigger; ///< Notification event trigger - GestureManager* mGestureManager; ///< Gesture manager FeedbackPluginProxy* mDaliFeedbackPlugin; ///< Used to access feedback support FeedbackController* mFeedbackController; ///< Plays feedback effects for Dali-Toolkit UI Controls. Dali::TtsPlayer mTtsPlayers[Dali::TtsPlayer::MODE_NUM]; ///< Provides TTS support ObserverContainer mObservers; ///< A list of adaptor observer pointers - DragAndDropDetectorPtr mDragAndDropDetector; ///< The Drag & Drop detector EnvironmentOptions* mEnvironmentOptions; ///< environment options PerformanceInterface* mPerformanceInterface; ///< Performance interface KernelTrace mKernelTracer; ///< Kernel tracer SystemTrace mSystemTracer; ///< System tracer - TriggerEventFactory mTriggerEventFactory; ///< Trigger event factory ObjectProfiler* mObjectProfiler; ///< Tracks object lifetime for profiling 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 + bool mUseRemoteSurface:1; ///< whether the remoteSurface is used or not public: inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) { return *adaptor.mImpl; }