Add GetLastHoverEvent 53/298753/4
authorjoogab.yun <joogab.yun@samsung.com>
Wed, 13 Sep 2023 06:45:36 +0000 (15:45 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Wed, 13 Sep 2023 07:36:04 +0000 (16:36 +0900)
Change-Id: Ib8f1c974d388d04ba6bae21405dc423d815e3738

dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/integration-api/adaptor-framework/scene-holder-impl.cpp
dali/integration-api/adaptor-framework/scene-holder-impl.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-impl.h

index 765e66c..32ce990 100644 (file)
@@ -299,6 +299,11 @@ const TouchEvent& GetLastTouchEvent(Window window)
   return GetImplementation(window).GetLastTouchEvent();
 }
 
+const HoverEvent& GetLastHoverEvent(Window window)
+{
+  return GetImplementation(window).GetLastHoverEvent();
+}
+
 bool PointerConstraintsLock(Window window)
 {
   return GetImplementation(window).PointerConstraintsLock();
index 2f4e99a..eaed6a7 100644 (file)
@@ -33,6 +33,7 @@ namespace Dali
 {
 class KeyEvent;
 class TouchEvent;
+class HoverEvent;
 class WheelEvent;
 class RenderTaskList;
 struct TouchPoint;
@@ -540,6 +541,15 @@ DALI_ADAPTOR_API const KeyEvent& GetLastKeyEvent(Window window);
 DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
 
 /**
+ * @brief Gets the last hover event the window gets.
+ *
+ * @param[in] window The window instance.
+ * @return The last hover event the window gets.
+ * @note It returns the raw event the window gets. There is no hit-actor and local position information.
+ */
+DALI_ADAPTOR_API const HoverEvent& GetLastHoverEvent(Window window);
+
+/**
  * @brief Sets the pointer constraints lock.
  *
  * @param[in] window The window instance.
index e56b7ff..e5703e4 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/integration-api/events/hover-event-integ.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/touch-integ.h>
 #include <dali/integration-api/events/wheel-event-integ.h>
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/layer.h>
@@ -74,6 +75,8 @@ private:
 
 SceneHolder::SceneHolder()
 : mLifeCycleObserver(new SceneHolderLifeCycleObserver(mAdaptor)),
+  mLastTouchEvent(),
+  mLastHoverEvent(),
   mId(mSceneHolderCounter++),
   mSurface(nullptr),
   mAdaptor(nullptr),
@@ -307,11 +310,13 @@ void SceneHolder::FeedTouchPoint(Dali::Integration::Point& point, int timeStamp)
     // First the touch and/or hover event & related gesture events are queued
     if(type == Integration::TouchEventCombiner::DISPATCH_TOUCH || type == Integration::TouchEventCombiner::DISPATCH_BOTH)
     {
+      mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
       mScene.QueueEvent(touchEvent);
     }
 
     if(type == Integration::TouchEventCombiner::DISPATCH_HOVER || type == Integration::TouchEventCombiner::DISPATCH_BOTH)
     {
+      mLastHoverEvent = Dali::Integration::NewHoverEvent(timeStamp, point);
       mScene.QueueEvent(hoverEvent);
     }
 
@@ -320,6 +325,16 @@ void SceneHolder::FeedTouchPoint(Dali::Integration::Point& point, int timeStamp)
   }
 }
 
+const Dali::TouchEvent& SceneHolder::GetLastTouchEvent() const
+{
+  return mLastTouchEvent;
+}
+
+const Dali::HoverEvent& SceneHolder::GetLastHoverEvent() const
+{
+  return mLastHoverEvent;
+}
+
 void SceneHolder::FeedWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
 {
   // Signals can be emitted while processing core events, and the scene holder could be deleted in the signal callback.
index c2e6c93..c4e8cdd 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/graphics-api/graphics-controller.h>
+#include <dali/integration-api/events/hover-event-integ.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/point.h>
 #include <dali/integration-api/events/touch-event-combiner.h>
 #include <dali/integration-api/scene.h>
 #include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/events/hover-event.h>
+#include <dali/public-api/events/touch-event.h>
 #include <dali/public-api/math/uint-16-pair.h>
 #include <dali/public-api/object/base-object.h>
 #include <atomic>
@@ -189,6 +192,20 @@ public:
   void FeedTouchPoint(Dali::Integration::Point& point, int timeStamp);
 
   /**
+   * @brief Get the Last Touch Event
+   *
+   * @return Dali::TouchEvent
+   */
+  const Dali::TouchEvent& GetLastTouchEvent() const;
+
+  /**
+   * @brief Get the Last Hover Event
+   *
+   * @return Dali::HoverEvent
+   */
+  const Dali::HoverEvent& GetLastHoverEvent() const;
+
+  /**
    * @copydoc Dali::Integration::SceneHolder::FeedWheelEvent
    */
   void FeedWheelEvent(Dali::Integration::WheelEvent& wheelEvent);
@@ -375,6 +392,8 @@ private:
 
   class SceneHolderLifeCycleObserver;
   std::unique_ptr<SceneHolderLifeCycleObserver> mLifeCycleObserver; ///< The adaptor life cycle observer
+  Dali::TouchEvent                              mLastTouchEvent;
+  Dali::HoverEvent                              mLastHoverEvent;
 
 protected:
   uint32_t                 mId;    ///< A unique ID to identify the SceneHolder starting from 0
index 99fab49..2f89d4e 100644 (file)
@@ -23,7 +23,6 @@
 #include <dali/devel-api/events/key-event-devel.h>
 #include <dali/integration-api/core.h>
 #include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/touch-integ.h>
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/camera-actor.h>
 #include <dali/public-api/actors/layer.h>
@@ -98,7 +97,6 @@ Window::Window()
   mInsetsChangedSignal(),
   mPointerConstraintsSignal(),
   mLastKeyEvent(),
-  mLastTouchEvent(),
   mIsTransparent(false),
   mIsFocusAcceptable(true),
   mIconified(false),
@@ -1061,7 +1059,6 @@ void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
 
 void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
 {
-  mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
   FeedTouchPoint(point, timeStamp);
 }
 
@@ -1400,11 +1397,6 @@ const Dali::KeyEvent& Window::GetLastKeyEvent() const
   return mLastKeyEvent;
 }
 
-const Dali::TouchEvent& Window::GetLastTouchEvent() const
-{
-  return mLastTouchEvent;
-}
-
 void Window::SetUserGeometryPolicy()
 {
   if(mIsEnabledUserGeometry == true)
index 6bee6d3..840f314 100644 (file)
@@ -508,11 +508,6 @@ public: // Dali::Internal::Adaptor::SceneHolder
   const Dali::KeyEvent& GetLastKeyEvent() const;
 
   /**
-   * @copydoc Dali::DevelWindow::GetLastTouchEvent()
-   */
-  const Dali::TouchEvent& GetLastTouchEvent() const;
-
-  /**
    * @copydoc Dali::DevelWindow::PointerConstraintsLock()
    */
   bool PointerConstraintsLock();
@@ -952,8 +947,7 @@ private:
   InsetsChangedSignalType                 mInsetsChangedSignal;
   PointerConstraintsSignalType            mPointerConstraintsSignal;
 
-  Dali::KeyEvent   mLastKeyEvent;
-  Dali::TouchEvent mLastTouchEvent;
+  Dali::KeyEvent mLastKeyEvent;
 
   bool mIsTransparent : 1;
   bool mIsFocusAcceptable : 1;