[Tizen] Add Get/Set native window id on KeyEvent and Scene 77/303377/2 accepted/tizen/8.0/unified/20240101.154858
authorjoogab.yun <joogab.yun@samsung.com>
Tue, 19 Dec 2023 09:19:54 +0000 (18:19 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Wed, 27 Dec 2023 01:19:59 +0000 (10:19 +0900)
Change-Id: I08af7fa77f7fe0a4a115228aa530411032e362b4

15 files changed:
automated-tests/src/dali/utc-Dali-KeyEvent.cpp
automated-tests/src/dali/utc-Dali-Scene.cpp
dali/devel-api/events/key-event-devel.cpp
dali/devel-api/events/key-event-devel.h
dali/integration-api/events/key-event-integ.cpp
dali/integration-api/events/key-event-integ.h
dali/integration-api/scene.cpp
dali/integration-api/scene.h
dali/internal/event/common/scene-impl.cpp
dali/internal/event/common/scene-impl.h
dali/internal/event/events/key-event-impl.cpp
dali/internal/event/events/key-event-impl.h
dali/internal/event/events/key-event-processor.cpp
dali/public-api/events/key-event.cpp
dali/public-api/events/key-event.h

index 3c549a7..77e0f74 100644 (file)
@@ -112,6 +112,7 @@ int UtcDaliKeyEventDefaultConstructor(void)
   DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION);       // check device class
   DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
   DALI_TEST_EQUALS(false, event.IsRepeat(), TEST_LOCATION);                           // check repeat
+  DALI_TEST_EQUALS(0, event.GetWindowId(), TEST_LOCATION);                            // check window id
 
   END_TEST;
 }
@@ -573,4 +574,18 @@ int UtcDaliKeyEventSetRepeat(void)
   DALI_TEST_EQUALS(true, event.IsRepeat(), TEST_LOCATION);
 
   END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliKeyEventSetWindowId(void)
+{
+  TestApplication application;
+
+  Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
+
+  DALI_TEST_EQUALS(0, event.GetWindowId(), TEST_LOCATION);
+
+  DevelKeyEvent::SetWindowId(event, 1);
+  DALI_TEST_EQUALS(1, event.GetWindowId(), TEST_LOCATION);
+
+  END_TEST;
+}
index ee5ead4..e80063d 100644 (file)
@@ -3072,3 +3072,18 @@ int UtcDaliSceneGeoTouchedEnabledDisabled(void)
 
   END_TEST;
 }
+
+int UtcDaliSceneGetNativeId(void)
+{
+  TestApplication application; // Initializes
+
+  Dali::Integration::Scene scene = application.GetScene();
+  int32_t nativeId = scene.GetNativeId();
+  DALI_TEST_EQUALS(nativeId, 0, TEST_LOCATION);
+
+  // Test that setting native id
+  scene.SetNativeId(1);
+  nativeId = scene.GetNativeId();
+  DALI_TEST_EQUALS(nativeId, 1, TEST_LOCATION);
+  END_TEST;
+}
index bf4189a..a67a1db 100644 (file)
@@ -82,6 +82,11 @@ void SetRepeat(KeyEvent keyEvent, const bool repeat)
   GetImplementation(keyEvent).SetRepeat(repeat);\r
 }\r
 \r
+void SetWindowId(KeyEvent keyEvent, uint32_t windowId)\r
+{\r
+  GetImplementation(keyEvent).SetWindowId(windowId);\r
+}\r
+\r
 } // namespace DevelKeyEvent\r
 \r
 } // namespace Dali\r
index cf88c9f..409c940 100644 (file)
@@ -125,6 +125,15 @@ DALI_CORE_API void SetState(KeyEvent keyEvent, const KeyEvent::State& state);
  */\r
 DALI_CORE_API void SetRepeat(KeyEvent keyEvent, const bool repeat);\r
 \r
