Merge "If Hittable is false, actor should not receive events except INTERRUPTED"...
authorjoogab yun <joogab.yun@samsung.com>
Thu, 20 Jun 2024 05:02:42 +0000 (05:02 +0000)
committerGerrit Code Review <gerrit@review>
Thu, 20 Jun 2024 05:02:42 +0000 (05:02 +0000)
dali/integration-api/events/touch-event-combiner.cpp
dali/integration-api/events/touch-event-combiner.h
dali/internal/update/common/animatable-property.h

index 4f01dfd..879df14 100644 (file)
@@ -80,7 +80,7 @@ TouchEventCombiner::TouchEventCombiner(uint32_t minMotionTime, Vector2 minMotion
 
 TouchEventCombiner::~TouchEventCombiner() = default;
 
-TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent(const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent)
+TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent(const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent, bool isMultiTouchEvent)
 {
   TouchEventCombiner::EventDispatchType dispatchEvent(TouchEventCombiner::DISPATCH_NONE);
   const PointState::Type                state    = point.GetState();
@@ -99,7 +99,10 @@ TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent(cons
       {
         if(iter->point.GetDeviceId() != deviceId)
         {
-          iter->point.SetState(PointState::STATIONARY);
+          if(!isMultiTouchEvent)
+          {
+            iter->point.SetState(PointState::STATIONARY);
+          }
         }
         else
         {
@@ -170,7 +173,10 @@ TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent(cons
         }
         else
         {
-          iter->point.SetState(PointState::STATIONARY);
+          if(!isMultiTouchEvent)
+          {
+            iter->point.SetState(PointState::STATIONARY);
+          }
           touchEvent.AddPoint(iter->point);
         }
       }
@@ -242,7 +248,10 @@ TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent(cons
           }
           else
           {
-            iter->point.SetState(PointState::STATIONARY);
+            if(!isMultiTouchEvent)
+            {
+              iter->point.SetState(PointState::STATIONARY);
+            }
             touchEvent.AddPoint(iter->point);
           }
         }
@@ -300,7 +309,10 @@ TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent(cons
           }
           else
           {
-            iter->point.SetState(PointState::STATIONARY);
+            if(!isMultiTouchEvent)
+            {
+              iter->point.SetState(PointState::STATIONARY);
+            }
             hoverEvent.AddPoint(iter->point);
           }
         }
index 95a49fb..8cde275 100644 (file)
@@ -94,14 +94,15 @@ public:
    * @note If the thresholds set have not been passed, then false is returned and the TouchEvent and/or HoverEvent should not be sent
    * to Dali Core.
    *
-   * @param[in]   point         The new Point.
-   * @param[in]   time          The time the event occurred.
-   * @param[out]  touchEvent    This is populated with the correct Point(s) and time information.
-   * @param[out]  hoverEvent    This is populated with the correct Point(s) and time information.
+   * @param[in]   point             The new Point.
+   * @param[in]   time              The time the event occurred.
+   * @param[out]  touchEvent        This is populated with the correct Point(s) and time information.
+   * @param[out]  hoverEvent        This is populated with the correct Point(s) and time information.
+   * @param[in]   isMultiTouchEvent The Flag whether multitouch is being.
    *
    * @return true if the point is beyond the different thresholds set thus, should be sent to core, false otherwise.
    */
-  EventDispatchType GetNextTouchEvent(const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent);
+  EventDispatchType GetNextTouchEvent(const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent, bool isMultiTouchEvent = false);
 
   /**
    * Sets the minimum time (in ms) that should occur between motion events.
index f9bd877..4697d88 100644 (file)
@@ -379,9 +379,13 @@ public:
    */
   void Set(BufferIndex bufferIndex, int value)
   {
-    mValue[bufferIndex] = value;
+    // check if the value actually changed to avoid dirtying nodes unnecessarily
+    if(mValue[bufferIndex] != value)
+    {
+      mValue[bufferIndex] = value;
 
-    OnSet();
+      OnSet();
+    }
   }
 
   /**
@@ -391,9 +395,13 @@ public:
    */
   void SetRelative(BufferIndex bufferIndex, int delta)
   {
-    mValue[bufferIndex] = mValue[bufferIndex] + delta;
+    // check if the value actually changed to avoid dirtying nodes unnecessarily
+    if(delta)
+    {
+      mValue[bufferIndex] = mValue[bufferIndex] + delta;
 
-    OnSet();
+      OnSet();
+    }
   }
 
   /**
@@ -439,11 +447,15 @@ public:
    */
   void Bake(BufferIndex bufferIndex, int value)
   {
-    mValue[bufferIndex]     = value;
-    mValue[1 - bufferIndex] = value;
-    mBaseValue              = mValue[bufferIndex];
+    // bake has to check the base value as current buffer value can be correct by constraint or something else
+    if(mBaseValue != value)
+    {
+      mValue[bufferIndex]     = value;
+      mValue[1 - bufferIndex] = value;
+      mBaseValue              = mValue[bufferIndex];
 
-    OnBake();
+      OnBake();
+    }
   }
 
   /**
@@ -570,9 +582,13 @@ public:
    */
   void Set(BufferIndex bufferIndex, float value)
   {
-    mValue[bufferIndex] = value;
+    // check if the value actually changed to avoid dirtying nodes unnecessarily
+    if(!Dali::Equals(mValue[bufferIndex], value))
+    {
+      mValue[bufferIndex] = value;
 
-    OnSet();
+      OnSet();
+    }
   }
 
   /**
@@ -582,9 +598,13 @@ public:
    */
   void SetRelative(BufferIndex bufferIndex, float delta)
   {
-    mValue[bufferIndex] = mValue[bufferIndex] + delta;
+    // check if the value actually changed to avoid dirtying nodes unnecessarily
+    if(!Dali::EqualsZero(delta))
+    {
+      mValue[bufferIndex] = mValue[bufferIndex] + delta;
 
-    OnSet();
+      OnSet();
+    }
   }
 
   /**
@@ -630,13 +650,17 @@ public:
    */
   void Bake(BufferIndex bufferIndex, float value)
   {
-    // It's ok to bake both buffers as render is performed in same thread as update. Reading from event side
-    // has never been atomically safe.
-    mValue[bufferIndex]     = value;
-    mValue[1 - bufferIndex] = value;
-    mBaseValue              = mValue[bufferIndex];
+    // bake has to check the base value as current buffer value can be correct by constraint or something else
+    if(!Dali::Equals(mBaseValue, value))
+    {
+      // It's ok to bake both buffers as render is performed in same thread as update. Reading from event side
+      // has never been atomically safe.
+      mValue[bufferIndex]     = value;
+      mValue[1 - bufferIndex] = value;
+      mBaseValue              = mValue[bufferIndex];
 
-    OnBake();
+      OnBake();
+    }
   }
 
   /**