From fe6160d6f0cb2c42405b9cdd173fe47854521ddf Mon Sep 17 00:00:00 2001 From: "huayong.xu" Date: Tue, 29 Dec 2020 14:07:06 +0800 Subject: [PATCH] Support mouse & wheel event in web engine. Mouse and wheel events are supported in web engine. Change-Id: I52b240ee8fe83fc17f5d2ec28bcb45e74832c693 --- .../adaptor-framework/web-engine-plugin.h | 27 ++++++++++++++++++++++ dali/devel-api/adaptor-framework/web-engine.cpp | 20 ++++++++++++++++ dali/devel-api/adaptor-framework/web-engine.h | 26 +++++++++++++++++++++ .../internal/web-engine/common/web-engine-impl.cpp | 20 ++++++++++++++++ dali/internal/web-engine/common/web-engine-impl.h | 20 ++++++++++++++++ 5 files changed, 113 insertions(+) diff --git a/dali/devel-api/adaptor-framework/web-engine-plugin.h b/dali/devel-api/adaptor-framework/web-engine-plugin.h index 373b59d..ea6339e 100644 --- a/dali/devel-api/adaptor-framework/web-engine-plugin.h +++ b/dali/devel-api/adaptor-framework/web-engine-plugin.h @@ -33,6 +33,8 @@ class WebEngineBackForwardList; class WebEngineContext; class WebEngineCookieManager; class WebEngineSettings; +class HoverEvent; +class WheelEvent; /** * @brief WebEnginePlugin is an abstract interface, used by dali-adaptor to access WebEngine plugin. @@ -350,7 +352,20 @@ public: virtual bool SendKeyEvent(const KeyEvent& event) = 0; /** + * @brief Support mouse events or not. + * @param[in] enabled True if enabled, false othewise. + */ + virtual void EnableMouseEvents( bool enabled ) = 0; + + /** + * @brief Support key events or not. + * @param[in] enabled True if enabled, false othewise. + */ + virtual void EnableKeyEvents( bool enabled ) = 0; + + /** * @brief Sets focus. + * @param[in] focused True if focus is gained, false lost. */ virtual void SetFocus(bool focused) = 0; @@ -367,6 +382,18 @@ public: virtual void EnableVideoHole(bool enabled) = 0; /** + * @brief Sends Hover Events. + * @param[in] event The hover event would be sent. + */ + virtual bool SendHoverEvent( const HoverEvent& event ) = 0; + + /** + * @brief Sends Wheel Events. + * @param[in] event The wheel event would be sent. + */ + virtual bool SendWheelEvent( const WheelEvent& event ) = 0; + + /** * @brief Connects to this signal to be notified when page loading is started. * * @return A signal object to connect with. diff --git a/dali/devel-api/adaptor-framework/web-engine.cpp b/dali/devel-api/adaptor-framework/web-engine.cpp index 2569cf6..f2df43e 100644 --- a/dali/devel-api/adaptor-framework/web-engine.cpp +++ b/dali/devel-api/adaptor-framework/web-engine.cpp @@ -274,6 +274,16 @@ bool WebEngine::SendKeyEvent(const KeyEvent& event) return GetImplementation(*this).SendKeyEvent(event); } +bool WebEngine::SendHoverEvent( const HoverEvent& event ) +{ + return GetImplementation( *this ).SendHoverEvent( event ); +} + +bool WebEngine::SendWheelEvent( const WheelEvent& event ) +{ + return GetImplementation( *this ).SendWheelEvent( event ); +} + void WebEngine::SetFocus(bool focused) { GetImplementation(*this).SetFocus(focused); @@ -284,6 +294,16 @@ void WebEngine::UpdateDisplayArea(Dali::Rect displayArea) GetImplementation(*this).UpdateDisplayArea(displayArea); } +void WebEngine::EnableMouseEvents(bool enabled) +{ + GetImplementation(*this).EnableMouseEvents(enabled); +} + +void WebEngine::EnableKeyEvents(bool enabled) +{ + GetImplementation(*this).EnableKeyEvents(enabled); +} + void WebEngine::EnableVideoHole(bool enabled) { GetImplementation(*this).EnableVideoHole(enabled); diff --git a/dali/devel-api/adaptor-framework/web-engine.h b/dali/devel-api/adaptor-framework/web-engine.h index 2d2d142..fc0ce9f 100644 --- a/dali/devel-api/adaptor-framework/web-engine.h +++ b/dali/devel-api/adaptor-framework/web-engine.h @@ -336,6 +336,20 @@ public: void SetFocus(bool focused); /** + * @brief Enables/disables mouse events. The default is enabled. + * + * @param[in] enabled True if mouse events are enabled, false otherwise + */ + void EnableMouseEvents( bool enabled ); + + /** + * @brief Enables/disables key events. The default is enabled. + * + * @param[in] enabled True if key events are enabled, false otherwise + */ + void EnableKeyEvents( bool enabled ); + + /** * @brief Update display area. * @param[in] displayArea The area to display web page. */ @@ -348,6 +362,18 @@ public: void EnableVideoHole(bool enabled); /** + * @brief Sends hover events. + * @param[in] event The hover event would be sent. + */ + bool SendHoverEvent( const HoverEvent& event ); + + /** + * @brief Sends wheel events. + * @param[in] event The wheel event would be sent. + */ + bool SendWheelEvent( const WheelEvent& event ); + + /** * @brief Connects to this signal to be notified when page loading is started. * * @return A signal object to connect with. diff --git a/dali/internal/web-engine/common/web-engine-impl.cpp b/dali/internal/web-engine/common/web-engine-impl.cpp index e4f54ba..0c998ad 100644 --- a/dali/internal/web-engine/common/web-engine-impl.cpp +++ b/dali/internal/web-engine/common/web-engine-impl.cpp @@ -359,6 +359,16 @@ void WebEngine::SetSize(int width, int height) mPlugin->SetSize(width, height); } +void WebEngine::EnableMouseEvents(bool enabled) +{ + mPlugin->EnableMouseEvents(enabled); +} + +void WebEngine::EnableKeyEvents(bool enabled) +{ + mPlugin->EnableKeyEvents(enabled); +} + bool WebEngine::SendTouchEvent(const Dali::TouchEvent& touch) { return mPlugin->SendTouchEvent(touch); @@ -384,6 +394,16 @@ void WebEngine::EnableVideoHole(bool enabled) mPlugin->EnableVideoHole(enabled); } +bool WebEngine::SendHoverEvent( const Dali::HoverEvent& event ) +{ + return mPlugin->SendHoverEvent( event ); +} + +bool WebEngine::SendWheelEvent( const Dali::WheelEvent& event ) +{ + return mPlugin->SendWheelEvent( event ); +} + Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal() { return mPlugin->PageLoadStartedSignal(); diff --git a/dali/internal/web-engine/common/web-engine-impl.h b/dali/internal/web-engine/common/web-engine-impl.h index 057b831..a11211f 100644 --- a/dali/internal/web-engine/common/web-engine-impl.h +++ b/dali/internal/web-engine/common/web-engine-impl.h @@ -250,6 +250,16 @@ public: void SetSize(int width, int height); /** + * @copydoc Dali::WebEngine::EnableMouseEvents() + */ + void EnableMouseEvents( bool enabled ); + + /** + * @copydoc Dali::WebEngine::EnableKeyEvents() + */ + void EnableKeyEvents( bool enabled ); + + /** * @copydoc Dali::WebEngine::SendTouchEvent() */ bool SendTouchEvent(const Dali::TouchEvent& touch); @@ -275,6 +285,16 @@ public: void EnableVideoHole(bool enabled); /** + * @copydoc Dali::WebEngine::SendHoverEvent() + */ + bool SendHoverEvent( const Dali::HoverEvent& event ); + + /** + * @copydoc Dali::WebEngine::SendWheelEvent() + */ + bool SendWheelEvent( const Dali::WheelEvent& event ); + + /** * @copydoc Dali::WebEngine::PageLoadStartedSignal() */ Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal(); -- 2.7.4