From: joogab yun Date: Tue, 18 Jun 2024 07:47:36 +0000 (+0000) Subject: Merge "If USER_INTERACTION_ENABLED is false, actor should not receive events." into... X-Git-Tag: dali_2.3.29~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6704cfd096a9229fa1025d52a544d219cd53bd2d;hp=-c;p=platform%2Fcore%2Fuifw%2Fdali-core.git Merge "If USER_INTERACTION_ENABLED is false, actor should not receive events." into devel/master --- 6704cfd096a9229fa1025d52a544d219cd53bd2d diff --combined automated-tests/src/dali/utc-Dali-GeoTouchProcessing.cpp index 40f4afcb0,0e3d5254d..4ab68a728 --- a/automated-tests/src/dali/utc-Dali-GeoTouchProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-GeoTouchProcessing.cpp @@@ -510,13 -510,13 +510,13 @@@ int UtcDaliGeoTouchEventEmitEmpty(void try { // Emit an empty TouchEvent - Integration::TouchEvent event; - application.ProcessEvent(event); + Integration::TouchEvent touchEvent; + application.ProcessEvent(touchEvent); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_ASSERT(e, "!event.points.empty()", TEST_LOCATION); + DALI_TEST_ASSERT(e, "!touchEvent.points.empty()", TEST_LOCATION); } END_TEST; } @@@ -636,7 -636,7 +636,7 @@@ int UtcDaliGeoTouchEventParentConsumer( DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION); DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION); - DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_EQUALS(screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION); DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION); @@@ -722,7 -722,7 +722,7 @@@ int UtcDaliGeoTouchEventInterruptedPare application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); @@@ -742,7 -742,7 +742,7 @@@ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); rootData.Reset(); @@@ -840,7 -840,7 +840,7 @@@ int UtcDaliGeoTouchEventActorBecomesIns application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); @@@ -892,10 -892,9 +892,9 @@@ int UtcDaliGeoTouchEventActorBecomesUse // Change actor to disable user interaction. actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, false); - // Emit a motion signal, signalled with an interrupted + // Emit a motion signal, shouldn't receive a signal. application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f))); - DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } @@@ -1612,7 -1611,7 +1611,7 @@@ int UtcDaliGeoTouchEventActorRemovedFro // Emit a down signal application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); DALI_TEST_CHECK(actor == data.touchedActor); DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); @@@ -1708,12 -1707,12 +1707,12 @@@ int UtcDaliGeoTouchEventInterruptedDiff // Emit a down signal application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); DALI_TEST_CHECK(actor == data.touchedActor); DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION); - DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor); + DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(parent == parentData.receivedTouch.points[0].hitActor); DALI_TEST_CHECK(parent == parentData.touchedActor); DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); @@@ -1816,6 -1815,7 +1815,6 @@@ int UtcDaliGeoTouchEventInterruptedDiff END_TEST; } - int UtcDaliGeoTouchEventGetRadius(void) { TestApplication application; @@@ -2569,3 -2569,44 +2568,3 @@@ int UtcDaliGeoTouchEventDispatchTouchMo END_TEST; } - -int UtcDaliGeoTouchDownDifferentUp(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); - actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); - application.GetScene().Add(actor); - - // Render and notify - application.SendNotification(); - application.Render(); - - // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor(data); - actor.TouchedSignal().Connect(&application, functor); - - // Emit a down signal - application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); - DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); - data.Reset(); - - // Emit a signal outside the actor, we should NOT be signalled. - application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f /* Outside actor */))); - application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 200.0f /* Outside actor */))); - application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(220.0f, 200.0f /* Outside actor */))); - DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - data.Reset(); - - // Set the geometry hit test on - application.GetScene().SetGeometryHittestEnabled(true); - - // ...and emit an up event outside of the actor's bounds, we should get an interrupted signal - application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(200.0f, 200.0f))); - DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); - END_TEST; -} diff --combined dali/internal/event/events/touch-event-processor.cpp index 0ead0f9e6,a555a617b..21a41d8a0 --- a/dali/internal/event/events/touch-event-processor.cpp +++ b/dali/internal/event/events/touch-event-processor.cpp @@@ -83,13 -83,13 +83,13 @@@ const char* TOUCH_POINT_STATE[6] bool ShouldEmitInterceptTouchEvent(const Actor& actorImpl, const Dali::TouchEvent& event) { PointState::Type state = event.GetState(0); - return actorImpl.GetInterceptTouchRequired() && (state != PointState::MOTION || actorImpl.IsDispatchTouchMotion()); + return actorImpl.GetInterceptTouchRequired() && actorImpl.IsUserInteractionEnabled() && (state != PointState::MOTION || actorImpl.IsDispatchTouchMotion()); } bool ShouldEmitTouchEvent(const Actor& actorImpl, const Dali::TouchEvent& event) { PointState::Type state = event.GetState(0); - return actorImpl.GetTouchRequired() && (state != PointState::MOTION || actorImpl.IsDispatchTouchMotion()); + return actorImpl.GetTouchRequired() && actorImpl.IsUserInteractionEnabled() && (state != PointState::MOTION || actorImpl.IsDispatchTouchMotion()); } // child -> parent @@@ -486,10 -486,6 +486,10 @@@ struct TouchEventProcessor::Imp for(; rIter != processor.mCandidateActorLists.rend(); rIter++) { Actor* actorImpl(*rIter); + if(actorImpl == interceptedActor) + { + break; + } EmitTouchSignals(actorImpl, *processor.mLastRenderTask.Get(), localVars.touchEventImpl, PointState::INTERRUPTED, localVars.isGeometry); } } @@@ -506,32 -502,14 +506,32 @@@ // Let's propagate touch events from the intercepted actor or start propagating touch events from the leaf actor. localVars.consumedActor = EmitGeoTouchSignals(interceptedActor ? processor.mInterceptedActorLists : processor.mCandidateActorLists, localVars.touchEventHandle); - // If consumed, the actors who previously received the touch are interrupted, indicating that the touch has been consumed by another actor. - if(localVars.consumedActor && localVars.primaryPointState != PointState::DOWN) + if(localVars.consumedActor) { - std::list::reverse_iterator rIter = std::find(processor.mCandidateActorLists.rbegin(), processor.mCandidateActorLists.rend(), localVars.consumedActor); - for(++rIter; rIter != processor.mCandidateActorLists.rend(); ++rIter) + // If consumed, the actors who previously received the touch are interrupted, indicating that the touch has been consumed by another actor. + // backworkd + if(localVars.primaryPointState != PointState::DOWN) { - Actor* actorImpl(*rIter); - EmitTouchSignals(actorImpl, *processor.mLastRenderTask.Get(), localVars.touchEventImpl, PointState::INTERRUPTED, localVars.isGeometry); + std::list::reverse_iterator rIter = std::find(processor.mCandidateActorLists.rbegin(), processor.mCandidateActorLists.rend(), localVars.consumedActor); + if(rIter != processor.mCandidateActorLists.rend()) + { + for(++rIter; rIter != processor.mCandidateActorLists.rend(); ++rIter) + { + Actor* actorImpl(*rIter); + EmitTouchSignals(actorImpl, *processor.mLastRenderTask.Get(), localVars.touchEventImpl, PointState::INTERRUPTED, localVars.isGeometry); + } + } + } + + //forward + std::list::iterator iter = std::find(processor.mCandidateActorLists.begin(), processor.mCandidateActorLists.end(), localVars.consumedActor); + if(iter != processor.mCandidateActorLists.end()) + { + for(++iter; iter != processor.mCandidateActorLists.end(); ++iter) + { + Actor* actorImpl(*iter); + EmitTouchSignals(actorImpl, *localVars.currentRenderTask.Get(), localVars.touchEventImpl, PointState::INTERRUPTED, localVars.isGeometry); + } } } }