[Tizen] Support Ecore-Wayland2
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl / window-render-surface-ecore-wl.h
index 30ffc52..e95d8b1 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_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.
  */
 
 // EXTERNAL INCLUDES
+#include <Ecore_Wayland.h>
 #include <wayland-egl.h>
+#include <dali/public-api/common/dali-common.h>
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/wayland/ecore-wl/ecore-wl-render-surface.h>
+#include <dali/integration-api/egl-interface.h>
 #include <dali/integration-api/thread-synchronization-interface.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
 
 namespace Dali
 {
 
-namespace ECore
+namespace Internal
+{
+namespace Adaptor
 {
 
 /**
- * @copydoc Dali::ECore::EcoreWlRenderSurface.
- * Window specialization.
+ * Ecore Wayland Window implementation of render surface.
  */
-class WindowRenderSurface : public EcoreWlRenderSurface
+class WindowRenderSurfaceEcoreWl : public WindowRenderSurface
 {
 public:
 
@@ -46,156 +50,188 @@ public:
     * @param [in] name optional name of surface passed in
     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
     */
-  WindowRenderSurface( Dali::PositionSize positionSize,
+  WindowRenderSurfaceEcoreWl( Dali::PositionSize positionSize,
                        Any surface,
                        const std::string& name,
                        bool isTransparent = false );
 
   /**
-   * @copydoc Dali::ECore::EcoreWlRenderSurface::~EcoreWlRenderSurface
+   * @brief Destructor
    */
-  virtual ~WindowRenderSurface();
+  virtual ~WindowRenderSurfaceEcoreWl();
 
 public: // API
 
   /**
-   * @copydoc Dali::RenderSurface::GetDrawable()
+   * @brief Get window handle
+   * @return the Ecore Waylnad window handle
    */
-  virtual Ecore_Wl_Window* GetDrawable();
+  Ecore_Wl_Window* GetWlWindow();
 
   /**
-   * Map window
+   * Notify output is transformed.
    */
-  virtual void Map();
+  void OutputTransformed();
+
+public: // from WindowRenderSurface
 
   /**
-   * @copydoc Dali::ECore::EcoreWlRenderSurface::GetSurface()
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::GetWindow()
    */
-  virtual Any GetSurface();
+  virtual Any GetWindow() override;
 
   /**
-   * @copydoc Dali::ECore::EcoreWlRenderSurface::GetWlWindow()
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Map()
    */
-  virtual Ecore_Wl_Window* GetWlWindow();
+  virtual void Map() override;
 
   /**
-   * Request surface rotation
-   * @param[in] angle A new angle of the surface
-   * @param[in] width A new width of the surface
-   * @param[in] height A new height of the surface
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetRenderNotification()
    */
-  void RequestRotation( int angle, int width, int height );
+  virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
 
   /**
-   * Notify output is transformed.
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetTransparency()
    */
-  void OutputTransformed();
+  virtual void SetTransparency( bool transparent ) override;
 
   /**
-   * @brief Sets whether the surface is transparent or not.
-   *
-   * @param[in] transparent Whether the surface is transparent
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::RequestRotation()
    */
-  void SetTransparency( bool transparent );
+  virtual void RequestRotation( int angle, int width, int height ) override;
 
 public: // from Dali::RenderSurface
 
   /**
+   * @copydoc Dali::RenderSurface::GetPositionSize()
+   */
+  virtual PositionSize GetPositionSize() const override;
+
+  /**
+   * @copydoc Dali::RenderSurface::GetDpi()
+   */
+  virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
+
+  /**
    * @copydoc Dali::RenderSurface::InitializeEgl()
    */
-  virtual void InitializeEgl( EglInterface& egl );
+  virtual void InitializeEgl( EglInterface& egl ) override;
 
   /**
    * @copydoc Dali::RenderSurface::CreateEglSurface()
    */
-  virtual void CreateEglSurface( EglInterface& egl );
+  virtual void CreateEglSurface( EglInterface& egl ) override;
 
   /**
    * @copydoc Dali::RenderSurface::DestroyEglSurface()
    */
-  virtual void DestroyEglSurface( EglInterface& egl );
+  virtual void DestroyEglSurface( EglInterface& egl ) override;
 
   /**
    * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
    */
-  virtual bool ReplaceEGLSurface( EglInterface& egl );
+  virtual bool ReplaceEGLSurface( EglInterface& egl ) override;
 
   /**
    * @copydoc Dali::RenderSurface::MoveResize()
    */
-  virtual void MoveResize( Dali::PositionSize positionSize);
+  virtual void MoveResize( Dali::PositionSize positionSize) override;
 
   /**
    * @copydoc Dali::RenderSurface::SetViewMode()
    */
-  void SetViewMode( ViewMode viewMode );
+  virtual void SetViewMode( ViewMode viewMode ) override;
 
   /**
    * @copydoc Dali::RenderSurface::StartRender()
    */
-  virtual void StartRender();
+  virtual void StartRender() override;
 
   /**
    * @copydoc Dali::RenderSurface::PreRender()
    */
-  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface );
+  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) override;
 
   /**
    * @copydoc Dali::RenderSurface::PostRender()
    */
-  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
+  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) override;
 
   /**
    * @copydoc Dali::RenderSurface::StopRender()
    */
-  virtual void StopRender();
+  virtual void StopRender() override;
 
   /**
    * @copydoc Dali::RenderSurface::SetThreadSynchronization
    */
-  virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
+  virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) override;
 
   /**
    * @copydoc Dali::RenderSurface::ReleaseLock()
    */
-  virtual void ReleaseLock();
+  virtual void ReleaseLock() override;
+
+  /**
+   * @copydoc Dali::RenderSurface::GetSurfaceType()
+   */
+  virtual RenderSurface::Type GetSurfaceType() override;
 
-protected:
+private: // from WindowRenderSurface
 
   /**
-   * Create WlWindow
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Initialize()
    */
-  virtual void CreateWlRenderable();
+  void Initialize( Any surface ) override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::ECore::EcoreWlRenderSurface::UseExistingRenderable
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::CreateRenderable()
    */
-  virtual void UseExistingRenderable( unsigned int surfaceId );
+  void CreateRenderable() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::UseExistingRenderable()
+   */
+  void UseExistingRenderable( unsigned int surfaceId ) override;
 
 private:
 
   /**
+   * Get the surface id if the surface parameter is not empty
+   * @param surface Any containing a surface id, or can be empty
+   * @return surface id, or zero if surface is empty
+   */
+  unsigned int GetSurfaceId( Any surface ) const;
+
+  /**
    * Used as the callback for the rotation-trigger.
    */
   void ProcessRotationRequest();
 
 private: // Data
 
-  Ecore_Wl_Window*                mWlWindow;  ///< Wayland-Window
+  std::string                     mTitle;              ///< Title of window which shows from "xinfo -topvwins" command
+  PositionSize                    mPositionSize;       ///< Position
+  Ecore_Wl_Window*                mWlWindow;           ///< Wayland-Window
   wl_surface*                     mWlSurface;
   wl_egl_window*                  mEglWindow;
   ThreadSynchronizationInterface* mThreadSynchronization;
+  TriggerEventInterface*          mRenderNotification; ///< Render notification trigger
   TriggerEventInterface*          mRotationTrigger;
+  ColorDepth                      mColorDepth;         ///< Color depth of surface (32 bit or 24 bit)
   int                             mRotationAngle;
   int                             mScreenRotationAngle;
+  bool                            mOwnSurface;         ///< Whether we own the surface (responsible for deleting it)
   bool                            mRotationSupported;
   bool                            mRotationFinished;
   bool                            mScreenRotationFinished;
   bool                            mResizeFinished;
 
-}; // class WindowRenderSurface
+}; // class WindowRenderSurfaceEcoreWl
+
+} // namespace Adaptor
 
-} // namespace ECore
+} // namespace internal
 
 } // namespace Dali