[Tizen] Add Effect Start/End signal
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:25:19 +0000 (15:25 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:25:31 +0000 (15:25 +0900)
Change-Id: Ief6d5dd287044da06a0dd3da34436e4b281f27b5

dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/internal/window-system/common/window-base.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/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h

index 8715b81..aefb546 100644 (file)
@@ -70,6 +70,11 @@ VisibilityChangedSignalType& VisibilityChangedSignal( Window window )
   return GetImplementation( window ).VisibilityChangedSignal();
 }
 
+TransitionEffectEventSignalType& TransitionEffectEventSignal( Window window )
+{
+  return GetImplementation( window ).TransitionEffectEventSignal();
+}
+
 void SetParent( Window window, Window parent )
 {
   GetImplementation( window ).SetParent( parent );
index 47e676c..9c02a70 100644 (file)
@@ -30,6 +30,25 @@ class RenderTaskList;
 
 namespace DevelWindow
 {
+/**
+ * @brief Enumeration for transition effect's state.
+ */
+enum class EffectState
+{
+  NONE = 0,    ///< None state
+  START,       ///< Transition effect is started.
+  END          ///< Transition effect is ended.
+};
+
+/**
+ * @brief Enumeration for transition effect's type.
+ */
+enum class  EffectType
+{
+  NONE = 0,    ///< None type
+  SHOW,        ///< Window show effect.
+  HIDE,        ///< Window hide effect.
+};
 
 typedef Signal< void () > EventProcessingFinishedSignalType;       ///< Event Processing finished signal type
 
@@ -41,6 +60,8 @@ typedef Signal< void (const WheelEvent&) > WheelEventSignalType;   ///< Touched
 
 typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType; ///< Visibility changed signal type
 
+typedef Signal< void (Window, EffectState, EffectType) > TransitionEffectEventSignalType; ///< Effect signal type and state
+
 /**
  * @brief Sets position and size of the window. This API guarantees that both moving and resizing of window will appear on the screen at once.
  *
@@ -128,6 +149,21 @@ DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal( Window window );
 DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
 
 /**
+ * @brief This signal is emitted for transition effect.
+ *
+ * The transition animation is appeared when the window is shown/hidden.
+ * When the animation is started, START signal is emitted.
+ * Then the animation is ended, END signal is emitted, too.
+ * A callback of the following type may be connected:
+ * @code
+ *   void YourCallbackName( Window window, EffectState state, EffectType type );
+ * @endcode
+ * @param[in] window The window instance
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal( Window window );
+
+/**
  * @brief Sets parent window of the window.
  *
  * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
index 8c63be3..f3101b6 100644 (file)
@@ -40,7 +40,8 @@ WindowBase::WindowBase()
   mSelectionDataSendSignal(),
   mSelectionDataReceivedSignal(),
   mStyleChangedSignal(),
-  mAccessibilitySignal()
+  mAccessibilitySignal(),
+  mTransitionEffectEventSignal()
 {
 }
 
@@ -113,6 +114,11 @@ WindowBase::AccessibilitySignalType& WindowBase::AccessibilitySignal()
   return mAccessibilitySignal;
 }
 
+WindowBase::TransitionEffectEventSignalType& WindowBase::TransitionEffectEventSignal()
+{
+  return mTransitionEffectEventSignal;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 2246d6c..86cb25b 100644 (file)
@@ -30,6 +30,7 @@
 #include <dali/public-api/adaptor-framework/window.h>
 #include <dali/public-api/adaptor-framework/key-grab.h>
 #include <dali/public-api/adaptor-framework/style-change.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
 #include <dali/internal/window-system/common/damage-observer.h>
 #include <dali/internal/window-system/common/rotation-event.h>
 #include <dali/internal/graphics/gles/egl-implementation.h>
@@ -69,6 +70,7 @@ public:
   typedef Signal< void ( ) > DeleteSignalType;
   typedef Signal< void ( const DamageArea& ) > DamageSignalType;
   typedef Signal< void ( const RotationEvent& ) > RotationSignalType;
+  typedef Signal< void ( DevelWindow::EffectState, DevelWindow::EffectType ) > TransitionEffectEventSignalType;
 
   // Input events
   typedef Signal< void ( Integration::Point&, uint32_t ) > TouchEventSignalType;
@@ -411,6 +413,11 @@ public:
    */
   AccessibilitySignalType& AccessibilitySignal();
 
+  /**
+   * @brief This signal is emitted when window's transition animation is started or ended.
+   */
+  TransitionEffectEventSignalType& TransitionEffectEventSignal();
+
 protected:
 
   // Undefined
@@ -434,6 +441,7 @@ protected:
   SelectionSignalType                  mSelectionDataReceivedSignal;
   StyleSignalType                      mStyleChangedSignal;
   AccessibilitySignalType              mAccessibilitySignal;
+  TransitionEffectEventSignalType      mTransitionEffectEventSignal;
 };
 
 } // namespace Adaptor
index 46d0e91..7e9a4fd 100644 (file)
@@ -82,7 +82,8 @@ Window::Window()
   mDeleteRequestSignal(),
   mFocusChangeSignal(),
   mResizeSignal(),
-  mVisibilityChangedSignal()
+  mVisibilityChangedSignal(),
+  mTransitionEffectEventSignal()
 {
 }
 
@@ -109,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 );
 
@@ -626,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 );
index 8513fb1..be1a640 100644 (file)
@@ -63,6 +63,7 @@ public:
   typedef Dali::Window::FocusChangeSignalType FocusChangeSignalType;
   typedef Dali::Window::ResizeSignalType ResizeSignalType;
   typedef Dali::DevelWindow::VisibilityChangedSignalType VisibilityChangedSignalType;
+  typedef Dali::DevelWindow::TransitionEffectEventSignalType TransitionEffectEventSignalType;
   typedef Signal< void () > SignalType;
 
   /**
@@ -396,6 +397,11 @@ private:
    */
   void OnDeleteRequest();
 
+  /**
+   * Called when the window receives a Transition effect-start/end event.
+   */
+  void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type );
+
 private: // Dali::Internal::Adaptor::SceneHolder
 
   /**
@@ -486,6 +492,11 @@ public: // Signals
    */
   Dali::DevelWindow::EventProcessingFinishedSignalType& EventProcessingFinishedSignal() { return mScene.EventProcessingFinishedSignal(); }
 
+  /**
+   * @copydoc Dali::DevelWindow::TransitionEffectEventSignal()
+   */
+  TransitionEffectEventSignalType& TransitionEffectEventSignal() { return mTransitionEffectEventSignal; }
+
 private:
 
   WindowRenderSurface*                  mWindowSurface;      ///< The window rendering surface
@@ -518,6 +529,7 @@ private:
   FocusChangeSignalType                 mFocusChangeSignal;
   ResizeSignalType                      mResizeSignal;
   VisibilityChangedSignalType           mVisibilityChangedSignal;
+  TransitionEffectEventSignalType       mTransitionEffectEventSignal;
 };
 
 } // namespace Adaptor
index 0149f41..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 )
index a9edd4e..b64a873 100644 (file)
@@ -155,6 +155,11 @@ public:
    */
   void OnFontSizeChanged();
 
+  /**
+   * @brief Called when a transition effect-start/end event is received.
+   */
+  void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type );
+
 #ifdef DALI_ELDBUS_AVAILABLE
   /**
    * @brief Called when Ecore ElDBus accessibility event is received.