Supports some tizen window features. 82/256582/21
authorWonsik Jung <sidein@samsung.com>
Wed, 7 Apr 2021 11:29:29 +0000 (20:29 +0900)
committerWonsik Jung <sidein@samsung.com>
Tue, 29 Jun 2021 07:54:06 +0000 (16:54 +0900)
Supports some tizne window features.
1. Window resized and moved by disply server.
Supports window is resized or moved by display server.
This APIs should be called in mouse down event.
After that, the window is moved or resized with mouse move event.
When mouse up event happens, the job will be finished.

2. floating window mode.
The floating mode is to support making partial size window easliy.
It is useful to make popup style window and this window is always upper than the other normal window.
In addition, it is easy to change between popup style and normal style window.

Change-Id: I2f936a6e28740e061e32c172b7fe90121ecb9e33

18 files changed:
dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/internal/window-system/android/window-base-android.cpp
dali/internal/window-system/android/window-base-android.h
dali/internal/window-system/common/window-base.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-impl.h
dali/internal/window-system/macos/window-base-mac.h
dali/internal/window-system/macos/window-base-mac.mm
dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h
dali/internal/window-system/windows/window-base-win.cpp
dali/internal/window-system/windows/window-base-win.h
dali/public-api/adaptor-framework/window-enumerations.h

index 28dd6b5..886d56b 100644 (file)
@@ -156,6 +156,21 @@ void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, Wi
   GetImplementation(window).SetPositionSizeWithOrientation(positionSize, orientation);
 }
 
+void RequestMoveToServer(Window window)
+{
+  GetImplementation(window).RequestMoveToServer();
+}
+
+void RequestResizeToServer(Window window, WindowResizeDirection direction)
+{
+  GetImplementation(window).RequestResizeToServer(direction);
+}
+
+void EnableFloatingMode(Window window, bool enable)
+{
+  GetImplementation(window).EnableFloatingMode(enable);
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 6d3d0bd..20adb92 100644 (file)
@@ -255,21 +255,59 @@ DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<Ca
  */
 DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
 
-  /**
  * @brief Sets window position and size for specific orientation.
  * This api reserves the position and size per orientation to display server.
  * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
  *
  * @param[in] window The window instance
  * @param[in] positionSize The reserved position and size for the orientation
  * @param[in] orientation The orientation
  *
  * @note Currently, it only works when the window's type is WindowType::IME.
  * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
  * @note This function is only useful in Tizen world.
  */
+/**
+ * @brief Sets window position and size for specific orientation.
+ * This api reserves the position and size per orientation to display server.
+ * When the device is rotated, the window is moved/resized with the reserved position/size by display server.
+ *
+ * @param[in] window The window instance
+ * @param[in] positionSize The reserved position and size for the orientation
+ * @param[in] orientation The orientation
+ *
+ * @note Currently, it only works when the window's type is WindowType::IME.
+ * @note To set WindowType::IME, use Application New(... WindowType type), not Window::SetType().
+ * @note This function is only useful in Tizen world.
+ */
 DALI_ADAPTOR_API void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation);
 
+/**
+ * @brief Requests to display server for the window is moved by display server.
+ *
+ * This function should be called in mouse down event callback function.
+ * After this function is called in mouse down event callback function, the window is moved with mouse move event.
+ * When mouse up event happens, the window moved work is finished.
+ *
+ * @param[in] window The window instance
+ */
+DALI_ADAPTOR_API void RequestMoveToServer(Window window);
+
+/**
+ * @brief Requests to display server for the window is resized by display server.
+ *
+ * This function should be called in mouse down event callback function.
+ * After this function is called in mouse down event callback function, the window is resized with mouse move event.
+ * The direction is selected one of eight ways.
+ * When mouse up event happens, the window resized work is finished.
+ *
+ * @param[in] window The window instance
+ * @param[in] direction it is indicated the window's side or edge for starting point.
+ */
+DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection direction);
+
+/**
+ * @brief Enables the floating mode of window.
+ *
+ * The floating mode is to support making partial size window easliy.
+ * It is useful to make popup style window and this window is always upper than the other normal window.
+ * In addition, it is easy to change between popup style and normal style window.
+ *
+ * A special display server(as a Tizen display server) supports this mode.
+ *
+ * @param[in] window The window instance.
+ * @param[in] enable Enable floating mode or not.
+ */
+DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 4e53d59..98d8b20 100644 (file)
@@ -372,6 +372,23 @@ void WindowBaseAndroid::ImeWindowReadyToRender()
 {
 }
 
