Revert "[Tizen] Revert "Support multiple window rendering""
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.h
index 8a3bcd1..1f10653 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_WINDOW_H__
-#define __DALI_INTERNAL_WINDOW_H__
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H
+#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
 // EXTERNAL INCLUDES
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/object/base-object.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/integration-api/scene.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/common/lifecycle-observer.h>
-#include <dali/internal/window-system/common/indicator-interface.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/window-system/common/indicator-interface.h>
 #include <dali/public-api/adaptor-framework/window.h>
-#include <dali/devel-api/adaptor-framework/orientation.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/public-api/adaptor-framework/key-grab.h>
 #include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
 
 namespace Dali
 {
 class Adaptor;
-class RenderSurface;
-
-namespace Integration
-{
-class SystemOverlay;
-}
+class Actor;
 
 namespace Internal
 {
 namespace Adaptor
 {
 class Orientation;
+class WindowRenderSurface;
+class WindowBase;
 
 class Window;
 typedef IntrusivePtr<Window> WindowPtr;
@@ -54,7 +53,7 @@ typedef IntrusivePtr<Orientation> OrientationPtr;
 /**
  * Window provides a surface to render onto with orientation & indicator properties.
  */
-class Window : public Dali::BaseObject, public IndicatorInterface::Observer, public LifeCycleObserver
+class Window : public Dali::BaseObject, public IndicatorInterface::Observer, public LifeCycleObserver, public ConnectionTracker
 {
 public:
   typedef Dali::Window::IndicatorSignalType IndicatorSignalType;
@@ -82,7 +81,7 @@ public:
    * Get the window surface
    * @return The render surface
    */
-  RenderSurface* GetSurface();
+  WindowRenderSurface* GetSurface();
 
   /**
    * @copydoc Dali::Window::ShowIndicator()
@@ -95,6 +94,11 @@ public:
   void SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacity );
 
   /**
+   * Set the indicator visible mode
+   */
+  void SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode );
+
+  /**
    * @copydoc Dali::Window::RotateIndicator()
    */
   void RotateIndicator( Dali::Window::WindowOrientation orientation );
@@ -102,7 +106,7 @@ public:
   /**
    * @copydoc Dali::Window::SetClass()
    */
-  void SetClass( std::string name, std::string klass );
+  void SetClass( std::string name, std::string className );
 
   /**
    * @copydoc Dali::Window::Raise()
@@ -120,6 +124,41 @@ public:
   void Activate();
 
   /**
+   * @copydoc Dali::Window::Add()
+   */
+  void Add( Dali::Actor actor );
+
+  /**
+   * @copydoc Dali::Window::Remove()
+   */
+  void Remove( Dali::Actor remove );
+
+  /**
+   * @copydoc Dali::Window::SetBackgroundColor()
+   */
+  void SetBackgroundColor(Vector4 color);
+
+  /**
+   * @copydoc Dali::Window::GetBackgroundColor()
+   */
+  Vector4 GetBackgroundColor() const;
+
+  /**
+   * @copydoc Dali::Window::GetRootLayer()
+   */
+  Dali::Layer GetRootLayer() const;
+
+  /**
+   * @copydoc Dali::Window::GetLayerCount()
+   */
+  uint32_t GetLayerCount() const;
+
+  /**
+   * @copydoc Dali::Window::GetLayer()
+   */
+  Dali::Layer GetLayer( uint32_t depth ) const;
+
+  /**
    * @copydoc Dali::Window::AddAvailableOrientation()
    */
   void AddAvailableOrientation(Dali::Window::WindowOrientation orientation);
@@ -187,11 +226,11 @@ public:
   /**
    * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
    */
-   unsigned int GetSupportedAuxiliaryHintCount() const;
+  unsigned int GetSupportedAuxiliaryHintCount() const;
 
-   /**
-    * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
-    */
+  /**
+   * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
+   */
   std::string GetSupportedAuxiliaryHint( unsigned int index ) const;
 
   /**
@@ -295,21 +334,48 @@ public:
   Dali::Window::WindowPosition GetPosition() const;
 
   /**
+   * @copydoc Dali::DevelWindow::SetPositionSize()
+   */
+  void SetPositionSize( PositionSize positionSize );
+
+  /**
    * @copydoc Dali::Window::SetTransparency()
    */
   void SetTransparency( bool transparent );
 
   /**
+   * @copydoc Dali::KeyGrab::GrabKey()
+   */
+  bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode );
+
+  /**
+   * @copydoc Dali::KeyGrab::UngrabKey()
+   */
+  bool UngrabKey( Dali::KEY key );
+
+  /**
+   * @copydoc Dali::KeyGrab::GrabKeyList()
+   */
+  bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result );
+
+  /**
+   * @copydoc Dali::KeyGrab::UngrabKeyList()
+   */
+  bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result );
+
+  /**
    * Called from Orientation after the Change signal has been sent
    */
   void RotationDone( int orientation, int width, int height );
 
   /**
-   * Set the indicator visible mode
+   * @brief Retrieves the unique ID of the window.
+   * @return The ID
    */
