Revert "Fix unParent and rotation bug"
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:16:58 +0000 (15:16 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:17:01 +0000 (15:17 +0900)
This reverts commit 97c1cd8a9477790a316415bd86a48e6480f37438.

Change-Id: Ie057a3199ff03f5afa94e47b2a42b347b1ee01c2

dali/internal/window-system/common/window-base.h
dali/internal/window-system/common/window-impl.cpp
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 c0252c2..5f29f56 100644 (file)
@@ -331,7 +331,13 @@ public:
   /**
    * @copydoc Dali::Window::SetParent()
    */
-  virtual void SetParent( WindowBase* parentWinBase ) = 0;
+  virtual void SetParent( Any parent ) = 0;
+
+  /**
+   * @brief Check whether the window is matched or not.
+   * @return The result of matched.
+   */
+  virtual bool IsMatchedWindow( Any window ) = 0;
 
   // Signals
 
index 78d820c..7759dad 100644 (file)
@@ -629,14 +629,14 @@ void Window::OnRotation( const RotationEvent& rotation )
 
   SurfaceResized();
 
-  mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
+  mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mRotationAngle, mWindowHeight ) );
 
   // Emit signal
   Dali::Window handle( this );
-  mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
-  mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
+  mResizedSignal.Emit( Dali::Window::WindowSize( mRotationAngle, mWindowHeight ) );
+  mResizeSignal.Emit( handle, Dali::Window::WindowSize( mRotationAngle, mWindowHeight ) );
 
-  mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
+  mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mRotationAngle, mWindowHeight ) );
 }
 
 void Window::OnPause()
@@ -708,20 +708,20 @@ void Window::SetParent( Dali::Window& parent )
   if ( DALI_UNLIKELY( parent ) )
   {
     mParentWindow = parent;
-    Dali::Window self = Dali::Window( this );
+    Dali::Window grandParent = Dali::DevelWindow::GetParent( parent );
     // check circular parent window setting
-    if ( Dali::DevelWindow::GetParent( parent ) == self )
+    if ( DALI_UNLIKELY( grandParent ) && mWindowBase->IsMatchedWindow( grandParent.GetNativeHandle() ) )
     {
       Dali::DevelWindow::Unparent( parent );
     }
-    mWindowBase->SetParent( GetImplementation( mParentWindow ).mWindowBase );
+    mWindowBase->SetParent( parent.GetNativeHandle() );
   }
 }
 
 void Window::Unparent()
 {
-  mWindowBase->SetParent( nullptr );
-  mParentWindow.Reset();
+  Any parent;
+  mWindowBase->SetParent( parent );
 }
 
 Dali::Window Window::GetParent()
index 84b9b2e..5b67e26 100644 (file)
@@ -2132,15 +2132,35 @@ void WindowBaseEcoreWl::CreateWindow( PositionSize positionSize )
   }
 }
 
-void WindowBaseEcoreWl::SetParent( WindowBase* parentWinBase )
+void WindowBaseEcoreWl::SetParent( Any parent )
 {
-  Ecore_Wl_Window* ecoreParent = NULL;
-  if( parentWinBase )
+  Ecore_Wl_Window* mEcoreParent;
+  if( parent.Empty() == false )
   {
-    WindowBaseEcoreWl* winBaseEcore = static_cast<WindowBaseEcoreWl*>( parentWinBase );
-    ecoreParent = winBaseEcore->mEcoreWindow;
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( parent.GetType() == typeid (Ecore_Wl_Window *) ) && "Parent's surface type is invalid" );
+    mEcoreParent = AnyCast< Ecore_Wl_Window* >( parent );
+  }
+  else
+  {
+    mEcoreParent = NULL;
+  }
+  ecore_wl_window_parent_set( mEcoreWindow, mEcoreParent );
+}
+
+bool WindowBaseEcoreWl::IsMatchedWindow( Any window )
+{
+  bool ret = false;
+  if ( window.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( window.GetType() == typeid (Ecore_Wl_Window *) ) && "Window's surface type is invalid" );
+    if ( AnyCast< Ecore_Wl_Window* >( window ) == mEcoreWindow )
+    {
+      ret = true;
+    }
   }
-  ecore_wl_window_parent_set( mEcoreWindow, ecoreParent );
+  return ret;
 }
 
 } // namespace Adaptor
index e54ab94..922e278 100644 (file)
@@ -417,7 +417,12 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
    */
-  virtual void SetParent( WindowBase* parentWinBase ) override;
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
 
 private:
 
