Add window move/resize completed signal
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.h
index 66582a8..af8054f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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 HEADERS
 #include <Ecore.h>
 #include <Ecore_Wl2.h>
+#include <input-method-client-protocol.h>
 #include <tizen-extension-client-protocol.h>
 #include <wayland-egl.h>
 #include <xkbcommon/xkbcommon.h>
 
-#ifdef DALI_ELDBUS_AVAILABLE
-#include <Eldbus.h>
-#endif
-
 namespace Dali
 {
 namespace Internal
@@ -119,6 +116,11 @@ public:
   void OnMouseWheel(void* data, int type, void* event);
 
   /**
+   * @brief Called when a mouse in or out is received.
+   */
+  void OnMouseInOut(void* data, int type, void* event, Dali::DevelWindow::MouseInOutEvent::Type action);
+
+  /**
    * @brief Called when a detent rotation event is recevied.
    */
   void OnDetentRotation(void* data, int type, void* event);
@@ -168,12 +170,30 @@ public:
    */
   void OnEcoreEventWindowRedrawRequest();
 
-#ifdef DALI_ELDBUS_AVAILABLE
   /**
-   * @brief Called when Ecore ElDBus accessibility event is received.
+   * @brief Called when window's auxiliary is changed then display server send the changed message.
+   *
+   * @param[in] auxiliary's message data. It has key, value and integer list data.
    */
-  void OnEcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message);
-#endif
+  void OnEcoreEventWindowAuxiliaryMessage(void* event);
+
+  /**
+   * @brief Called when window has been moved by then display server.
+   * To move the window by display server, RequestMoveToServer() should be called.
+   * After the moving job is completed, this function will be called.
+   *
+   * @param[in] the completed event's data. It has the latest window geometry data.
+   */
+  void OnMoveCompleted(void* event);
+
+  /**
+   * @brief Called when window has been resized by then display server.
+   * To resize the window by display server, RequestResizeToServer() should be called.
+   * After the resizing job is completed, this function will be called.
+   *
+   * @param[in] the completed event's data. It has the latest window geometry data.
+   */
+  void OnResizeCompleted(void* event);
 
   /**
    * @brief Called when a keymap is changed.
@@ -222,6 +242,11 @@ public:
   int GetNativeWindowId() override;
 
   /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowResourceId()
+   */
+  std::string GetNativeWindowResourceId() override;
+
+  /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
    */
   EGLNativeWindowType CreateEglWindow(int width, int height) override;
@@ -272,6 +297,11 @@ public:
   void MoveResize(PositionSize positionSize) override;
 
   /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetLayout()
+   */
+  void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) override;
+
+  /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
    */
   void SetClass(const std::string& name, const std::string& className) override;
@@ -292,6 +322,36 @@ public:
   void Activate() override;
 
   /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
+   */
+  void Maximize(bool maximize) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
+   */
+  bool IsMaximized() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
+   */
+  void SetMaximumSize(Dali::Window::WindowSize size) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
+   */
+  void Minimize(bool minimize) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
+   */
+  bool IsMinimized() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
+   */
+  void SetMimimumSize(Dali::Window::WindowSize size) override;
+
+  /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
    */
   void SetAvailableAnlges(const std::vector<int>& angles) override;
@@ -362,9 +422,14 @@ public:
   void SetType(Dali::WindowType type) override;
 
   /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
+   */
+  Dali::WindowType GetType() const override;
+
+  /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
    */
-  bool SetNotificationLevel(Dali::WindowNotificationLevel level) override;
+  Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
@@ -379,7 +444,7 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
    */
-  bool SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
+  Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
@@ -389,7 +454,7 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
    */
-  bool SetBrightness(int brightness) override;
+  Dali::WindowOperationResult SetBrightness(int brightness) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
@@ -422,9 +487,9 @@ public:
   void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
    */
-  int GetOrientation() const override;
+  int GetWindowRotationAngle() const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
@@ -449,7 +514,7 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
    */
-  void SetParent(WindowBase* parentWinBase) override;
+  void SetParent(WindowBase* parentWinBase, bool belowParent) override;
 
   /**
    * @copydoc  Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
@@ -461,6 +526,51 @@ public:
    */
   int CreateFramePresentedSyncFence() override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
+   */
+  void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
+   */
+  void InitializeIme() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
+   */
+  void ImeWindowReadyToRender() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
+   */
+  void RequestMoveToServer() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
+   */
+  void RequestResizeToServer(WindowResizeDirection direction) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
+   */
+  void EnableFloatingMode(bool enable) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
+   */
+  bool IsFloatingModeEnabled() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion) override;
+
 private:
   /**
    * Second stage initialization
@@ -468,14 +578,41 @@ private:
   void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
 
   /**
-   * Initialize Ecore ElDBus
+   * @brief Create window
    */