+/**\r
+ * @brief Sets window id where key event occurred.\r
+ *\r
+ * @SINCE_2_3.5\r
+ * @param[in] keyEvent The instance of KeyEvent.\r
+ * @param[in] windowId The window id where key event occurred.\r
+ */\r
+DALI_CORE_API void SetWindowId(KeyEvent keyEvent, uint32_t windowId);\r
+\r
 } // namespace DevelKeyEvent\r
 \r
 } // namespace Dali\r
index 80426f9..37dbe0a 100644 (file)
@@ -38,7 +38,8 @@ KeyEvent::KeyEvent()
   deviceName(""),
   deviceClass(Device::Class::NONE),
   deviceSubclass(Device::Subclass::NONE),
-  isRepeat(false)
+  isRepeat(false),
+  windowId(0)
 {
 }
 
@@ -65,7 +66,8 @@ KeyEvent::KeyEvent(const std::string&           keyName,
   deviceName(deviceName),
   deviceClass(deviceClass),
   deviceSubclass(deviceSubclass),
-  isRepeat(false)
+  isRepeat(false),
+  windowId(0)
 {
 }
 
index 37f4fc1..7cb3d6b 100644 (file)
@@ -142,6 +142,11 @@ struct DALI_CORE_API KeyEvent : public Event
    * Whether the key referenced by the event is a repeating key.
    */
   bool isRepeat;
+
+  /**
+   * Window id where key event occurred.
+   */
+  uint32_t windowId;
 };
 
 } // namespace Integration
index e0d6c4f..64e49b0 100644 (file)
@@ -238,6 +238,16 @@ bool Scene::IsGeometryHittestEnabled()
   return GetImplementation(*this).IsGeometryHittestEnabled();
 }
 
+void Scene::SetNativeId(int32_t nativeId)
+{
+  return GetImplementation(*this).SetNativeId(nativeId);
+}
+
+int32_t Scene::GetNativeId() const
+{
+  return GetImplementation(*this).GetNativeId();
+}
+
 Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
 {
   return GetImplementation(*this).EventProcessingFinishedSignal();
index dbab87d..be7e1ff 100644 (file)
@@ -431,6 +431,20 @@ public:
   bool IsGeometryHittestEnabled();
 
   /**
+   * @brief Sets the native window id
+   *
+   * @param nativeId The native window id
+   */
+  void SetNativeId(int32_t nativeId);
+
+  /**
+   * @brief Gets the native window id
+   *
+   * @return The native window id
+   */
+  int32_t GetNativeId() const;
+
+  /**
    * @brief This signal is emitted just after the event processing is finished.
    *
    * @return The signal to connect to
index 304670d..7bb3ffd 100644 (file)
@@ -61,7 +61,8 @@ Scene::Scene()
   mGeometryHittest(false),
   mEventProcessor(*this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor()),
   mSurfaceOrientation(0),
-  mScreenOrientation(0)
+  mScreenOrientation(0),
+  mNativeId(0)
 {
 }
 
@@ -510,6 +511,16 @@ bool Scene::IsGeometryHittestEnabled() const
   return mGeometryHittest;
 }
 
+void Scene::SetNativeId(int32_t nativeId)
+{
+  mNativeId = nativeId;
+}
+
+int32_t Scene::GetNativeId() const
+{
+  return mNativeId;
+}
+
 Integration::Scene::KeyEventSignalType& Scene::KeyEventSignal()
 {
   return mKeyEventSignal;
index edd9c5f..7846452 100644 (file)
@@ -253,6 +253,16 @@ public:
   bool IsGeometryHittestEnabled() const;
 
   /**
+   * @copydoc Dali::Integration::Scene::SetNativeId
+   */
+  void SetNativeId(int32_t nativeId);
+
+  /**
+   * @copydoc Dali::Integration::Scene::GetNativeId
+   */
+  int32_t GetNativeId() const;
+
+  /**
    * Used by the EventProcessor to emit key event signals.
    * @param[in] event The key event.
    */
@@ -443,6 +453,9 @@ private:
   // The Screen's orientation
   int32_t mScreenOrientation;
 
+  // The native window id
+  int32_t mNativeId;
+
   // The key event signal
   Integration::Scene::KeyEventSignalType          mKeyEventSignal;
   Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal;
index fdf8b4c..77d9238 100644 (file)
@@ -45,7 +45,8 @@ KeyEvent::KeyEvent()
   mDeviceName(""),
   mDeviceClass(Device::Class::NONE),
   mDeviceSubclass(Device::Subclass::NONE),
-  mIsRepeat(false)
+  mIsRepeat(false),
+  mWindowId(0)
 {
 }
 
@@ -71,7 +72,8 @@ KeyEvent::KeyEvent(const std::string&           keyName,
   mDeviceName(deviceName),
   mDeviceClass(deviceClass),
   mDeviceSubclass(deviceSubclass),
-  mIsRepeat(false)
+  mIsRepeat(false),
+  mWindowId(0)
 {
 }
 
@@ -172,6 +174,11 @@ bool KeyEvent::IsRepeat() const
   return mIsRepeat;
 }
 
+uint32_t KeyEvent::GetWindowId() const
+{
+  return mWindowId;
+}
+
 void KeyEvent::SetKeyName(const std::string& keyName)
 {
   mKeyName = keyName;
@@ -207,6 +214,11 @@ void KeyEvent::SetRepeat(const bool repeat)
   mIsRepeat = repeat;
 }
 
+void KeyEvent::SetWindowId(uint32_t windowId)
+{
+  mWindowId = windowId;
+}
+
 } // namespace Internal
 
 } // namespace Dali
