Add input source type and source data about Gesture. 68/283368/19
authorjoogab.yun <joogab.yun@samsung.com>
Tue, 25 Oct 2022 08:21:50 +0000 (17:21 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Mon, 31 Oct 2022 05:52:07 +0000 (14:52 +0900)
This is similar to MouseButton in TouchEvent.

Now, you can see from which input the gesture was made.

Change-Id: Id1289e1482b21e756ebd5a549b7d8e9d1b1e19b7

26 files changed:
automated-tests/src/dali-internal/utc-Dali-Internal-TapGesture.cpp
automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp
dali/internal/event/events/gesture-event.cpp
dali/internal/event/events/gesture-event.h
dali/internal/event/events/gesture-impl.h
dali/internal/event/events/gesture-recognizer.h
dali/internal/event/events/long-press-gesture/long-press-gesture-processor.cpp
dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.cpp
dali/internal/event/events/pan-gesture/pan-gesture-processor.cpp
dali/internal/event/events/pan-gesture/pan-gesture-recognizer.cpp
dali/internal/event/events/pinch-gesture/pinch-gesture-processor.cpp
dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp
dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp
dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp
dali/internal/event/events/tap-gesture/tap-gesture-detector-impl.cpp
dali/internal/event/events/tap-gesture/tap-gesture-event.cpp
dali/internal/event/events/tap-gesture/tap-gesture-event.h
dali/internal/event/events/tap-gesture/tap-gesture-impl.h
dali/internal/event/events/tap-gesture/tap-gesture-processor.cpp
dali/internal/event/events/tap-gesture/tap-gesture-recognizer.cpp
dali/internal/event/events/tap-gesture/tap-gesture-recognizer.h
dali/public-api/events/gesture-enumerations.h
dali/public-api/events/gesture.cpp
dali/public-api/events/gesture.h
dali/public-api/events/tap-gesture.cpp
dali/public-api/events/tap-gesture.h

index 483fe64..87becc2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -136,20 +136,3 @@ int UtcDaliTapGestureSetGetLocalPointP(void)
 
   END_TEST;
 }
-
-int UtcDaliTapGestureSetGetSourceTypeP(void)
-{
-  TapGesture gesture = DevelTapGesture::New(GestureState::STARTED);
-  DALI_TEST_EQUALS(gesture.GetSourceType(), GestureSourceType::INVALID, TEST_LOCATION);
-
-  GetImplementation(gesture).SetGestureSourceType(GestureSourceType::PRIMARY);
-  DALI_TEST_EQUALS(gesture.GetSourceType(), GestureSourceType::PRIMARY, TEST_LOCATION);
-
-  GetImplementation(gesture).SetGestureSourceType(GestureSourceType::SECONDARY);
-  DALI_TEST_EQUALS(gesture.GetSourceType(), GestureSourceType::SECONDARY, TEST_LOCATION);
-
-  GetImplementation(gesture).SetGestureSourceType(GestureSourceType::TERTIARY);
-  DALI_TEST_EQUALS(gesture.GetSourceType(), GestureSourceType::TERTIARY, TEST_LOCATION);
-
-  END_TEST;
-}
\ No newline at end of file
index 851040b..50c1d8f 100644 (file)
@@ -1050,22 +1050,13 @@ int UtcDaliTapGestureGetSourceType(void)
   detector.DetectedSignal().Connect(&application, functor);
 
   // Emit a down signal with MouseButton
-  application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 100));
-  application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 120));
-  application.SendNotification();
-
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::INVALID, TEST_LOCATION);
-
-  data.Reset();
-
-  // Emit a down signal with MouseButton
-  application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 1, 700));
-  application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 1, 720));
+  application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 1, 100));
+  application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 1, 120));
   application.SendNotification();
 
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::PRIMARY, TEST_LOCATION);
+  DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
+  DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_PRIMARY, TEST_LOCATION);
 
   data.Reset();
 
@@ -1075,7 +1066,8 @@ int UtcDaliTapGestureGetSourceType(void)
   application.SendNotification();
 
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::SECONDARY, TEST_LOCATION);
+  DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
+  DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_SECONDARY, TEST_LOCATION);
 
   data.Reset();
 
@@ -1085,7 +1077,8 @@ int UtcDaliTapGestureGetSourceType(void)
   application.SendNotification();
 
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::TERTIARY, TEST_LOCATION);
+  DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
+  DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_TERTIARY, TEST_LOCATION);
 
   END_TEST;
 }
