From: Seoyeon Kim Date: Wed, 16 Sep 2020 02:29:15 +0000 (+0900) Subject: Revert "[Tizen] Revert "Use touch consumed return to set whether we process a gesture... X-Git-Tag: accepted/tizen/unified/20200917.030635~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7de801c2140208bff9f41afe4f55779ce10bb054;p=platform%2Fcore%2Fuifw%2Fdali-core.git Revert "[Tizen] Revert "Use touch consumed return to set whether we process a gesture or not"" This reverts commit 96153ae2f46221804347b661359494b8064d8efc. --- diff --git a/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp index ad58a08..0a1b6a9 100644 --- a/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp @@ -988,3 +988,95 @@ int UtcDaliLongPressGestureSetMinimumHoldingTime(void) END_TEST; } + +int UtcDaliLongPressGestureInterruptedWhenTouchConsumed(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); + + bool consume = false; + TouchEventFunctorConsumeSetter touchFunctor(consume); + actor.TouchedSignal().Connect(&application,touchFunctor); + + // Render and notify + application.SendNotification(); + application.Render(); + + SignalData data; + GestureReceivedFunctor functor(data); + + LongPressGestureDetector detector = LongPressGestureDetector::New(); + detector.Attach(actor); + detector.DetectedSignal().Connect(&application, functor); + + // Start gesture within the actor's area, we should receive the gesture as the touch is NOT being consumed + TestGenerateLongPress( application, 50.0f, 50.0f ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + data.Reset(); + TestEndLongPress(application, 50.0f,50.0f); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + data.Reset(); + + // Another gesture in the same location, this time we will not receive it as touch is being consumed + consume = true; + TestGenerateLongPress( application, 50.0f, 50.0f ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + data.Reset(); + TestEndLongPress(application, 50.0f,50.0f); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliLongPressGestureDisableDetectionDuringLongPressN(void) +{ + // Crash occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached + + 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); + + // Add a detector + LongPressGestureDetector detector = LongPressGestureDetector::New(); + bool functorCalled = false; + detector.Attach( actor ); + detector.DetectedSignal().Connect( + &application, + [&detector, &functorCalled](Actor actor, const LongPressGesture& gesture) + { + if( gesture.GetState() == GestureState::FINISHED ) + { + detector.Detach(actor); + functorCalled = true; + } + }); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Try the gesture, should not crash + try + { + TestGenerateLongPress( application, 50.0f, 10.0f ); + TestEndLongPress( application, 50.0f, 10.0f ); + + DALI_TEST_CHECK( true ); // No crash, test has passed + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); + } + catch(...) + { + DALI_TEST_CHECK( false ); // If we crash, the test has failed + } + + END_TEST; +} + + diff --git a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp index d580fc2..48790fe 100644 --- a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp @@ -2830,3 +2830,95 @@ int UtcDaliPanGestureNoTimeDiff(void) END_TEST; } + +int UtcDaliPanGestureInterruptedWhenTouchConsumed(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); + + bool consume = false; + TouchEventFunctorConsumeSetter touchFunctor(consume); + actor.TouchedSignal().Connect(&application,touchFunctor); + + // Render and notify + application.SendNotification(); + application.Render(); + + SignalData data; + GestureReceivedFunctor functor(data); + + PanGestureDetector detector = PanGestureDetector::New(); + detector.Attach(actor); + detector.DetectedSignal().Connect(&application, functor); + + // Start gesture within the actor's area, we should receive the pan as the touch is NOT being consumed + uint32_t time = 100; + TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); + data.Reset(); + + // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture + consume = true; + + TestMovePan( application, Vector2(26.0f, 4.0f), time ); + time += TestGetFrameInterval(); + + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION); + + END_TEST; +} + +int UtcDaliPanGestureDisableDetectionDuringPanN(void) +{ + // Crash occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached + + 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); + + // Add a pan detector + PanGestureDetector detector = PanGestureDetector::New(); + bool functorCalled = false; + detector.Attach( actor ); + detector.DetectedSignal().Connect( + &application, + [&detector, &functorCalled](Actor actor, const PanGesture& pan) + { + if( pan.GetState() == GestureState::FINISHED ) + { + detector.Detach(actor); + functorCalled = true; + } + }); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Try the gesture, should not crash + try + { + uint32_t time = 100; + TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestEndPan( application, Vector2(26.0f, 20.0f) ); + + DALI_TEST_CHECK( true ); // No crash, test has passed + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); + } + catch(...) + { + DALI_TEST_CHECK( false ); // If we crash, the test has failed + } + + END_TEST; +} diff --git a/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp index 8653653..0693f23 100644 --- a/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp @@ -1109,3 +1109,105 @@ int UtcDaliPinchGestureLayerConsumesTouch(void) END_TEST; } + +int UtcDaliPinchGestureInterruptedWhenTouchConsumed(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); + + bool consume = false; + TouchEventFunctorConsumeSetter touchFunctor(consume); + actor.TouchedSignal().Connect(&application,touchFunctor); + + // Render and notify + application.SendNotification(); + application.Render(); + + SignalData data; + GestureReceivedFunctor functor(data); + + PinchGestureDetector detector = PinchGestureDetector::New(); + detector.Attach(actor); + detector.DetectedSignal().Connect(&application, functor); + + // Start gesture within the actor's area, we should receive the pinch as the touch is NOT being consumed + TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), + Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); + data.Reset(); + + // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture + consume = true; + + TestContinuePinch( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), + Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); + + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION); + data.Reset(); + + // Start another pinch, we should not even get the callback this time + TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), + Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + + END_TEST; +} + + +int UtcDaliPinchGestureDisableDetectionDuringPinchN(void) +{ + // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached + + 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); + + // Add a detector + PinchGestureDetector detector = PinchGestureDetector::New(); + bool functorCalled = false; + detector.Attach( actor ); + detector.DetectedSignal().Connect( + &application, + [&detector, &functorCalled](Actor actor, const PinchGesture& gesture) + { + if( gesture.GetState() == GestureState::FINISHED ) + { + detector.Detach(actor); + functorCalled = true; + } + }); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Try the gesture, should not crash + try + { + TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), + Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestContinuePinch( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), + Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); + TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), + Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + + DALI_TEST_CHECK( true ); // No crash, test has passed + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); + } + catch(...) + { + DALI_TEST_CHECK( false ); // If we crash, the test has failed + } + + END_TEST; +} diff --git a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp index 70fc680..4298366 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp @@ -1099,3 +1099,102 @@ int UtcDaliRotationGestureLayerConsumesTouch(void) END_TEST; } +int UtcDaliRotationGestureInterruptedWhenTouchConsumed(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); + + bool consume = false; + TouchEventFunctorConsumeSetter touchFunctor(consume); + actor.TouchedSignal().Connect(&application,touchFunctor); + + // Render and notify + application.SendNotification(); + application.Render(); + + SignalData data; + GestureReceivedFunctor functor(data); + + RotationGestureDetector detector = RotationGestureDetector::New(); + detector.Attach(actor); + detector.DetectedSignal().Connect(&application, functor); + + // Start gesture within the actor's area, we should receive the rotation as the touch is NOT being consumed + TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), + Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); + data.Reset(); + + // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture + consume = true; + + TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), + Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION); + data.Reset(); + + // Start another rotation, we should not even get the callback this time + TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), + Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliRotationGestureDisableDetectionDuringRotationN(void) +{ + // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached + + 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); + + // Add a detector + RotationGestureDetector detector = RotationGestureDetector::New(); + bool functorCalled = false; + detector.Attach( actor ); + detector.DetectedSignal().Connect( + &application, + [&detector, &functorCalled](Actor actor, const RotationGesture& gesture) + { + if( gesture.GetState() == GestureState::FINISHED ) + { + detector.Detach(actor); + functorCalled = true; + } + }); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Try the gesture, should not crash + try + { + TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), + Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestContinueRotation( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), + Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); + TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), + Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + + DALI_TEST_CHECK( true ); // No crash, test has passed + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); + } + catch(...) + { + DALI_TEST_CHECK( false ); // If we crash, the test has failed + } + + END_TEST; +} diff --git a/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp index 6469236..30a1441 100644 --- a/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp @@ -907,3 +907,85 @@ int UtcDaliTapGestureLayerConsumesTouch(void) END_TEST; } + +int UtcDaliTapGestureInterruptedWhenTouchConsumed(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); + + bool consume = false; + TouchEventFunctorConsumeSetter touchFunctor(consume); + actor.TouchedSignal().Connect(&application,touchFunctor); + + // Render and notify + application.SendNotification(); + application.Render(); + + SignalData data; + GestureReceivedFunctor functor(data); + + TapGestureDetector detector = TapGestureDetector::New(); + detector.Attach(actor); + detector.DetectedSignal().Connect(&application, functor); + + // Start gesture within the actor's area, we should receive the gesture as the touch is NOT being consumed + TestGenerateTap( application, 50.0f, 50.0f ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + data.Reset(); + + // Another gesture in the same location, this time we will not receive it as touch is being consumed + consume = true; + TestGenerateTap( application, 50.0f, 50.0f ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + data.Reset(); + + END_TEST; +} + +int UtcDaliTapGestureDisableDetectionDuringTapN(void) +{ + // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached + + 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); + + // Add a detector + TapGestureDetector detector = TapGestureDetector::New(); + bool functorCalled = false; + detector.Attach( actor ); + detector.DetectedSignal().Connect( + &application, + [&detector, &functorCalled](Actor actor, const TapGesture& gesture) + { + detector.Detach(actor); + functorCalled = true; + }); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Try the gesture, should not crash + try + { + TestGenerateTap( application, 50.0f, 10.0f ); + + DALI_TEST_CHECK( true ); // No crash, test has passed + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); + } + catch(...) + { + DALI_TEST_CHECK( false ); // If we crash, the test has failed + } + + END_TEST; +} + diff --git a/dali/internal/event/events/event-processor.cpp b/dali/internal/event/events/event-processor.cpp index 06250ba..fed209a 100644 --- a/dali/internal/event/events/event-processor.cpp +++ b/dali/internal/event/events/event-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 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. @@ -152,8 +152,18 @@ void EventProcessor::ProcessEvents() { case Event::Touch: { - mTouchEventProcessor.ProcessTouchEvent( static_cast(*event) ); - mGestureEventProcessor.ProcessTouchEvent(mScene, static_cast(*event)); + Integration::TouchEvent& touchEvent = static_cast(*event); + const bool consumed = mTouchEventProcessor.ProcessTouchEvent( touchEvent ); + + // If touch is consumed, then gestures should be cancelled + // Do this by sending an interrupted event to the GestureEventProcessor + if( consumed ) + { + Integration::Point& point = touchEvent.GetPoint(0); + point.SetState( PointState::INTERRUPTED ); + } + + mGestureEventProcessor.ProcessTouchEvent(mScene, touchEvent); break; } diff --git a/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp b/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp index 5381c2b..134dee4 100644 --- a/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp +++ b/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 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. @@ -118,7 +118,7 @@ void PinchGestureRecognizer::SendEvent(const Integration::TouchEvent& event) const Integration::Point& currentPoint1 = event.points[0]; const Integration::Point& currentPoint2 = event.points[1]; - if (currentPoint1.GetState() == PointState::UP || currentPoint2.GetState() == PointState::UP) + if (currentPoint1.GetState() == PointState::UP || currentPoint2.GetState() == PointState::UP || currentPoint1.GetState() == PointState::INTERRUPTED) { // One of our touch points has an Up event so change our state back to CLEAR. mState = CLEAR; diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp b/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp index 49d84b3..6f85907 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 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. @@ -96,7 +96,7 @@ void RotationGestureRecognizer::SendEvent( const Integration::TouchEvent& event const Integration::Point& currentPoint1 = event.points[0]; const Integration::Point& currentPoint2 = event.points[1]; - if( currentPoint1.GetState() == PointState::UP || currentPoint2.GetState() == PointState::UP ) + if( currentPoint1.GetState() == PointState::UP || currentPoint2.GetState() == PointState::UP || currentPoint1.GetState() == PointState::INTERRUPTED ) { // One of our touch points has an Up event so change our state back to CLEAR. mState = CLEAR; diff --git a/dali/internal/event/events/touch-event-processor.cpp b/dali/internal/event/events/touch-event-processor.cpp index d09f59b..e1c8730 100644 --- a/dali/internal/event/events/touch-event-processor.cpp +++ b/dali/internal/event/events/touch-event-processor.cpp @@ -202,7 +202,7 @@ TouchEventProcessor::~TouchEventProcessor() DALI_LOG_TRACE_METHOD( gLogFilter ); } -void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& event ) +bool TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& event ) { DALI_LOG_TRACE_METHOD( gLogFilter ); DALI_ASSERT_ALWAYS( !event.points.empty() && "Empty TouchEvent sent from Integration\n" ); @@ -264,7 +264,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even touchEventImpl->AddPoint( currentPoint ); mScene.EmitTouchedSignal( touchEventHandle ); - return; // No need for hit testing + return false; // No need for hit testing & already an interrupted event so just return false } // 2) Hit Testing. @@ -309,11 +309,14 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even // 3) Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached. + bool consumed = false; + // Emit the touch signal Dali::Actor consumedActor; if ( currentRenderTask ) { consumedActor = EmitTouchSignals( touchEventImpl->GetPoint( 0 ).GetHitActor(), touchEventHandle ); + consumed = consumedActor ? true : false; } Integration::Point& primaryPoint = touchEventImpl->GetPoint( 0 ); @@ -363,6 +366,8 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even } } + consumed |= leaveEventConsumer ? true : false; + // Check if the motion event has been consumed by another actor's listener. In this case, the previously // consumed actor's listeners may need to be informed (through a leave event). // Further checks here to ensure we do not signal the same actor twice for the same event. @@ -474,6 +479,8 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even } } } + + return consumed; } void TouchEventProcessor::OnObservedActorDisconnected( Actor* actor ) diff --git a/dali/internal/event/events/touch-event-processor.h b/dali/internal/event/events/touch-event-processor.h index 9306e6f..c2e4bc7 100644 --- a/dali/internal/event/events/touch-event-processor.h +++ b/dali/internal/event/events/touch-event-processor.h @@ -67,8 +67,9 @@ public: /** * This function is called by the event processor whenever a touch event occurs. * @param[in] event The touch event that has occurred. + * @return true if consumed */ - void ProcessTouchEvent( const Integration::TouchEvent& event ); + bool ProcessTouchEvent( const Integration::TouchEvent& event ); private: diff --git a/dali/public-api/actors/actor.h b/dali/public-api/actors/actor.h index bab6a73..7970256 100644 --- a/dali/public-api/actors/actor.h +++ b/dali/public-api/actors/actor.h @@ -215,10 +215,6 @@ typedef Rect Padding; ///< Padding definition @SINCE_1_0.0 * - If the consumed actor on hover-start is not the same as the consumed actor on hover-finished, then * hover signals are also emitted from the hover-started actor with an "Interrupted" state. * - *

Key Events:

- * - * Key events are received by an actor once set to grab key events, only one actor can be set as focused. - * * @nosubgrouping * * Signals @@ -1173,7 +1169,8 @@ public: // Signals * @endcode * The return value of True, indicates that the touch event has been consumed. * Otherwise the signal will be emitted on the next sensitive parent of the actor. - * @SINCE_1_1.37 + * A true return will also cancel any ongoing gestures. + * @SINCE_1_9.28 * @return The signal to connect to * @pre The Actor has been initialized. */