+void WindowBaseAndroid::RequestMoveToServer()
+{
+}
+
+void WindowBaseAndroid::RequestResizeToServer(WindowResizeDirection direction)
+{
+}
+
+void WindowBaseAndroid::EnableFloatingMode(bool enable)
+{
+}
+
+bool WindowBaseAndroid::IsFloatingModeEnabled() const
+{
+  return false;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index d8dab58..c3c52b3 100644 (file)
@@ -383,6 +383,27 @@ public:
    */
   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;
+
 private:
   /**
    * Second stage initialization
index 22c6d7a..389e7c5 100644 (file)
@@ -338,6 +338,36 @@ public:
   virtual void WindowRotationCompleted(int degree, int width, int height) = 0;
 
   /**
+   * @brief starts the window is moved by display server
+   */
+  virtual void RequestMoveToServer() = 0;
+
+  /**
+   * @brief starts the window is resized by display server
+   *
+   * @param[in] direction It is direction of the started edge/side.
+   */
+  virtual void RequestResizeToServer(WindowResizeDirection direction) = 0;
+
+  /**
+   * @brief Enables the floating mode of window.
+   *
+   * The floating mode is to support making partial size window easliy.
+   * It is useful to make popup style window
+   * and this window is always upper than the other normal window.
+   *
+   * A special display server(as a Tizen display server) supports this mode.
+   *
+   * @param[in] enable Enable floating mode or not.
+   */
+  virtual void EnableFloatingMode(bool enable) = 0;
+
+  /**
+   * @brief Gets whether floating mode is enabled or not.
+   */
+  virtual bool IsFloatingModeEnabled() const = 0;
+
+  /**
    * @copydoc Dali::Window::SetTransparency()
    */
   virtual void SetTransparency(bool transparent) = 0;
index a1a1bf6..0aa1cb1 100644 (file)
@@ -640,6 +640,11 @@ Dali::Window::WindowPosition Window::GetPosition() const
   return Dali::Window::WindowPosition(positionSize.x, positionSize.y);
 }
 
+PositionSize Window::GetPositionSize() const
+{
+  return mSurface->GetPositionSize();
+}
+
 void Window::SetPositionSize(PositionSize positionSize)
 {
   PositionSize oldRect = mSurface->GetPositionSize();
@@ -668,11 +673,6 @@ void Window::SetPositionSize(PositionSize positionSize)
   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer(), true)->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
 }
 
-PositionSize Window::GetPositionSize() const
-{
-  return mSurface->GetPositionSize();
-}
-
 Dali::Layer Window::GetRootLayer() const
 {
   return mScene.GetRootLayer();
@@ -980,6 +980,21 @@ int32_t Window::GetNativeId() const
   return mWindowBase->GetNativeWindowId();
 }
 
