Revert "Fix unParent and rotation bug"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
index fbf04ca..7759dad 100644 (file)
@@ -86,9 +86,7 @@ Window::Window()
   mResizedSignal(),
   mDeleteRequestSignal(),
   mFocusChangeSignal(),
-  mResizeSignal(),
-  mVisibilityChangedSignal(),
-  mTransitionEffectEventSignal()
+  mResizeSignal()
 {
 }
 
@@ -115,7 +113,6 @@ void Window::Initialize(const PositionSize& positionSize, const std::string& nam
   mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
   mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
   mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
-  mWindowBase->TransitionEffectEventSignal().Connect( this, &Window::OnTransitionEffectEvent );
 
   mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
 
@@ -294,9 +291,6 @@ void Window::Show()
   {
     WindowVisibilityObserver* observer( mAdaptor );
     observer->OnWindowShown();
-
-    Dali::Window handle( this );
-    mVisibilityChangedSignal.Emit( handle, true );
   }
 
   DALI_LOG_RELEASE_INFO( "Window (%p) Show(): iconified = %d\n", this, mIconified );
@@ -312,9 +306,6 @@ void Window::Hide()
   {
     WindowVisibilityObserver* observer( mAdaptor );
     observer->OnWindowHidden();
-
-    Dali::Window handle( this );
-    mVisibilityChangedSignal.Emit( handle, false );
   }
 
   DALI_LOG_RELEASE_INFO( "Window (%p) Hide(): iconified = %d\n", this, mIconified );
@@ -463,13 +454,7 @@ void Window::SetSize( Dali::Window::WindowSize size )
   {
     Uint16Pair newSize( newRect.width, newRect.height );
 
-    bool forceUpdate = false;
-    if( mWindowBase->IsEglWindowRotationSupported() )
-    {
-      forceUpdate = true;
-    }
-
-    SurfaceResized( forceUpdate );
+    SurfaceResized();
 
     mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
 
@@ -527,13 +512,7 @@ void Window::SetPositionSize( PositionSize positionSize )
   {
     Uint16Pair newSize( newRect.width, newRect.height );
 
-    bool forceUpdate = false;
-    if( mWindowBase->IsEglWindowRotationSupported() )
-    {
-      forceUpdate = true;
-    }
-
-    SurfaceResized( forceUpdate );
+    SurfaceResized();
 
     mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
 
@@ -584,9 +563,6 @@ void Window::OnIconifyChanged( bool iconified )
     {
       WindowVisibilityObserver* observer( mAdaptor );
       observer->OnWindowHidden();
-
-      Dali::Window handle( this );
-      mVisibilityChangedSignal.Emit( handle, false );
     }
 
     DALI_LOG_RELEASE_INFO( "Window (%p) Iconified: visible = %d\n", this, mVisible );
@@ -599,9 +575,6 @@ void Window::OnIconifyChanged( bool iconified )
     {
       WindowVisibilityObserver* observer( mAdaptor );
       observer->OnWindowShown();
-
-      Dali::Window handle( this );
-      mVisibilityChangedSignal.Emit( handle, true );
     }
 
     DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified: visible = %d\n", this, mVisible );
@@ -617,13 +590,8 @@ void Window::OnFocusChanged( bool focusIn )
 
 void Window::OnOutputTransformed()
 {
-  bool forceUpdate = false;
-  if( mWindowBase->IsEglWindowRotationSupported() )
-  {
-    forceUpdate = true;
-  }
   PositionSize positionSize = mSurface->GetPositionSize();
-  SurfaceResized( forceUpdate );
+  SurfaceResized();
   mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
   mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
 }
@@ -633,12 +601,6 @@ void Window::OnDeleteRequest()
   mDeleteRequestSignal.Emit();
 }
 
-void Window::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
-{
-  Dali::Window handle( this );
-  mTransitionEffectEventSignal.Emit( handle, state, type );
-}
-
 void Window::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
 {
   FeedTouchPoint( point, timeStamp );
@@ -665,22 +627,16 @@ void Window::OnRotation( const RotationEvent& rotation )
 
   mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
 
-  bool forceUpdate = false;
-  if( mWindowBase->IsEglWindowRotationSupported() )
-  {
-    forceUpdate = true;
-  }
-
-  SurfaceResized( forceUpdate );
+  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()
@@ -752,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()