-  void SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode );
+  uint32_t GetId() const;
 
 private:
+
   /**
    * Private constructor.
    * @sa Window::New()
@@ -346,7 +412,32 @@ private:
   /**
    * Set the indicator properties on the window
    */
-  void SetIndicatorProperties( bool isShown, Dali::Window::WindowOrientation lastOrientation );
+  void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation );
+
+  /**
+   * Called when the window becomes iconified or deiconified.
+   */
+  void OnIconifyChanged( bool iconified );
+
+  /**
+   * Called when the window focus is changed.
+   */
+  void OnFocusChanged( bool focusIn );
+
+  /**
+   * Called when the output is transformed.
+   */
+  void OnOutputTransformed();
+
+  /**
+   * Called when the window receives a delete request.
+   */
+  void OnDeleteRequest();
+
+  /**
+   * Called when the Ecore indicator event is received.
+   */
+  void OnIndicatorFlicked();
 
 private: // IndicatorInterface::Observer interface
 
@@ -416,39 +507,34 @@ public: // Signals
 
 private:
 
-  typedef std::vector< std::pair< std::string, std::string > > AuxiliaryHints;
-
-  RenderSurface*                   mSurface;
-  Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state
-  bool                             mIndicatorIsShown:1; ///< private state
-  bool                             mShowRotatedIndicatorOnClose:1;
-  bool                             mStarted:1;
-  bool                             mIsTransparent:1;
-  bool                             mWMRotationAppSet:1;
-  bool                             mEcoreEventHander:1;
-  bool                             mIsFocusAcceptable:1;
-  bool                             mVisible:1;
-  bool                             mIconified:1;
-  bool                             mOpaqueState:1;
-  bool                             mResizeEnabled:1;
-  IndicatorInterface*              mIndicator;
-  Dali::Window::WindowOrientation  mIndicatorOrientation;
-  Dali::Window::WindowOrientation  mNextIndicatorOrientation;
-  Dali::Window::IndicatorBgOpacity mIndicatorOpacityMode;
-  Integration::SystemOverlay*      mOverlay;
-  Adaptor*                         mAdaptor;
-  Dali::DragAndDropDetector        mDragAndDropDetector;
-  Dali::Window::Type          mType;
-
-  struct EventHandler;
-  EventHandler*                    mEventHandler;
+  static uint32_t                       mWindowCounter;    ///< A counter to track the window creation
+  uint32_t                              mId;               ///< A unique ID to identify the window starting from 0
+  std::unique_ptr< WindowRenderSurface > mSurface;
+  Dali::Integration::Scene              mScene;
+  WindowBase*                           mWindowBase;
+  Dali::Window::IndicatorVisibleMode    mIndicatorVisible; ///< public state
+  bool                                  mIndicatorIsShown:1; ///< private state
+  bool                                  mShowRotatedIndicatorOnClose:1;
+  bool                                  mStarted:1;
+  bool                                  mIsTransparent:1;
+  bool                                  mIsFocusAcceptable:1;
+  bool                                  mVisible:1;
+  bool                                  mIconified:1;
+  bool                                  mOpaqueState:1;
+  bool                                  mResizeEnabled:1;
+  std::unique_ptr< IndicatorInterface > mIndicator;
+  Dali::Window::WindowOrientation       mIndicatorOrientation;
+  Dali::Window::WindowOrientation       mNextIndicatorOrientation;
+  Dali::Window::IndicatorBgOpacity      mIndicatorOpacityMode;
+  Adaptor*                              mAdaptor;
+  Dali::DragAndDropDetector             mDragAndDropDetector;
+  Dali::Window::Type                    mType;
 
   OrientationPtr                               mOrientation;
   std::vector<Dali::Window::WindowOrientation> mAvailableOrientations;
   Dali::Window::WindowOrientation              mPreferredOrientation;
 
-  std::vector< std::string >        mSupportedAuxiliaryHints;
-  AuxiliaryHints                    mAuxiliaryHints;
+  Vector4                               mBackgroundColor;
 
   // Signals
   IndicatorSignalType mIndicatorVisibilityChangedSignal;
@@ -478,5 +564,4 @@ inline const Internal::Adaptor::Window& GetImplementation(const Dali::Window& wi
 
 } // namespace Dali
 
-
-#endif // __DALI_INTERNAL_WINDOW_H__
+#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H