+void Window::RequestMoveToServer()
+{
+  mWindowBase->RequestMoveToServer();
+}
+
+void Window::RequestResizeToServer(WindowResizeDirection direction)
+{
+  mWindowBase->RequestResizeToServer(direction);
+}
+
+void Window::EnableFloatingMode(bool enable)
+{
+  mWindowBase->EnableFloatingMode(enable);
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 305040c..b7c1d61 100644 (file)
@@ -376,6 +376,21 @@ public: // Dali::Internal::Adaptor::SceneHolder
    */
   int32_t GetNativeId() const;
 
+  /**
+   * @copydoc Dali::DevelWindow::RequestMoveToServer()
+   */
+  void RequestMoveToServer();
+
+  /**
+   * @copydoc Dali::DevelWindow::RequestResizeToServer()
+   */
+  void RequestResizeToServer(WindowResizeDirection direction);
+
+  /**
+   * @copydoc Dali::DevelWindow::EnableFloatingMode()
+   */
+  void EnableFloatingMode(bool enable);
+
 private:
   /**
    * @brief Enumeration for orietation mode.
index 1d6c091..41bc806 100644 (file)
@@ -317,6 +317,26 @@ public:
    */
   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;
+
 private:
   // Undefined
   WindowBaseCocoa(const WindowBaseCocoa&) = delete;
index 6a93269..e4c06ac 100644 (file)
@@ -663,6 +663,23 @@ void WindowBaseCocoa::ImeWindowReadyToRender()
 {
 }
 
+void WindowBaseCocoa::RequestMoveToServer()
+{
+}
+
+void WindowBaseCocoa::RequestResizeToServer(WindowResizeDirection direction)
+{
+}
+
+void WindowBaseCocoa::EnableFloatingMode(bool enable)
+{
+}
+
+bool WindowBaseCocoa::IsFloatingModeEnabled() const
+{
+  return false;
+}
+
 } // namespace Dali::Internal::Adaptor
 
 @implementation CocoaView
index ce7b744..37f992c 100644 (file)
@@ -2192,6 +2192,23 @@ void WindowBaseEcoreWl::ImeWindowReadyToRender()
 {
 }
 