index c13d23a..0954d62 100644 (file)
@@ -177,6 +177,11 @@ public:
   bool IsRepeat() const;
 
   /**
+   * @copydoc Dali::KeyEvent::GetWindowId()
+   */
+  uint32_t GetWindowId() const;
+
+  /**
    * @brief Set the name given to the key pressed
    *
    * @param[in] keyName The name given to the key pressed.
@@ -225,6 +230,14 @@ public:
    */
   void SetRepeat(const bool repeat);
 
+  /**
+   * @brief Sets window id where key event occurred.
+   *
+   * @param[in] windowId The window id where key event occurred
+   */
+  void SetWindowId(uint32_t windowId);
+
+
 private:
   /**
    * @brief Destructor.
@@ -253,6 +266,7 @@ private:
   Device::Class::Type    mDeviceClass;    ///< The class of device the key event originated from
   Device::Subclass::Type mDeviceSubclass; ///< The subclass of device the key event originated from
   bool                   mIsRepeat;       ///< Whether the key referenced by the event is a repeating key.
+  uint32_t               mWindowId;       ///< The window id where key event occurred.
 };
 
 } // namespace Internal
index 0b0d6f0..51aed87 100644 (file)
@@ -58,6 +58,7 @@ void KeyEventProcessor::ProcessKeyEvent(const Integration::KeyEvent& event)
 {
   KeyEventPtr    keyEvent(new KeyEvent(event.keyName, event.logicalKey, event.keyString, event.keyCode, event.keyModifier, event.time, static_cast<Dali::KeyEvent::State>(event.state), event.compose, event.deviceName, event.deviceClass, event.deviceSubclass));
   keyEvent->SetRepeat(event.isRepeat);
+  keyEvent->SetWindowId(event.windowId);
   Dali::KeyEvent keyEventHandle(keyEvent.Get());
 
 #ifdef TRACE_ENABLED
index 1391313..dda6e17 100644 (file)
@@ -113,6 +113,11 @@ bool KeyEvent::IsRepeat() const
   return GetImplementation(*this).IsRepeat();
 }
 
+uint32_t KeyEvent::GetWindowId() const
+{
+  return GetImplementation(*this).GetWindowId();
+}
+
 KeyEvent::KeyEvent(Internal::KeyEvent* internal)
 : BaseHandle(internal)
 {
index 024de44..1fa31e7 100644 (file)
@@ -247,6 +247,14 @@ public:
    */
   bool IsRepeat() const;
 
+  /**
+   * @brief Gets the Window Id where key event occurred.
+   *
+   * @SINCE_2_3.5
+   * @return The window id
+   */
+  uint32_t GetWindowId() const;
+
 public: // Not intended for application developers
   /// @cond internal
   /**