[Tizen] Add WheelEventGeneratedSignal and add clockwise value 45/271545/1 accepted/tizen/6.5/unified/20220223.132714 submit/tizen_6.5/20220223.022356
authorjoogab.yun <joogab.yun@samsung.com>
Fri, 28 Jan 2022 04:13:23 +0000 (13:13 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Wed, 23 Feb 2022 01:11:21 +0000 (10:11 +0900)
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

dali/integration-api/adaptor-framework/scene-holder-impl.h
dali/integration-api/adaptor-framework/scene-holder.cpp
dali/integration-api/adaptor-framework/scene-holder.h
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp

index 7f6c9ff..39626ca 100644 (file)
@@ -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.
index d2a20bc..6d4d282 100644 (file)
@@ -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
index abe1634..d660509 100644 (file)
@@ -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<void(const Dali::WheelEvent&)> WheelEventSignalType; ///< Touched signal type
 
+  typedef Signal<bool(const Dali::WheelEvent&)> 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.
index ccea97c..2c80a4d 100644 (file)
@@ -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<WindowBaseEcoreWl2*>(data);
+  WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(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<Ecore_Wl2_Event_Aux_Message*>(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<char*>(data));
-       options.Add(option);
-     }
-   }
-
-   mAuxiliaryMessageSignal.Emit(key, value, options);
- }
-}
+  Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(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<char*>(data));
+        options.Add(option);
+      }
+    }
 
+    mAuxiliaryMessageSignal.Emit(key, value, options);
+  }
+}
 
 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
 {