From 442106aab305825abe7c2eeed93b52da847a0e91 Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Fri, 28 Jan 2022 13:13:23 +0900 Subject: [PATCH 1/1] [Tizen] Add WheelEventGeneratedSignal and add clockwise value Previously, RotaryEvents could always be received only by window. Now, User can receive Rotary Events in focused View as well. It is also possible to propagate events to the parent view. If there is no focused View, the window will receive the event. This only applies to Rotary Event(CustomWheel type). Change-Id: I0c732811213b5f319e663132449be05e8c651547 --- .../adaptor-framework/scene-holder-impl.h | 10 +++- .../adaptor-framework/scene-holder.cpp | 7 ++- .../adaptor-framework/scene-holder.h | 19 +++++++- .../ecore-wl2/window-base-ecore-wl2.cpp | 54 +++++++++++----------- 4 files changed, 59 insertions(+), 31 deletions(-) diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.h b/dali/integration-api/adaptor-framework/scene-holder-impl.h index 7f6c9ff..39626ca 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.h +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -264,6 +264,14 @@ public: return mScene.WheelEventSignal(); } + /** + * @copydoc Dali::Integration::SceneHolder::WheelEventGeneratedSignal() + */ + Dali::Integration::SceneHolder::WheelEventGeneratedSignalType& WheelEventGeneratedSignal() + { + return mScene.WheelEventGeneratedSignal(); + } + public: // The following methods can be overridden if required /** * @brief Returns whether the Scene is visible or not. diff --git a/dali/integration-api/adaptor-framework/scene-holder.cpp b/dali/integration-api/adaptor-framework/scene-holder.cpp index d2a20bc..6d4d282 100644 --- a/dali/integration-api/adaptor-framework/scene-holder.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,6 +129,11 @@ SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal() return GetImplementation(*this).WheelEventSignal(); } +SceneHolder::WheelEventGeneratedSignalType& SceneHolder::WheelEventGeneratedSignal() +{ + return GetImplementation(*this).WheelEventGeneratedSignal(); +} + } // namespace Integration } // namespace Dali diff --git a/dali/integration-api/adaptor-framework/scene-holder.h b/dali/integration-api/adaptor-framework/scene-holder.h index abe1634..d660509 100644 --- a/dali/integration-api/adaptor-framework/scene-holder.h +++ b/dali/integration-api/adaptor-framework/scene-holder.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_SCENEHOLDER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,6 +60,8 @@ public: typedef Signal WheelEventSignalType; ///< Touched signal type + typedef Signal WheelEventGeneratedSignalType; ///< Wheel event generated signal type + /** * @brief Create an uninitialized SceneHolder handle. */ @@ -212,6 +214,21 @@ public: */ WheelEventSignalType& WheelEventSignal(); + /** + * @brief This signal is emitted to KeyboardFocusManager when a custom wheel type event is received. + * When a custom wheel event occurs, it need to process the focused actor first. + * + * Therefore, KeyboardFocusManager first checks whether WheelEvent is generated as WheelEventGeneratedSignal. + * This is only valid for custom wheel events. + * + * A callback of the following type may be connected: + * @code + * bool YourCallbackName(const WheelEvent& event); + * @endcode + * @return The signal to connect to + */ + WheelEventGeneratedSignalType& WheelEventGeneratedSignal(); + public: // Not intended for application developers /** * @brief This constructor is used internally to create additional SceneHolder handles. diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp index ccea97c..2c80a4d 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -582,9 +582,9 @@ static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event ///////////////////////////////////////////////////////////////////////////////////////////////// // Window Auxiliary Message Callbacks ///////////////////////////////////////////////////////////////////////////////////////////////// -static Eina_Bool EcoreEventWindowAuxiliaryMessage(void *data, int type, void *event) +static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event) { - WindowBaseEcoreWl2* windowBase = static_cast(data); + WindowBaseEcoreWl2* windowBase = static_cast(data); if(windowBase) { windowBase->OnEcoreEventWindowAuxiliaryMessage(event); @@ -1210,10 +1210,9 @@ void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event) DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n"); - int direction = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1; - int timeStamp = detentEvent->timestamp; + int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1; - Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, direction, 0, Vector2(0.0f, 0.0f), 0, timeStamp); + Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp); mWheelEventSignal.Emit(wheelEvent); } @@ -1403,30 +1402,29 @@ void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest() void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event) { - Ecore_Wl2_Event_Aux_Message *message = static_cast(event); - if(message) - { - DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n",message->key, message->val); - std::string key(message->key); - std::string value(message->val); - Dali::Property::Array options; - - if(message->options) - { - Eina_List *l; - void* data; - EINA_LIST_FOREACH(message->options, l, data) - { - DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n",(char*)data); - std::string option(static_cast(data)); - options.Add(option); - } - } - - mAuxiliaryMessageSignal.Emit(key, value, options); - } -} + Ecore_Wl2_Event_Aux_Message* message = static_cast(event); + if(message) + { + DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val); + std::string key(message->key); + std::string value(message->val); + Dali::Property::Array options; + + if(message->options) + { + Eina_List* l; + void* data; + EINA_LIST_FOREACH(message->options, l, data) + { + DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data); + std::string option(static_cast(data)); + options.Add(option); + } + } + mAuxiliaryMessageSignal.Emit(key, value, options); + } +} void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event) { -- 2.7.4