index dc673ea..2f5cf34 100755 (executable)
@@ -1248,7 +1248,7 @@ void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
     }
     case 90:
     {
-      rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
+      rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
       break;
     }
     case 180:
@@ -2187,15 +2187,35 @@ void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
   ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
 }
 
-void WindowBaseEcoreWl2::SetParent( WindowBase* parentWinBase )
+void WindowBaseEcoreWl2::SetParent( Any parent )
 {
-  Ecore_Wl2_Window* ecoreParent = NULL;
-  if( parentWinBase )
+  Ecore_Wl2_Window* mEcoreParent;
+  if( parent.Empty() == false )
   {
-    WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>( parentWinBase );
-    ecoreParent = winBaseEcore2->mEcoreWindow;
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( parent.GetType() == typeid (Ecore_Wl2_Window *) ) && "Parent's surface type is invalid" );
+    mEcoreParent = AnyCast< Ecore_Wl2_Window* >( parent );
+  }
+  else
+  {
+    mEcoreParent = NULL;
+  }
+  ecore_wl2_window_parent_set( mEcoreWindow, mEcoreParent );
+}
+
+bool WindowBaseEcoreWl2::IsMatchedWindow( Any window )
+{
+  bool ret = false;
+  if ( window.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( window.GetType() == typeid (Ecore_Wl2_Window *) ) && "Window's surface type is invalid" );
+    if ( AnyCast< Ecore_Wl2_Window*>( window ) == mEcoreWindow )
+    {
+      ret = true;
+    }
   }
-  ecore_wl2_window_parent_set( mEcoreWindow, ecoreParent );
+  return ret;
 }
 
 } // namespace Adaptor
index 885aeeb..2b45ae0 100644 (file)
@@ -422,7 +422,12 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
    */
-  virtual void SetParent( WindowBase* parentWinBase ) override;
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
 
 private:
 
index 45a4d59..0c36b1d 100755 (executable)
@@ -888,22 +888,48 @@ void WindowBaseEcoreX::CreateWindow( PositionSize positionSize, bool isTranspare
  }
 }
 
-void WindowBaseEcoreX::SetParent( WindowBase* parentWinBase )
+void WindowBaseEcoreX::SetParent( Any parent )
 {
-  Ecore_X_Window ecoreParent = 0;
-  if( parentWinBase )
+  Ecore_X_Window mEcoreParent;
+  if ( parent.Empty() == false )
   {
-    WindowBaseEcoreX* winBaseEcoreX = static_cast<WindowBaseEcoreX*>( parentWinBase );
-    ecoreParent = winBaseEcoreX->mEcoreWindow;
-    ecore_x_icccm_transient_for_set( mEcoreWindow, ecoreParent );
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( (parent.GetType() == typeid (Ecore_X_Window) ) )
+                        && "Surface type is invalid" );
+
+    if ( parent.GetType() == typeid (Ecore_X_Window) )
+    {
+      mEcoreParent = AnyCast< Ecore_X_Window >( parent );
+      ecore_x_icccm_transient_for_set( mEcoreWindow, mEcoreParent );
+    }
+    else
+    {
+      mEcoreParent = 0;
+      ecore_x_icccm_transient_for_unset( mEcoreWindow );
+    }
   }
   else
   {
-    ecoreParent = 0;
+    mEcoreParent = 0;
     ecore_x_icccm_transient_for_unset( mEcoreWindow );
   }
 }
 
+bool WindowBaseEcoreX::IsMatchedWindow( Any window )
+{
+  bool ret = false;
+  if ( window.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( (window.GetType() == typeid (Ecore_X_Window) ) ) && "Surface type is invalid" );
+    if ( AnyCast< Ecore_X_Window >( window ) == mEcoreWindow )
+    {
+      ret = true;
+    }
+  }
+  return ret;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 031445e..6c99f46 100644 (file)
@@ -351,7 +351,12 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
    */
-  virtual void SetParent( WindowBase* parentWinBase ) override;
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
 
 private:
 
index ef1c28d..87af139 100755 (executable)
@@ -552,11 +552,16 @@ void WindowBaseWin::EventEntry( TWinEventInfo *event )
   }
 }
 
-void WindowBaseWin::SetParent( WindowBase* parentWinBase )
+void WindowBaseWin::SetParent( Any parent )
 {
 
 }
 
+bool WindowBaseWin::IsMatchedWindow( Any window )
+{
+  return false;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 5e99156..f19fdfc 100755 (executable)
@@ -339,7 +339,12 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
    */
-  virtual void SetParent( WindowBase* parentWinBase ) override;
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
 
 private: