[Tizen] When a hover event enters a new actor, events are delivered in the order... 77/306277/1
authorjoogab.yun <joogab.yun@samsung.com>
Thu, 15 Feb 2024 09:42:39 +0000 (18:42 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Mon, 19 Feb 2024 10:29:52 +0000 (19:29 +0900)
Change-Id: I0ede94dcc5f558d8f9b7eb82d98e505f8ad524e6

automated-tests/src/dali/utc-Dali-HoverProcessing.cpp
dali/internal/event/events/hover-event-processor.cpp

index e912937..df7e04f 100644 (file)
@@ -634,9 +634,10 @@ int UtcDaliHoverLeaveParentConsumer(void)
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(PointState::LEAVE, data.hoverEvent.GetState(0), TEST_LOCATION);
-  DALI_TEST_EQUALS(PointState::LEAVE, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+  // rootActor receives "started" state because a new hover event entered in rootActor area.
+  DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
   DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
-  DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
+  DALI_TEST_CHECK(rootActor == rootData.hoverEvent.GetHitActor(0));
   data.Reset();
   rootData.Reset();
 
index e5cd845..afe0fa1 100644 (file)
@@ -402,15 +402,25 @@ struct HoverEventProcessor::Impl
       else
       {
         // If the actor is hit first, the hover is started.
-        if(hitActor && processor.mLastPrimaryHitActor.GetActor() != hitActor && localVars.primaryPointState == PointState::MOTION)
+        if(hitActor && processor.mLastPrimaryHitActor.GetActor() != hitActor &&
+           localVars.primaryPointState == PointState::MOTION && GetImplementation(hitActor).GetLeaveRequired())
         {
-          Actor* hitActorImpl = &GetImplementation(hitActor);
-          if(hitActorImpl->GetLeaveRequired())
-          {
+            // A leave event is sent to the previous actor first.
+            localVars.lastPrimaryHitActor = processor.mLastPrimaryHitActor.GetActor();
+            localVars.lastConsumedActor   = processor.mLastConsumedActor.GetActor();
+            Impl::DeliverLeaveEvent(processor, localVars);
+
             localVars.hoverEvent->GetPoint(0).SetState(PointState::STARTED);
-          }
+            localVars.primaryPointState = PointState::STARTED;
+
+            // It sends a started event and updates information.
+            localVars.consumedActor = EmitHoverSignals(hitActor, localVars.hoverEventHandle);
+            UpdateMembersWithCurrentHitInformation(processor, localVars);
+        }
+        else
+        {
+          localVars.consumedActor = EmitHoverSignals(hitActor, localVars.hoverEventHandle);
         }
-        localVars.consumedActor = EmitHoverSignals(hitActor, localVars.hoverEventHandle);
       }
 
       if(localVars.hoverEvent->GetPoint(0).GetState() != PointState::MOTION)