[Tizen] Revert "Use touch consumed return to set whether we process a gesture or...
[platform/core/uifw/dali-core.git] / dali / internal / event / events / hover-event-processor.cpp
index 2ddd84a..e32d587 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
 #include <dali/integration-api/events/hover-event-integ.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
 #include <dali/internal/event/events/hit-test-algorithm-impl.h>
 #include <dali/internal/event/events/multi-point-event-util.h>
 #include <dali/internal/event/render-tasks/render-task-impl.h>
@@ -146,12 +146,8 @@ struct ActorHoverableCheck : public HitTestAlgorithm::HitTestInterface
 
 } // unnamed namespace
 
-HoverEventProcessor::HoverEventProcessor( Stage& stage )
-: mStage( stage ),
-  mLastPrimaryHitActor(),
-  mLastConsumedActor(),
-  mHoverStartConsumedActor(),
-  mLastRenderTask()
+HoverEventProcessor::HoverEventProcessor( Scene& scene )
+: mScene( scene )
 {
   DALI_LOG_TRACE_METHOD( gLogFilter );
 }
@@ -164,10 +160,8 @@ HoverEventProcessor::~HoverEventProcessor()
 void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& event )
 {
   DALI_LOG_TRACE_METHOD( gLogFilter );
-
   DALI_ASSERT_ALWAYS( !event.points.empty() && "Empty HoverEvent sent from Integration\n" );
 
-  Stage& stage = mStage;
   TouchPoint::State state = static_cast< TouchPoint::State >( event.points[0].GetState() );
 
   PRINT_HIERARCHY(gLogFilter);
@@ -235,7 +229,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
   {
     HitTestAlgorithm::Results hitTestResults;
     ActorHoverableCheck actorHoverableCheck;
-    HitTestAlgorithm::HitTest( stage, iter->GetScreenPosition(), hitTestResults, actorHoverableCheck );
+    HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), iter->GetScreenPosition(), hitTestResults, actorHoverableCheck );
 
     TouchPoint newPoint( iter->GetTouchPoint() );
     newPoint.hitActor = hitTestResults.actor;
@@ -246,7 +240,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
     DALI_LOG_INFO( gLogFilter, Debug::General, "  State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n",
                    TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y,
                    ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ),
-                   ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ),
+                   ( hitTestResults.actor ? hitTestResults.actor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" ),
                    hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y );
 
     // Only set the currentRenderTask for the primary hit actor.
@@ -269,12 +263,12 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
   Dali::Actor primaryHitActor = primaryPoint.hitActor;
   TouchPoint::State primaryPointState = primaryPoint.state;
 
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor:     (%p) %s\n", primaryPoint.hitActor ? reinterpret_cast< void* >( &primaryPoint.hitActor.GetBaseObject() ) : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetName().c_str() : "" );
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor:       (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetName().c_str() : "" );
+  DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor:     (%p) %s\n", primaryPoint.hitActor ? reinterpret_cast< void* >( &primaryPoint.hitActor.GetBaseObject() ) : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
+  DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor:       (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
 
   if ( ( primaryPointState == TouchPoint::Started ) &&
        ( hoverEvent.GetPointCount() == 1 ) &&
-       ( consumedActor && consumedActor.OnStage() ) )
+       ( consumedActor && GetImplementation( consumedActor ).OnScene() ) )
   {
     mHoverStartConsumedActor.SetActor( &GetImplementation( consumedActor ) );
   }
@@ -351,13 +345,13 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
   }
   else
   {
-    // The primaryHitActor may have been removed from the stage so ensure it is still on the stage before setting members.
-    if ( primaryHitActor && primaryHitActor.OnStage() )
+    // The primaryHitActor may have been removed from the scene so ensure it is still on the scene before setting members.
+    if ( primaryHitActor && GetImplementation( primaryHitActor ).OnScene() )
     {
       mLastPrimaryHitActor.SetActor( &GetImplementation( primaryHitActor ) );
 
-      // Only observe the consumed actor if we have a primaryHitActor (check if it is still on stage).
-      if ( consumedActor && consumedActor.OnStage() )
+      // Only observe the consumed actor if we have a primaryHitActor (check if it is still on the scene).
+      if ( consumedActor && GetImplementation( consumedActor ).OnScene() )
       {
         mLastConsumedActor.SetActor( &GetImplementation( consumedActor ) );
       }