[Tizen] Add Effect Start/End signal
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
index 1c6a63b..de1c76d 100755 (executable)
@@ -432,6 +432,46 @@ static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
+// Effect Start/End Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Called when transition animation of the window's shown/hidden is started by window manager.
+ */
+static Eina_Bool EcoreEventEffectStart(void *data, int type, void *event)
+{
+  WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+  Ecore_Wl2_Event_Effect_Start *effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>( event );
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type );
+  if( windowBase )
+  {
+    if( effectStart->type < 3 ) // only under restack
+    {
+      windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::START, static_cast<DevelWindow::EffectType>( effectStart->type ) );
+    }
+  }
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when transition animation of the window's shown/hidden is ended by window manager.
+ */
+static Eina_Bool EcoreEventEffectEnd(void *data, int type, void *event)
+{
+  Ecore_Wl2_Event_Effect_Start *effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>( event );
+  WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type );
+  if( windowBase )
+  {
+    if( effectEnd->type < 3 ) // only under restack
+    {
+      windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::END, static_cast<DevelWindow::EffectType>( effectEnd->type ) );
+    }
+  }
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
 // Font Callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -707,6 +747,10 @@ void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, boo
   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND,            EcoreEventDataSend,                  this ) );
   mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY,        EcoreEventDataReceive,               this ) );
 
+  // Register Effect Start/End event
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_START,                EcoreEventEffectStart,               this ) );
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_END,                  EcoreEventEffectEnd,                 this ) );
+
   // Register Vconf notify - font name and size
   vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
   vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
@@ -1147,6 +1191,11 @@ void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context,
 #endif
 }
 
+void WindowBaseEcoreWl2::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
+{
+  mTransitionEffectEventSignal.Emit( state, type );
+}
+
 void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
 {
   if( strcmp( interface, tizen_policy_interface.name ) == 0 )
@@ -1251,7 +1300,7 @@ void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
     }
     case 90:
     {
-      rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
+      rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
       break;
     }
     case 180:
@@ -2207,35 +2256,15 @@ void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
   ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
 }
 
-void WindowBaseEcoreWl2::SetParent( Any parent )
-{
-  Ecore_Wl2_Window* mEcoreParent;
-  if( parent.Empty() == false )
-  {
-    // 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 )
+void WindowBaseEcoreWl2::SetParent( WindowBase* parentWinBase )
 {
-  bool ret = false;
-  if ( window.Empty() == false )
+  Ecore_Wl2_Window* ecoreParent = NULL;
+  if( parentWinBase )
   {
-    // 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;
-    }
+    WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>( parentWinBase );
+    ecoreParent = winBaseEcore2->mEcoreWindow;
   }
-  return ret;
+  ecore_wl2_window_parent_set( mEcoreWindow, ecoreParent );
 }
 
 } // namespace Adaptor