index 07a11bb..ee05c5a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -27,7 +27,9 @@ GestureEvent::~GestureEvent() = default;
 GestureEvent::GestureEvent(GestureType::Value gesture, GestureState gestureState)
 : gestureType(gesture),
   state(gestureState),
-  time(0)
+  time(0),
+  sourceType(GestureSourceType::INVALID),
+  sourceData(GestureSourceData::INVALID)
 {
 }
 } // namespace Internal
index 85afd83..d803dcf 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_EVENT_GESTURE_EVENT_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -56,6 +56,16 @@ struct GestureEvent
    */
   uint32_t time;
 
+  /**
+   * This is the value of which source the gesture was started with. (ex : mouse)
+   */
+  GestureSourceType sourceType;
+
+  /**
+   * The data of the source type.
+   */
+  GestureSourceData sourceData;
+
 protected: // Constructors only to be used by derived structures.
   /**
    * This constructor is only used by derived classes.
index c4688fb..5ba1058 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_GESTURE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -85,6 +85,42 @@ public:
     return mTime;
   }
 
+  /**
+   * @brief Sets the value of which source the gesture was started with. (ex : mouse)
+   * @param[in] source The gesture source type.
+   */
+  inline void SetSourceType(GestureSourceType source)
+  {
+    mSourceType = source;
+  }
+
+  /**
+   * @brief Gets the value of which source the gesture was started with.
+   * @return The gesture source type.
+   */
+  inline GestureSourceType GetSourceType() const
+  {
+    return mSourceType;
+  }
+
+  /**
+   * @brief Sets the value of source data.
+   * @param[in] data The gesture source data.
+   */
+  inline void SetSourceData(GestureSourceData data)
+  {
+    mSourceData = data;
+  }
+
+  /**
+   * @brief Gets the data of source type.
+   * @return The gesture source data.
+   */
+  inline GestureSourceData GetSourceData() const
+  {
+    return mSourceData;
+  }
+
   Gesture(const Gesture&) = delete;            ///< Deleted copy constructor
   Gesture(Gesture&&)      = delete;            ///< Deleted move constructor
   Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
@@ -98,7 +134,9 @@ protected:
    */
   Gesture(GestureType::Value gestureType, GestureState gestureState)
   : mGestureType(gestureType),
-    mState(gestureState)
+    mState(gestureState),
+    mSourceType(GestureSourceType::INVALID),
+    mSourceData(GestureSourceData::INVALID)
   {
   }
 
@@ -113,6 +151,8 @@ private:
   GestureType::Value mGestureType;
   GestureState       mState;
   uint32_t           mTime{0u};
+  GestureSourceType  mSourceType;
+  GestureSourceData  mSourceData;
 };
 
 } // namespace Internal
index bd802b2..7aafb36 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_GESTURE_RECOGNIZER_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -19,6 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/internal/event/events/gesture-event.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/events/gesture.h>
@@ -86,6 +87,38 @@ public:
   void SendEvent(Scene& scene, const Integration::TouchEvent& event)
   {
     mScene = &scene;
+    if(event.GetPointCount() > 0)
+    {
+      const Integration::Point& point       = event.points[0];
+      MouseButton::Type         mouseButton = point.GetMouseButton();
+      if(mouseButton != MouseButton::INVALID)
+      {
+        mSourceType = GestureSourceType::MOUSE;
+        switch(mouseButton)
+        {
+          case MouseButton::PRIMARY:
+          {
+            mSourceData = GestureSourceData::MOUSE_PRIMARY;
+            break;
+          }
+          case MouseButton::SECONDARY:
+          {
+            mSourceData = GestureSourceData::MOUSE_SECONDARY;
+            break;
+          }
+          case MouseButton::TERTIARY:
+          {
+            mSourceData = GestureSourceData::MOUSE_TERTIARY;
+            break;
+          }
+          default:
+          {
+            mSourceData = GestureSourceData::INVALID;
+            break;
+          }
+        }
+      }
+    }
     SendEvent(event);
   }
 
@@ -98,7 +131,9 @@ protected:
   GestureRecognizer(Vector2 screenSize, GestureType::Value detectorType)
   : mScreenSize(screenSize),
     mType(detectorType),
-    mScene(nullptr)
+    mScene(nullptr),
+    mSourceType(GestureSourceType::INVALID),
+    mSourceData(GestureSourceData::INVALID)
   {
   }
 
@@ -122,6 +157,8 @@ protected:
   Vector2            mScreenSize;
   GestureType::Value mType;
   Scene*             mScene;