+void WindowBaseEcoreWl::RequestMoveToServer()
+{
+}
+
+void WindowBaseEcoreWl::RequestResizeToServer(WindowResizeDirection direction)
+{
+}
+
+void WindowBaseEcoreWl::EnableFloatingMode(bool enable)
+{
+}
+
+bool WindowBaseEcoreWl::IsFloatingModeEnabled() const
+{
+  return false;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 9c39f23..003fdfa 100644 (file)
@@ -450,6 +450,26 @@ public:
    */
   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;
+
 private:
   /**
    * Second stage initialization
index 6e72f90..d467bb3 100644 (file)
@@ -847,7 +847,7 @@ void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool
   InitializeEcoreElDBus();
 
   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
-  mDisplay = ecore_wl2_display_get(display);
+  mDisplay                   = ecore_wl2_display_get(display);
 
   if(mDisplay)
   {
@@ -985,7 +985,7 @@ void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
     rotationEvent.angle     = ev->angle;
     rotationEvent.winResize = 0;
 
-    if(ev->w == 0 || ev->h ==0)
+    if(ev->w == 0 || ev->h == 0)
     {
       // Use previous client side window's size.
       if(mWindowRotationAngle == 90 || mWindowRotationAngle == 270)
@@ -1000,7 +1000,7 @@ void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
       }
     }
 
-    mWindowRotationAngle    = ev->angle;
+    mWindowRotationAngle = ev->angle;
 
     if(ev->angle == 0 || ev->angle == 180)
     {
@@ -2612,6 +2612,114 @@ void WindowBaseEcoreWl2::ImeWindowReadyToRender()
   wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
 }
 
+void WindowBaseEcoreWl2::RequestMoveToServer()
+{
+  Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
+  if(!display)
+  {
+    DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
+    return;
+  }
+
+  Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
+  if(!input)
+  {
+    DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
+    return;
+  }
+
+  ecore_wl2_window_move(mEcoreWindow, input);
+  DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
+}
+
+void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
+{
+  Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
+  if(!display)
+  {
+    DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
+    return;
+  }
+
+  Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
+  if(!input)
+  {
+    DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
+    return;
+  }
+
+  int location = 0;
+  switch(direction)
+  {
+    case WindowResizeDirection::TOP_LEFT:
+    {
+      location = 5;
+      break;
+    }
+    case WindowResizeDirection::TOP:
+    {
+      location = 1;
+      break;
+    }
+    case WindowResizeDirection::TOP_RIGHT:
+    {
+      location = 9;
+      break;
+    }
+    case WindowResizeDirection::LEFT:
+    {
+      location = 4;
+      break;
+    }
+    case WindowResizeDirection::RIGHT:
+    {
+      location = 8;
+      break;
+    }
+    case WindowResizeDirection::BOTTOM_LEFT:
+    {
+      location = 6;
+      break;
+    }
+    case WindowResizeDirection::BOTTOM:
+    {
+      location = 2;
+      break;
+    }
+    case WindowResizeDirection::BOTTOM_RIGHT:
+    {
+      location = 10;
+      break;
+    }
+    default:
+    {
+      location = 0;
+      break;
+    }
+  }
+
+  ecore_wl2_window_resize(mEcoreWindow, input, location);
+  DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, mode:%d\n", mEcoreWindow, location);
+}
+
+void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
+{
+  DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
+  if(enable == true)
+  {
+    ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
+  }
+  else
+  {
+    ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
+  }
+}
+
+bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
+{
+  return ecore_wl2_window_floating_mode_get(mEcoreWindow);
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index e7426a6..9c71f52 100644 (file)
@@ -482,6 +482,26 @@ public:
    */
   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;
+
 private:
   /**
    * Second stage initialization
index 1efb01c..fa125d8 100644 (file)
@@ -938,6 +938,23 @@ void WindowBaseEcoreX::ImeWindowReadyToRender()
 {
 }
 
+void WindowBaseEcoreX::RequestMoveToServer()
+{
+}
+
+void WindowBaseEcoreX::RequestResizeToServer(WindowResizeDirection direction)
+{
+}
+
+void WindowBaseEcoreX::EnableFloatingMode(bool enable)
+{
+}
+
+bool WindowBaseEcoreX::IsFloatingModeEnabled() const
+{
+  return false;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index cd6f241..03ffbcc 100644 (file)
@@ -384,6 +384,26 @@ public:
    */
   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;
+
 private:
   /**
    * Second stage initialization
index 5941dca..748f707 100644 (file)
@@ -594,6 +594,23 @@ void WindowBaseWin::ImeWindowReadyToRender()
 {
 }
 
+void WindowBaseWin::RequestMoveToServer()
+{
+}
+
+void WindowBaseWin::RequestResizeToServer(WindowResizeDirection direction)
+{
+}
+
+void WindowBaseWin::EnableFloatingMode(bool enable)
+{
+}
+
+bool WindowBaseWin::IsFloatingModeEnabled() const
+{
+  return false;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index ec87a4a..854e66c 100644 (file)
@@ -371,6 +371,26 @@ public:
    */
   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;
+
 private:
   /**
    * Second stage initialization
index c77ce66..aeac241 100644 (file)
@@ -113,6 +113,21 @@ enum class WindowOperationResult
   INVALID_OPERATION, ///< The operation is invalid. (e.g. Try to operate to the wrong window)
 };
 
+/**
+ * @brief Enumeration of direction for window resized by display server.
+ */
+enum class WindowResizeDirection
+{
+  TOP_LEFT      = 1, ///< Start resizing window to the top-left edge.
+  TOP           = 2, ///< Start resizing window to the top side.
+  TOP_RIGHT     = 3, ///< Start resizing window to the top-right edge.
+  LEFT          = 4, ///< Start resizing window to the left side.
+  RIGHT         = 5, ///< Start resizing window to the right side.
+  BOTTOM_LEFT   = 6, ///< Start resizing window to the bottom-left edge.
+  BOTTOM        = 7, ///< Start resizing window to the bottom side.
+  BOTTOM_RIGHT  = 8  ///< Start resizing window to the bottom-right edge.
+};
+
 } // namespace Dali
 
 #endif // DALI_WINDOW_ENUMERATIONS_H