Add SetParent in Window 60/263560/1
authorWonsik Jung <sidein@samsung.com>
Mon, 6 Sep 2021 10:05:39 +0000 (19:05 +0900)
committerWonsik Jung <sidein@samsung.com>
Mon, 6 Sep 2021 10:05:39 +0000 (19:05 +0900)
Add SetParent in Window.
This function has additional flag whether child is the above or below of parent.

Change-Id: Ibcc1a3fd69b9f81cc0b856d634f4b39c908e9d1d

19 files changed:
automated-tests/src/dali-adaptor/utc-Dali-Window.cpp
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/gl-window-impl.cpp
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

index cab5d0a..b44030d 100644 (file)
@@ -1351,6 +1351,22 @@ int UtcDaliWindowSetParentNegative(void)
   END_TEST;
 }
 
+int UtcDaliWindowSetParentWithBelowParentNegative(void)
+{
+  try
+  {
+    Dali::Window arg1;
+    Dali::Window arg2;
+    DevelWindow::SetParent(arg1, arg2, true);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
 int UtcDaliWindowAddInputRegion(void)
 {
   Dali::Window instance;
index 908a8ae..9f87ce7 100644 (file)
@@ -106,6 +106,11 @@ void SetParent(Window window, Window parent)
   GetImplementation(window).SetParent(parent);
 }
 
+void SetParent(Window window, Window parent, bool belowParent)
+{
+  GetImplementation(window).SetParent(parent, belowParent);
+}
+
 void Unparent(Window window)
 {
   GetImplementation(window).Unparent();
index 108b4f4..8bc287e 100644 (file)
@@ -158,6 +158,18 @@ DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettings
 DALI_ADAPTOR_API void SetParent(Window window, Window parent);
 
 /**
+ * @brief Sets parent window of the window.
+ *
+ * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
+ * This function has the additional flag whether the child is located above or below of the parent.
+ *
+ * @param[in] window The window instance
+ * @param[in] parent The parent window instance
+ * @param[in] belowParent The flag is whether the child is located above or below of the parent.
+ */
+DALI_ADAPTOR_API void SetParent(Window window, Window parent, bool belowParent);
+
+/**
  * @brief Unsets parent window of the window.
  *
  * After unsetting, the window is disconnected his parent window.
index 99e1dee..9fc4ab7 100644 (file)
@@ -341,7 +341,7 @@ void WindowBaseAndroid::SetTransparency(bool transparent)
 {
 }
 
-void WindowBaseAndroid::SetParent(WindowBase* parentWinBase)
+void WindowBaseAndroid::SetParent(WindowBase* parentWinBase, bool belowParent)
 {
 }
 
index 8ba0a14..286ea5c 100644 (file)
@@ -351,7 +351,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()
index d94dbe8..4edb1a0 100644 (file)
@@ -740,7 +740,7 @@ void GlWindow::SetChild(Dali::Window& child)
       WindowBase* childWindowBase = renderSurface->GetWindowBase();
       if(childWindowBase)
       {
-        childWindowBase->SetParent(mWindowBase.get());
+        childWindowBase->SetParent(mWindowBase.get(), false);
       }
     }
   }
index 7983f45..926a365 100644 (file)
@@ -375,7 +375,7 @@ public:
   /**
    * @copydoc Dali::Window::SetParent()
    */
-  virtual void SetParent(WindowBase* parentWinBase) = 0;
+  virtual void SetParent(WindowBase* parentWinBase, bool belowParent) = 0;
 
   /**
    * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
index 1bc3188..2d88bb3 100644 (file)
@@ -917,13 +917,28 @@ void Window::SetParent(Dali::Window& parent)
     {
       Dali::DevelWindow::Unparent(parent);
     }
-    mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase);
+    mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, false);
+  }
+}
+
+void Window::SetParent(Dali::Window& parent, bool belowParent)
+{
+  if(DALI_UNLIKELY(parent))
+  {
+    mParentWindow     = parent;
+    Dali::Window self = Dali::Window(this);
+    // check circular parent window setting
+    if(Dali::DevelWindow::GetParent(parent) == self)
+    {
+      Dali::DevelWindow::Unparent(parent);
+    }
+    mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, belowParent);
   }
 }
 
 void Window::Unparent()
 {
-  mWindowBase->SetParent(nullptr);
+  mWindowBase->SetParent(nullptr, false);
   mParentWindow.Reset();
 }
 
index 761bb0e..843870b 100644 (file)
@@ -326,11 +326,16 @@ public:
   static Dali::Window Get(Dali::Actor actor);
 
   /**
-   * @copydoc Dali::DevelWindow::SetParent()
+   * @copydoc Dali::DevelWindow::SetParent(Window window, Window parent)
    */
   void SetParent(Dali::Window& parent);
 
   /**
+   * @copydoc Dali::DevelWindow::SetParent(Window window, Window parent, bool belowParent)
+   */
+  void SetParent(Dali::Window& parent, bool belowParent);
+
+  /**
    * @copydoc Dali::DevelWindow::Unparent()
    */
   void Unparent();
index b967686..7831e5f 100644 (file)
@@ -290,7 +290,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()
index 594a186..0053e79 100644 (file)
@@ -635,7 +635,7 @@ void WindowBaseCocoa::SetTransparency( bool transparent )
   mImpl->mWindow.alphaValue = static_cast<CGFloat>(!transparent);
 }
 
-void WindowBaseCocoa::SetParent( WindowBase* parentWinBase )
+void WindowBaseCocoa::SetParent(WindowBase* parentWinBase, bool belowParent)
 {
   auto &parent = dynamic_cast<WindowBaseCocoa&>(*parentWinBase);
   [mImpl->mWindow setParentWindow:parent.mImpl->mWindow];
index 55c6a7e..b5edc0a 100644 (file)
@@ -2159,7 +2159,7 @@ void WindowBaseEcoreWl::CreateWindow(PositionSize positionSize)
   }
 }
 
-void WindowBaseEcoreWl::SetParent(WindowBase* parentWinBase)
+void WindowBaseEcoreWl::SetParent(WindowBase* parentWinBase, bool belowParent)
 {
   Ecore_Wl_Window* ecoreParent = NULL;
   if(parentWinBase)
index 8cca415..c1b4dbd 100644 (file)
@@ -423,7 +423,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()
index 403337a..737f1a9 100644 (file)
@@ -2513,7 +2513,7 @@ void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
   ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
 }
 
-void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase)
+void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
 {
   Ecore_Wl2_Window* ecoreParent = NULL;
   if(parentWinBase)
@@ -2521,7 +2521,7 @@ void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase)
     WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
     ecoreParent                       = winBaseEcore2->mEcoreWindow;
   }
-  ecore_wl2_window_parent_set(mEcoreWindow, ecoreParent);
+  ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
 }
 
 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
index d05c99a..6c180c8 100644 (file)
@@ -455,7 +455,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()
index 67cb784..f7058dc 100644 (file)
@@ -900,7 +900,7 @@ void WindowBaseEcoreX::CreateWindow(PositionSize positionSize, bool isTransparen
   }
 }
 
-void WindowBaseEcoreX::SetParent(WindowBase* parentWinBase)
+void WindowBaseEcoreX::SetParent(WindowBase* parentWinBase, bool belowParent)
 {
   Ecore_X_Window ecoreParent = 0;
   if(parentWinBase)
index 2a34f8f..62d9b58 100644 (file)
@@ -357,7 +357,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()
index cb903ef..07c584e 100644 (file)
@@ -568,7 +568,7 @@ void WindowBaseWin::EventEntry(TWinEventInfo* event)
   }
 }
 
-void WindowBaseWin::SetParent(WindowBase* parentWinBase)
+void WindowBaseWin::SetParent(WindowBase* parentWinBase, bool belowParent)
 {
 }
 
index 6e0f7db..a98e8b8 100644 (file)
@@ -344,7 +344,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()