From cbc82430da3f10ddbc9d6eee7514b05389e8d183 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Wed, 19 Aug 2020 14:22:55 +0900 Subject: [PATCH] Revert "Removing Dali::TouchEvent" This reverts commit 56085602bdee7f591588f962117338b8c5b94092. --- .../dali-test-suite-utils/test-touch-utils.h | 81 ++++++++++++++++++++++ .../accessibility-action-handler.h | 10 +-- .../adaptor-framework/accessibility-adaptor.h | 2 +- dali/devel-api/adaptor-framework/window-devel.cpp | 1 + dali/integration-api/adaptor-framework/adaptor.h | 2 +- .../common/accessibility-adaptor-impl.cpp | 11 +-- .../common/accessibility-gesture-detector.cpp | 3 + .../common/accessibility-gesture-detector.h | 1 + 8 files changed, 99 insertions(+), 12 deletions(-) create mode 100644 automated-tests/src/dali-adaptor/dali-test-suite-utils/test-touch-utils.h diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-touch-utils.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-touch-utils.h new file mode 100644 index 0000000..3a623cb --- /dev/null +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-touch-utils.h @@ -0,0 +1,81 @@ +#ifndef TEST_TOUCH_UTILS_H +#define TEST_TOUCH_UTILS_H + +/* + * Copyright (c) 2019 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +namespace Dali +{ + +// Data for touch events +struct TouchEventData +{ + TouchEventData() + : functorCalled(false), + receivedTouch(), + touchActor() + { + } + + void Reset() + { + functorCalled = false; + + receivedTouch.points.clear(); + receivedTouch.time = 0; + + touchActor.Reset(); + } + + bool functorCalled; + TouchEvent receivedTouch; + Actor touchActor; +}; + +// Functor that sets the data when called +struct TouchEventDataFunctor +{ + TouchEventDataFunctor(TouchEventData& data) : touchEventData(data) { } + + bool operator()(Actor actor, const TouchEvent& touch) + { + touchEventData.functorCalled = true; + touchEventData.touchActor = actor; + touchEventData.receivedTouch = touch; + return false; + } + + // Generate a touch-event + Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition ) const + { + Integration::TouchEvent touchEvent; + Integration::Point point; + point.SetState( state ); + point.SetScreenPosition( screenPosition ); + touchEvent.points.push_back( point ); + return touchEvent; + } + + TouchEventData& touchEventData; +}; + + +} // namespace Dali + +#endif // TEST_TOUCH_UTILS_H diff --git a/dali/devel-api/adaptor-framework/accessibility-action-handler.h b/dali/devel-api/adaptor-framework/accessibility-action-handler.h index b4eb77f..a23620d 100644 --- a/dali/devel-api/adaptor-framework/accessibility-action-handler.h +++ b/dali/devel-api/adaptor-framework/accessibility-action-handler.h @@ -20,7 +20,7 @@ // EXTERNAL INCLUDES #include -#include +#include namespace Dali { @@ -47,10 +47,10 @@ public: /** * Perform the accessibility action associated with a scroll event. - * @param touchData The touch point (and time) of the event. + * @param touchEvent The touch point (and time) of the event. * @return whether the focus is cleared or not. */ - virtual bool AccessibilityActionScroll( Dali::TouchData& touchData ) = 0; + virtual bool AccessibilityActionScroll( Dali::TouchEvent& touchEvent ) = 0; /** * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up). @@ -200,10 +200,10 @@ public: /** * Perform the accessibility action to mouse move (by one finger tap & hold and move). - * @param touchData touch data + * @param touchEvent touch event structure * @return whether the accessibility action is performed or not. */ - virtual bool AccessibilityActionTouch(const Dali::TouchData& touchData) = 0; + virtual bool AccessibilityActionTouch(const Dali::TouchEvent& touchEvent) = 0; }; // class AccessibilityActionHandler diff --git a/dali/devel-api/adaptor-framework/accessibility-adaptor.h b/dali/devel-api/adaptor-framework/accessibility-adaptor.h index 14b856b..251f591 100755 --- a/dali/devel-api/adaptor-framework/accessibility-adaptor.h +++ b/dali/devel-api/adaptor-framework/accessibility-adaptor.h @@ -20,7 +20,7 @@ // EXTERNAL INCLUDES -#include +#include #include #include diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index c3c8c18..3cd89e2 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -17,6 +17,7 @@ // EXTERNAL INCLUDES #include +#include #include // INTERNAL INCLUDES diff --git a/dali/integration-api/adaptor-framework/adaptor.h b/dali/integration-api/adaptor-framework/adaptor.h index 94c5f81..4f708e4 100644 --- a/dali/integration-api/adaptor-framework/adaptor.h +++ b/dali/integration-api/adaptor-framework/adaptor.h @@ -23,8 +23,8 @@ #include #include #include +#include #include -#include #include // INTERNAL INCLUDES diff --git a/dali/internal/accessibility/common/accessibility-adaptor-impl.cpp b/dali/internal/accessibility/common/accessibility-adaptor-impl.cpp index 4276737..d3eb43b 100644 --- a/dali/internal/accessibility/common/accessibility-adaptor-impl.cpp +++ b/dali/internal/accessibility/common/accessibility-adaptor-impl.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include // INTERNAL INCLUDES @@ -250,8 +249,9 @@ bool AccessibilityAdaptor::HandleActionScrollEvent(const TouchPoint& point, uint // so always send the action to the action handler. if( mActionHandler ) { - Dali::TouchData touchData = Integration::NewTouchData( timeStamp, point ); - ret = mActionHandler->AccessibilityActionScroll( touchData ); + Dali::TouchEvent event(timeStamp); + event.points.push_back(point); + ret = mActionHandler->AccessibilityActionScroll( event ); } Integration::TouchEvent touchEvent; @@ -274,11 +274,12 @@ bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, uint3 { bool ret = false; - Dali::TouchData touchData = Integration::NewTouchData( timeStamp, point ); + Dali::TouchEvent touchEvent(timeStamp); + touchEvent.points.push_back(point); if( mActionHandler ) { - ret = mActionHandler->AccessibilityActionTouch( touchData ); + ret = mActionHandler->AccessibilityActionTouch(touchEvent); } return ret; } diff --git a/dali/internal/accessibility/common/accessibility-gesture-detector.cpp b/dali/internal/accessibility/common/accessibility-gesture-detector.cpp index 5a7fd8d..b872077 100644 --- a/dali/internal/accessibility/common/accessibility-gesture-detector.cpp +++ b/dali/internal/accessibility/common/accessibility-gesture-detector.cpp @@ -20,6 +20,9 @@ // EXTERNAL INCLUDES #include + +#include + #include diff --git a/dali/internal/accessibility/common/accessibility-gesture-detector.h b/dali/internal/accessibility/common/accessibility-gesture-detector.h index 520b3f6..616d76e 100644 --- a/dali/internal/accessibility/common/accessibility-gesture-detector.h +++ b/dali/internal/accessibility/common/accessibility-gesture-detector.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace Dali { -- 2.7.4