[Tizen] Add Effect Start/End signal
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
index 4ecda0d..7e9a4fd 100644 (file)
 #include <dali/devel-api/adaptor-framework/orientation.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 
-#ifdef DALI_ADAPTOR_COMPILATION
-#include <dali/integration-api/render-surface-interface.h>
-#else
-#include <dali/integration-api/adaptors/render-surface-interface.h>
-#endif
-
 // INTERNAL HEADERS
+#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
 #include <dali/internal/window-system/common/event-handler.h>
 #include <dali/internal/window-system/common/orientation-impl.h>
 #include <dali/internal/window-system/common/render-surface-factory.h>
@@ -84,7 +79,11 @@ Window::Window()
   mWindowHeight( 0 ),
   mFocusChangedSignal(),
   mResizedSignal(),
-  mDeleteRequestSignal()
+  mDeleteRequestSignal(),
+  mFocusChangeSignal(),
+  mResizeSignal(),
+  mVisibilityChangedSignal(),
+  mTransitionEffectEventSignal()
 {
 }
 
@@ -111,6 +110,7 @@ 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 );
 
@@ -289,6 +289,9 @@ 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 );
@@ -304,6 +307,9 @@ 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 );
@@ -452,11 +458,19 @@ void Window::SetSize( Dali::Window::WindowSize size )
   {
     Uint16Pair newSize( newRect.width, newRect.height );
 
-    SurfaceResized();
+    bool forceUpdate = false;
+    if( mWindowBase->IsEglWindowRotationSupported() )
+    {
+      forceUpdate = true;
+    }
+
+    SurfaceResized( forceUpdate );
 
     mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
 
+    Dali::Window handle( this );
     mResizedSignal.Emit( newSize );
+    mResizeSignal.Emit( handle, newSize );
 
     mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
   }
@@ -508,12 +522,19 @@ void Window::SetPositionSize( PositionSize positionSize )
   {
     Uint16Pair newSize( newRect.width, newRect.height );
 
-    SurfaceResized();
+    bool forceUpdate = false;
+    if( mWindowBase->IsEglWindowRotationSupported() )
+    {
+      forceUpdate = true;
+    }
+
+    SurfaceResized( forceUpdate );
 
     mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
 
+    Dali::Window handle( this );
     mResizedSignal.Emit( newSize );
-
+    mResizeSignal.Emit( handle, newSize );
     mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
   }
 }
@@ -558,6 +579,9 @@ 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 );
@@ -570,6 +594,9 @@ 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 );
@@ -578,13 +605,20 @@ void Window::OnIconifyChanged( bool iconified )
 
 void Window::OnFocusChanged( bool focusIn )
 {
+  Dali::Window handle( this );
   mFocusChangedSignal.Emit( focusIn );
+  mFocusChangeSignal.Emit( handle, focusIn );
 }
 
 void Window::OnOutputTransformed()
 {
+  bool forceUpdate = false;
+  if( mWindowBase->IsEglWindowRotationSupported() )
+  {
+    forceUpdate = true;
+  }
   PositionSize positionSize = mSurface->GetPositionSize();
-  SurfaceResized();
+  SurfaceResized( forceUpdate );
   mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
   mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
 }
@@ -594,6 +628,12 @@ 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 );
@@ -620,14 +660,22 @@ void Window::OnRotation( const RotationEvent& rotation )
 
   mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
 
-  SurfaceResized();
+  bool forceUpdate = false;
+  if( mWindowBase->IsEglWindowRotationSupported() )
+  {
+    forceUpdate = true;
+  }
 
-  mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mRotationAngle, mWindowHeight ) );
+  SurfaceResized( forceUpdate );
+
+  mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
 
   // Emit signal
-  mResizedSignal.Emit( Dali::Window::WindowSize( mRotationAngle, mWindowHeight ) );
+  Dali::Window handle( this );
+  mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
+  mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
 
-  mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mRotationAngle, mWindowHeight ) );
+  mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
 }
 
 void Window::OnPause()
@@ -694,26 +742,25 @@ Dali::Window Window::Get( Dali::Actor actor )
   return Dali::Window( windowImpl );
 }
 
-
 void Window::SetParent( Dali::Window& parent )
 {
   if ( DALI_UNLIKELY( parent ) )
   {
     mParentWindow = parent;
-    Dali::Window grandParent = Dali::DevelWindow::GetParent( parent );
+    Dali::Window self = Dali::Window( this );
     // check circular parent window setting
-    if ( DALI_UNLIKELY( grandParent ) && mWindowBase->IsMatchedWindow( grandParent.GetNativeHandle() ) )
+    if ( Dali::DevelWindow::GetParent( parent ) == self )
     {
       Dali::DevelWindow::Unparent( parent );
     }
-    mWindowBase->SetParent( parent.GetNativeHandle() );
+    mWindowBase->SetParent( GetImplementation( mParentWindow ).mWindowBase );
   }
 }
 
 void Window::Unparent()
 {
-  Any parent;
-  mWindowBase->SetParent( parent );
+  mWindowBase->SetParent( nullptr );
+  mParentWindow.Reset();
 }
 
 Dali::Window Window::GetParent()