From 990710ba7ec1aba6d24273da9ed5d90eb328052a Mon Sep 17 00:00:00 2001 From: Akshay Kanagali Date: Mon, 15 Apr 2024 14:44:00 +0530 Subject: [PATCH] [M120 Migration][NUI] Add internal mouse event API for NUI. 1. ewk_view_feed_mouse_down 2. ewk_view_feed_mouse_up 3. ewk_view_feed_mouse_move 4. ewk_view_feed_mouse_wheel 5. ewk_view_feed_mouse_out Reference: https://review.tizen.org/gerrit/291431/ Change-Id: I87ffb054777aab42d78038c058548e5f68263551 Signed-off-by: Akshay Kanagali --- .../renderer_host/rwhv_aura_common_helper_efl.cc | 28 ++++++++++++++ .../renderer_host/rwhv_aura_common_helper_efl.h | 5 +++ tizen_src/ewk/efl_integration/eweb_view.cc | 45 ++++++++++++++++++++++ tizen_src/ewk/efl_integration/eweb_view.h | 5 +++ tizen_src/ewk/efl_integration/public/ewk_view.cc | 17 ++++++-- .../ewk/efl_integration/public/ewk_view_internal.h | 9 +++++ 6 files changed, 105 insertions(+), 4 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc index ed20861..139a85c 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc @@ -621,6 +621,34 @@ bool RWHVAuraCommonHelperEfl::TouchEventsEnabled() { return false; } +void RWHVAuraCommonHelperEfl::SendMouseDown(int button, int x, int y) { + if (auto* event_handler = GetEventHandler()) + event_handler->SendMouseDown(button, x, y); +} + +void RWHVAuraCommonHelperEfl::SendMouseUp(int button, int x, int y) { + if (auto* event_handler = GetEventHandler()) + event_handler->SendMouseUp(button, x, y); +} + +void RWHVAuraCommonHelperEfl::SendMouseMove(int x, int y) { + if (auto* event_handler = GetEventHandler()) + event_handler->SendMouseMove(x, y); +} + +void RWHVAuraCommonHelperEfl::SendMouseWheel(bool y_direction, + int step, + int x, + int y) { + if (auto* event_handler = GetEventHandler()) + event_handler->SendMouseWheel(y_direction, step, x, y); +} + +void RWHVAuraCommonHelperEfl::SendMouseOut() { + if (auto* event_handler = GetEventHandler()) + event_handler->SendMouseOut(); +} + void RWHVAuraCommonHelperEfl::OnGestureEvent(ui::GestureEvent* event) { if (event->type() == ui::ET_GESTURE_BEGIN) HandleGestureBegin(); diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h index 55e9235..4a3367f 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h @@ -120,6 +120,11 @@ class CONTENT_EXPORT RWHVAuraCommonHelperEfl { } void SetTouchEventsEnabled(bool enabled); bool TouchEventsEnabled(); + void SendMouseDown(int button, int x, int y); + void SendMouseUp(int button, int x, int y); + void SendMouseMove(int x, int y); + void SendMouseWheel(bool y_direction, int step, int x, int y); + void SendMouseOut(); bool IsFocusedNodeContentEditable() const { return is_content_editable_; } void SetKeyEventsEnabled(bool enabled); diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index fd1d49c..a0349fb 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -1011,6 +1011,51 @@ void EWebView::HandleTouchEvents(Ewk_Touch_Event_Type type, } } +void EWebView::SendMouseDown(int button, int x, int y) { + if (!rwhva() || !rwhva()->offscreen_helper()) { + LOG(WARNING) << "RWHV is not created yet!"; + return; + } + + rwhva()->offscreen_helper()->SendMouseDown(button, x, y); +} + +void EWebView::SendMouseUp(int button, int x, int y) { + if (!rwhva() || !rwhva()->offscreen_helper()) { + LOG(WARNING) << "RWHV is not created yet!"; + return; + } + + rwhva()->offscreen_helper()->SendMouseUp(button, x, y); +} + +void EWebView::SendMouseMove(int x, int y) { + if (!rwhva() || !rwhva()->offscreen_helper()) { + LOG(WARNING) << "RWHV is not created yet!"; + return; + } + + rwhva()->offscreen_helper()->SendMouseMove(x, y); +} + +void EWebView::SendMouseWheel(bool y_direction, int step, int x, int y) { + if (!rwhva() || !rwhva()->offscreen_helper()) { + LOG(WARNING) << "RWHV is not created yet!"; + return; + } + + rwhva()->offscreen_helper()->SendMouseWheel(y_direction, step, x, y); +} + +void EWebView::SendMouseOut() { + if (!rwhva() || !rwhva()->offscreen_helper()) { + LOG(WARNING) << "RWHV is not created yet!"; + return; + } + + rwhva()->offscreen_helper()->SendMouseOut(); +} + bool EWebView::TouchEventsEnabled() const { return rwhva()->offscreen_helper()->TouchEventsEnabled(); } diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index b7d349d..4420a33 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -425,6 +425,11 @@ class EWebView { void HandleTouchEvents(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers); + void SendMouseDown(int button, int x, int y); + void SendMouseUp(int button, int x, int y); + void SendMouseMove(int x, int y); + void SendMouseWheel(bool y_direction, int step, int x, int y); + void SendMouseOut(); void Show(); void Hide(); bool ExecuteJavaScript(const char* script, diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index e85e612..f9bc785 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -1873,18 +1873,22 @@ void ewk_view_feed_mouse_down(Evas_Object* view, Ewk_Mouse_Button_Type button, int x, int y) { - LOG_EWK_API_MOCKUP("NUI feature is not enabled"); + EWK_VIEW_IMPL_GET_OR_RETURN(view, impl); + LOG(INFO) << "ewk_view_feed_mouse_down"; + impl->SendMouseDown(button, x, y); } void ewk_view_feed_mouse_up(Evas_Object* view, Ewk_Mouse_Button_Type button, int x, int y) { - LOG_EWK_API_MOCKUP("NUI feature is not enabled"); + EWK_VIEW_IMPL_GET_OR_RETURN(view, impl); + impl->SendMouseUp(button, x, y); } void ewk_view_feed_mouse_move(Evas_Object* view, int x, int y) { - LOG_EWK_API_MOCKUP("NUI feature is not enabled"); + EWK_VIEW_IMPL_GET_OR_RETURN(view, impl); + impl->SendMouseMove(x, y); } void ewk_view_feed_mouse_wheel(Evas_Object* view, @@ -1892,9 +1896,14 @@ void ewk_view_feed_mouse_wheel(Evas_Object* view, int step, int x, int y) { - LOG_EWK_API_MOCKUP("NUI feature is not enabled"); + EWK_VIEW_IMPL_GET_OR_RETURN(view, impl); + impl->SendMouseWheel(!!y_direction, step, x, y); } +void ewk_view_feed_mouse_out(Evas_Object* view) { + EWK_VIEW_IMPL_GET_OR_RETURN(view, impl); + impl->SendMouseOut(); +} void ewk_view_auto_login(Evas_Object *view, const char* user_name, const char* password) { LOG_EWK_API_MOCKUP("This API is not supported."); diff --git a/tizen_src/ewk/efl_integration/public/ewk_view_internal.h b/tizen_src/ewk/efl_integration/public/ewk_view_internal.h index d57cc5a..cdf7866 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view_internal.h +++ b/tizen_src/ewk/efl_integration/public/ewk_view_internal.h @@ -1506,6 +1506,15 @@ EXPORT_API void ewk_view_feed_mouse_wheel(Evas_Object* o, int y); /** + * Sends mouse out event. + * + * @since_tizen 6.0 + * + * @param[in] o view object + */ +EXPORT_API void ewk_view_feed_mouse_out(Evas_Object* o); + +/** * @brief Sends key event. * * @since_tizen 2.4 -- 2.7.4