-  void InitializeEcoreElDBus();
+  void CreateWindow(PositionSize positionSize);
 
   /**
-   * @brief Create window
+   * @brief Return the window's position and size to recalulate with the default system coordinates.
+   * It is used when window is moved or resized for native ecore wayland window system.
+   *
+   * @param[in] positionSize the window's current position and size with current oriented window's coordinates.
+   * @return the re-calculated window's position and size on the default system coordinates.
    */
-  void CreateWindow(PositionSize positionSize);
+  PositionSize RecalculatePositionSizeToSystem(PositionSize positionSize);
+
+  /**
+   * @brief Return the window's position and size to recalulate with current oriented window's coordinates.
+   * It is used when window is moved or resized for dali and uppler layer framework.
+   *
+   * @param[in] positionSize the window's current position and size with the default system coordinates.
+   * @return the re-calculated window's position and size on current oriented window's coordinates.
+   */
+  PositionSize RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize);
+
+  /**
+   * @brief Return the rect value to recalulate with the default system coordinates.
+   *
+   * Some native window APIs work the geometry value based on the default system coordinates.
+   * IncludeInputRegion() and ExcludeInputRegion() are one of them.
+   * When the window is rotated, current window's geometry already were set with the rotated angle.
+   * If IncludeInputRegion() or ExcludeInputRegion() are called with rotated angle by application,
+   * the rect's area should be re-calcuated on the default system coordinates.
+   *
+   * @param[in] rect the window's current position and size with current window rotation angle.
+   * @return the re-calculated rect on the default system coordinates.
+   */
+  Rect<int> RecalculateInputRect(const Rect<int>& rect);
 
 protected:
   // Undefined
@@ -486,11 +623,22 @@ protected:
 
 private:
   typedef std::vector<std::pair<std::string, std::string> > AuxiliaryHints;
+  Dali::Vector<Ecore_Event_Handler*>                        mEcoreEventHandler;
+  Ecore_Wl2_Window*                                         mEcoreWindow;
+
+  wl_surface* mWlSurface;
+#ifdef OVER_TIZEN_VERSION_7
+  zwp_input_panel_v1* mWlInputPanel;
+#else
+  wl_input_panel*         mWlInputPanel;
+#endif
+  wl_output* mWlOutput;
+#ifdef OVER_TIZEN_VERSION_7
+  zwp_input_panel_surface_v1* mWlInputPanelSurface;
+#else
+  wl_input_panel_surface* mWlInputPanelSurface;
+#endif
 
-  Dali::Vector<Ecore_Event_Handler*> mEcoreEventHandler;
-
-  Ecore_Wl2_Window*     mEcoreWindow;
-  wl_surface*           mWlSurface;
   wl_egl_window*        mEglWindow;
   wl_display*           mDisplay;
   wl_event_queue*       mEventQueue;
@@ -499,34 +647,31 @@ private:
   xkb_keymap*           mKeyMap;
 
   std::vector<std::string> mSupportedAuxiliaryHints;
-  AuxiliaryHints           mAuxiliaryHints;
-
-  int      mNotificationLevel;
-  uint32_t mNotificationChangeState;
-  bool     mNotificationLevelChangeDone;
-
-  int      mScreenOffMode;
-  uint32_t mScreenOffModeChangeState;
-  bool     mScreenOffModeChangeDone;
-
-  int      mBrightness;
-  uint32_t mBrightnessChangeState;
-  bool     mBrightnessChangeDone;
 
-  bool               mVisible : 1;
+  // It is based on the default system coordinates.
   Dali::PositionSize mWindowPositionSize;
 
-  bool mOwnSurface;
+  AuxiliaryHints mAuxiliaryHints;
 
-  volatile uint32_t mMoveResizeSerial;
+  WindowType mType;
+  int        mNotificationLevel;
+  int        mScreenOffMode;
+  int        mBrightness;
+  int        mWindowRotationAngle;
+  int        mScreenRotationAngle;
+  int        mSupportedPreProtation;
+
+  uint32_t          mNotificationChangeState;
+  uint32_t          mScreenOffModeChangeState;
+  uint32_t          mBrightnessChangeState;
   uint32_t          mLastSubmittedMoveResizeSerial;
+  volatile uint32_t mMoveResizeSerial;
 
-  int mWindowRotationAngle;
-  int mScreenRotationAngle;
-  int mSupportedPreProtation;
-#ifdef DALI_ELDBUS_AVAILABLE
-  Eldbus_Connection* mSystemConnection;
-#endif // DALI_ELDBUS_AVAILABLE
+  bool mNotificationLevelChangeDone;
+  bool mScreenOffModeChangeDone;
+  bool mVisible : 1;
+  bool mOwnSurface;
+  bool mBrightnessChangeDone;
 };
 
 } // namespace Adaptor