+  GestureSourceType  mSourceType; /// < Gesture input source type.
+  GestureSourceData  mSourceData; /// < Gesture input source data.
 };
 
 using GestureRecognizerPtr = IntrusivePtr<GestureRecognizer>;
index 4e73eb1..7c57cd0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -59,6 +59,8 @@ void EmitLongPressSignal(
   longPress->SetNumberOfTouches(longPressEvent.numberOfTouches);
   longPress->SetScreenPoint(longPressEvent.point);
   longPress->SetLocalPoint(localPoint);
+  longPress->SetSourceType(longPressEvent.sourceType);
+  longPress->SetSourceData(longPressEvent.sourceData);
 
   Dali::Actor                                    actorHandle(actor);
   const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
index adc77de..eac654b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -239,6 +239,8 @@ void LongPressGestureRecognizer::EmitGesture(GestureState state)
     {
       longPress.time += mMinimumHoldingTime;
     }
+    longPress.sourceType = mSourceType;
+    longPress.sourceData = mSourceData;
 
     if(mScene)
     {
index 5e6c9bb..c548833 100644 (file)
@@ -514,6 +514,8 @@ void PanGestureProcessor::EmitPanSignal(Actor*                          actor,
     pan->SetNumberOfTouches(panEvent.numberOfTouches);
     pan->SetScreenPosition(panEvent.currentPosition);
     pan->SetPosition(localCurrent);
+    pan->SetSourceType(panEvent.sourceType);
+    pan->SetSourceData(panEvent.sourceData);
 
     RenderTask& renderTaskImpl(*renderTask.Get());
 
index 39e43ce..4e6ad9e 100644 (file)
@@ -332,7 +332,9 @@ void PanGestureRecognizer::SendPan(GestureState state, const Integration::TouchE
     gesture.timeDelta        = 0;
   }
 
-  gesture.time = currentEvent.time;
+  gesture.time       = currentEvent.time;
+  gesture.sourceType = mSourceType;
+  gesture.sourceData = mSourceData;
 
   if(mScene)
   {
index 5c80484..2483fc6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -63,6 +63,8 @@ void EmitPinchSignal(
   pinch->SetScreenCenterPoint(pinchEvent.centerPoint);
 
   pinch->SetLocalCenterPoint(localCenter);
+  pinch->SetSourceType(pinchEvent.sourceType);
+  pinch->SetSourceData(pinchEvent.sourceData);
 
   Dali::Actor                                    actorHandle(actor);
   const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
index 5f036a8..9ab75a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -259,7 +259,9 @@ void PinchGestureRecognizer::SendPinch(GestureState state, const Integration::To
     gesture.state = GestureState::CANCELLED;
   }
 
-  gesture.time = currentEvent.time;
+  gesture.time       = currentEvent.time;
+  gesture.sourceType = mSourceType;
+  gesture.sourceData = mSourceData;
 
   if(mScene)
   {
index cde8108..6596f0d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -60,6 +60,8 @@ void EmitRotationSignal(
   rotation->SetRotation(rotationEvent.rotation);
   rotation->SetScreenCenterPoint(rotationEvent.centerPoint);
   rotation->SetLocalCenterPoint(localCenter);
+  rotation->SetSourceType(rotationEvent.sourceType);
+  rotation->SetSourceData(rotationEvent.sourceData);
 
   Dali::Actor                                    actorHandle(actor);
   const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
index e8e8428..dc10844 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -221,7 +221,9 @@ void RotationGestureRecognizer::SendRotation(GestureState state, const Integrati
     gesture.state = GestureState::CANCELLED;
   }
 
-  gesture.time = currentEvent.time;
+  gesture.time       = currentEvent.time;
+  gesture.sourceType = mSourceType;
+  gesture.sourceData = mSourceData;
 
   if(mScene)
   {
index 210ba57..2f87991 100644 (file)
@@ -176,7 +176,8 @@ void TapGestureDetector::EmitTapGestureSignal(Dali::Actor tappedActor, const Dal
   internalTap->SetNumberOfTouches(tap.GetNumberOfTouches());
   internalTap->SetScreenPoint(tap.GetScreenPoint());
   internalTap->SetLocalPoint(tap.GetLocalPoint());
-  internalTap->SetGestureSourceType(tap.GetSourceType());
+  internalTap->SetSourceType(tap.GetSourceType());
+  internalTap->SetSourceData(tap.GetSourceData());
   internalTap->SetNumberOfTaps(numberOfTaps == 0u ? mMaximumTapsRequired : numberOfTaps);
   mTap = Dali::TapGesture(internalTap.Get());
   if(numberOfTaps == 0u || mReceiveAllTapEvents)
index 89b0620..837fb3e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -25,8 +25,7 @@ namespace Internal
 TapGestureEvent::TapGestureEvent(GestureState state)
 : GestureEvent(GestureType::TAP, state),
   numberOfTaps(1),
-  numberOfTouches(1),
-  gestureSourceType(GestureSourceType::INVALID)
+  numberOfTouches(1)
 {
 }
 
index 85f0b0f..744593a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_EVENT_TAP_GESTURE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -72,11 +72,6 @@ struct TapGestureEvent : public GestureEvent
    * If a multi-touch tap, then this should be the centroid of all the touch points.
    */
   Vector2 point;
-
-  /**
-   * This is the value of which input was tapped.
-   */
-  GestureSourceType gestureSourceType;
 };
 
 } // namespace Internal
index 58c62f4..d40e491 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_TAP_GESTURE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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,23 +118,6 @@ public:
     return mLocalPoint;
   }
 
-  /**
-   * @brief This is the value of which input was tapped.
-   * @param[in] source This is the value of which input was tapped to set.
-   */
-  inline void SetGestureSourceType(const GestureSourceType sourceType)
-  {
-    mGestureSourceType = sourceType;
-  }
-
-  /**
-   * @copydoc Dali::TapGesture::GetSourceType()
-   */
-  inline const GestureSourceType& GetSourceType() const
-  {
-    return mGestureSourceType;
-  }
-
 private:
   /**
    * @brief Virtual destructor
@@ -144,11 +127,10 @@ private:
   ~TapGesture() override = default;
 
 private:
-  Vector2           mScreenPoint;
-  Vector2           mLocalPoint;
-  uint32_t          mNumberOfTaps{1u};
-  uint32_t          mNumberOfTouches{1u};
-  GestureSourceType mGestureSourceType{GestureSourceType::INVALID};
+  Vector2  mScreenPoint;
+  Vector2  mLocalPoint;
+  uint32_t mNumberOfTaps{1u};
+  uint32_t mNumberOfTouches{1u};
 };
 
 } // namespace Internal
index 6bde317..0ac00f0 100644 (file)
@@ -62,7 +62,8 @@ void EmitTapSignal(
   tap->SetNumberOfTouches(tapEvent.numberOfTouches);
   tap->SetScreenPoint(tapEvent.point);
   tap->SetLocalPoint(localPoint);
-  tap->SetGestureSourceType(tapEvent.gestureSourceType);
+  tap->SetSourceType(tapEvent.sourceType);
+  tap->SetSourceData(tapEvent.sourceData);
 
   Dali::Actor                                    actorHandle(actor);
   const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
index 05bbf94..33ce529 100644 (file)
@@ -50,7 +50,6 @@ TapGestureRecognizer::TapGestureRecognizer(Observer& observer, Vector2 screenSiz
   mTouchTime(0u),
   mLastTapTime(0u),
   mLastTouchTime(0u),
-  mGestureSourceType(GestureSourceType::INVALID),
   mMaximumAllowedTime(maximumAllowedTime)
 {
 }
@@ -66,36 +65,6 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
     const Integration::Point& point      = event.points[0];
     PointState::Type          pointState = point.GetState();
 
-    MouseButton::Type mouseButton = point.GetMouseButton();
-    switch(mouseButton)
-    {
-      case MouseButton::INVALID:
-      {
-        mGestureSourceType = GestureSourceType::INVALID;
-        break;
-      }
-      case MouseButton::PRIMARY:
-      {
-        mGestureSourceType = GestureSourceType::PRIMARY;
-        break;
-      }
-      case MouseButton::SECONDARY:
-      {
-        mGestureSourceType = GestureSourceType::SECONDARY;
-        break;
-      }
-      case MouseButton::TERTIARY:
-      {
-        mGestureSourceType = GestureSourceType::TERTIARY;
-        break;
-      }
-      default:
-      {
-        mGestureSourceType = GestureSourceType::INVALID;
-        break;
-      }
-    }
-
     switch(mState)
     {
       case CLEAR:
@@ -206,9 +175,8 @@ void TapGestureRecognizer::SetupForTouchDown(const Integration::TouchEvent& even
 void TapGestureRecognizer::EmitPossibleState(const Integration::TouchEvent& event)
 {
   TapGestureEvent tapEvent(GestureState::POSSIBLE);
-  tapEvent.point             = mTouchPosition;
-  tapEvent.time              = event.time;
-  tapEvent.gestureSourceType = mGestureSourceType;
+  tapEvent.point = mTouchPosition;
+  tapEvent.time  = event.time;
 
   ProcessEvent(tapEvent);
 }
@@ -255,16 +223,17 @@ void TapGestureRecognizer::EmitSingleTap(uint32_t time, const Integration::Point
 
 void TapGestureRecognizer::EmitTap(uint32_t time, TapGestureEvent& event)
 {
-  event.numberOfTaps      = mTapsRegistered;
-  event.point             = mTouchPosition;
-  event.time              = time;
-  event.gestureSourceType = mGestureSourceType;
+  event.numberOfTaps = mTapsRegistered;
+  event.point        = mTouchPosition;
+  event.time         = time;
 
   ProcessEvent(event);
 }
 
 void TapGestureRecognizer::ProcessEvent(TapGestureEvent& event)
 {
+  event.sourceType = mSourceType;
+  event.sourceData = mSourceData;
   if(mScene)
   {
     // Create another handle so the recognizer cannot be destroyed during process function
index d6e39c1..293c1c9 100644 (file)
@@ -151,8 +151,7 @@ private:
   uint32_t mLastTapTime;   ///< Time last tap gesture was registered
   uint32_t mLastTouchTime; ///< The last touch down time.
 
-  GestureSourceType mGestureSourceType;  /// < Gesture input source type value.
-  uint32_t          mMaximumAllowedTime; ///< The maximum allowed time required to be recognized as a multi tap gesture (millisecond)
+  uint32_t mMaximumAllowedTime; ///< The maximum allowed time required to be recognized as a multi tap gesture (millisecond)
 };
 
 } // namespace Internal
index ba14daa..4600467 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_GESTURE_ENUMERATIONS_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -55,13 +55,24 @@ enum class GestureState : uint8_t
 
 /**
  * @brief Enumeration for gesture input source type.
+ * @SINCE_2_2.0
  */
 enum class GestureSourceType : int8_t
 {
-  INVALID   = -1, ///< invalid data
-  PRIMARY   = 1,  ///< Primary
-  SECONDARY = 3,  ///< Secondary
-  TERTIARY  = 2,  ///< Third (tertiary)
+  INVALID, ///< invalid data
+  MOUSE,   ///< mouse
+};
+
+/**
+ * @brief Enumeration for data of gesture input source type.
+ * @SINCE_2_2.0
+ */
+enum class GestureSourceData : int8_t
+{
+  INVALID         = -1, ///< invalid data
+  MOUSE_PRIMARY   = 1,  /**< Primary(Left) mouse button */
+  MOUSE_SECONDARY = 3,  /**< Secondary(Right) mouse button */
+  MOUSE_TERTIARY  = 2,  /**< Center(Wheel) mouse button */
 };
 
 } // namespace Dali
index 20c1ca4..da26137 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -55,4 +55,14 @@ uint32_t Gesture::GetTime() const
   return GetImplementation(*this).GetTime();
 }
 
+GestureSourceType Gesture::GetSourceType() const
+{
+  return GetImplementation(*this).GetSourceType();
+}
+
+GestureSourceData Gesture::GetSourceData() const
+{
+  return GetImplementation(*this).GetSourceData();
+}
+
 } // namespace Dali
index aed5e0c..2529cb9 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_GESTURE_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -124,6 +124,20 @@ public:
    */
   uint32_t GetTime() const;
 
+  /**
+   * @brief Gets the value of which source the gesture was started with. (ex : mouse)
+   * @SINCE_2_2.0
+   * @return The gesture input source.
+   */
+  GestureSourceType GetSourceType() const;
+
+  /**
+   * @brief Gets the data of the source type.
+   * @SINCE_2_2.0
+   * @return The gesture source data.
+   */
+  GestureSourceData GetSourceData() const;
+
 public: // Not intended for application developers
   /// @cond internal
   /**
index aba1966..8bec36e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -61,9 +61,4 @@ const Vector2& TapGesture::GetLocalPoint() const
   return GetImplementation(*this).GetLocalPoint();
 }
 
-const GestureSourceType& TapGesture::GetSourceType() const
-{
-  return GetImplementation(*this).GetSourceType();
-}
-
 } // namespace Dali
index 04a2d9b..d0efc90 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TAP_GESTURE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -120,12 +120,6 @@ public:
    */
   const Vector2& GetLocalPoint() const;
 
-  /**
-   * @brief This is the input type of which was tapped.
-   * @return The input type which was tapped.
-   */
-  const GestureSourceType& GetSourceType() const;
-
 public: // Not intended for application developers
   /// @cond internal
   /**