Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / ubuntu-x11 / window-base-ecore-x.h
index 6255279..6c99f46 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
 
 /*
- * Copyright (c) 2018 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.
@@ -22,8 +22,8 @@
 #include <dali/internal/window-system/common/window-base.h>
 
 // EXTERNAL HEADERS
-#include <Ecore.h>
-#include <Ecore_X.h>
+#include <dali/internal/system/linux/dali-ecore.h>
+#include <dali/internal/system/linux/dali-ecore-x.h>
 
 namespace Dali
 {
@@ -32,10 +32,6 @@ namespace Internal
 namespace Adaptor
 {
 
-class Window;
-class WindowRenderSurface;
-class WindowRenderSurfaceEcoreX;
-
 /**
  * WindowBaseEcoreX class provides an WindowBase EcoreX implementation.
  */
@@ -46,7 +42,7 @@ public:
   /**
    * @brief Constructor
    */
-  WindowBaseEcoreX( Window* window, WindowRenderSurface* windowRenderSurface );
+  WindowBaseEcoreX( PositionSize positionSize, Any surface, bool isTransparent );
 
   /**
    * @brief Destructor
@@ -61,36 +57,131 @@ public:
   Eina_Bool OnWindowPropertyChanged( void* data, int type, void* event );
 
   /**
-   * Called when the window receives a delete request
+   * @brief Called when the window receives a delete request
    */
   void OnDeleteRequest();
 
+  /**
+   * @brief Called when the window gains focus.
+   */
+  void OnFocusIn( void* data, int type, void* event );
+
+  /**
+   * @brief Called when the window loses focus.
+   */
+  void OnFocusOut( void* data, int type, void* event );
+
+  /**
+   * @brief Called when the window is damaged.
+   */
+  void OnWindowDamaged( void* data, int type, void* event );
+
+  /**
+   * @brief Called when a touch down is received.
+   */
+  void OnMouseButtonDown( void* data, int type, void* event );
+
+  /**
+   * @brief Called when a touch up is received.
+   */
+  void OnMouseButtonUp( void* data, int type, void* event );
+
+  /**
+   * @brief Called when a touch motion is received.
+   */
+  void OnMouseButtonMove( void* data, int type, void* event );
+
+  /**
+   * @brief Called when a mouse wheel is received.
+   */
+  void OnMouseWheel( void* data, int type, void* event );
+
+  /**
+   * @brief Called when a key down is received.
+   */
+  void OnKeyDown( void* data, int type, void* event );
+
+  /**
+   * @brief Called when a key up is received.
+   */
+  void OnKeyUp( void* data, int type, void* event );
+
+  /**
+   * @brief Called when the source window notifies us the content in clipboard is selected.
+   */
+  void OnSelectionClear( void* data, int type, void* event );
+
+  /**
+   * @brief Called when the source window sends us about the selected content.
+   */
+  void OnSelectionNotify( void* data, int type, void* event );
+
 public:
 
   /**
-   * @copydoc Dali::Internal::Adaptor::WindowBase::Initialize()
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
+   */
+  virtual Any GetNativeWindow() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
+   */
+  virtual int GetNativeWindowId() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
+   */
+  virtual EGLNativeWindowType CreateEglWindow( int width, int height ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
+   */
+  virtual void DestroyEglWindow() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
    */
-  virtual void Initialize() override;
+  virtual void SetEglWindowRotation( int angle ) override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
    */
-  virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
+  virtual void SetEglWindowBufferTransform( int angle ) override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
    */
-  virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
+  virtual void SetEglWindowTransform( int angle ) override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
    */
-  virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
+  virtual void ResizeEglWindow( PositionSize positionSize ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
+   */
+  virtual bool IsEglWindowRotationSupported() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
+   */
+  virtual void Move( PositionSize positionSize ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
+   */
+  virtual void Resize( PositionSize positionSize ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
+   */
+  virtual void MoveResize( PositionSize positionSize ) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
    */
-  virtual void SetClass( std::string name, std::string className ) override;
+  virtual void SetClass( const std::string& name, const std::string& className ) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
@@ -232,6 +323,60 @@ public:
    */
   virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
+   */
+  virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
+   */
+  virtual int GetScreenRotationAngle() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
+   */
+  virtual void SetWindowRotationAngle( int degree ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
+   */
+  virtual void WindowRotationCompleted( int degree, int width, int height ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
+   */
+  virtual void SetTransparency( bool transparent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
+   */
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
+
+private:
+
+  /**
+   * Second stage initialization
+   */
+  void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
+
+  /**
+   * @brief 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;
+
+  /**
+   * @brief Create window
+   */
+  void CreateWindow( PositionSize positionSize, bool isTransparent );
+
 protected:
 
   // Undefined
@@ -243,11 +388,9 @@ protected:
 private:
 
   Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
-
-  Window*                              mWindow;
-  WindowRenderSurfaceEcoreX*           mWindowSurface;
-  Ecore_X_Window                       mEcoreWindow;
-
+  Ecore_X_Window                       mEcoreWindow;        ///< Native window handle
+  bool                                 mOwnSurface:1;       ///< Whether we own the surface (responsible for deleting it)
+  bool                                 mIsTransparent;      ///< Whether the window is transparent (32 bit or 24 bit)
   bool                                 mRotationAppSet:1;
 };