From 23cf7a12971b5378109d217f99887c207d91a0c9 Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Wed, 13 Sep 2023 15:45:36 +0900 Subject: [PATCH] Add GetLastHoverEvent Change-Id: Ib8f1c974d388d04ba6bae21405dc423d815e3738 --- dali/devel-api/adaptor-framework/window-devel.cpp | 5 +++++ dali/devel-api/adaptor-framework/window-devel.h | 10 ++++++++++ .../adaptor-framework/scene-holder-impl.cpp | 15 +++++++++++++++ .../adaptor-framework/scene-holder-impl.h | 19 +++++++++++++++++++ dali/internal/window-system/common/window-impl.cpp | 8 -------- dali/internal/window-system/common/window-impl.h | 8 +------- 6 files changed, 50 insertions(+), 15 deletions(-) diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index 765e66c..32ce990 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -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(); diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index 2f4e99a..eaed6a7 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -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. diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index e56b7ff..e5703e4 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -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. diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.h b/dali/integration-api/adaptor-framework/scene-holder-impl.h index c2e6c93..c4e8cdd 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.h +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.h @@ -20,11 +20,14 @@ // EXTERNAL INCLUDES #include +#include #include #include #include #include #include +#include +#include #include #include #include @@ -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 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 diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 99fab49..2f89d4e 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -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) diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 6bee6d3..840f314 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -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; -- 2.7.4