Add a method to Window 25/275725/2
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 30 May 2022 08:49:36 +0000 (17:49 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 31 May 2022 04:13:06 +0000 (13:13 +0900)
Add a method to get the last key event from the Window

Change-Id: I91bdcd37308c2aebd4f3697fb4b66758022db41d

dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-impl.h

index 559d91b..dc053dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -224,6 +224,11 @@ void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent)
   GetImplementation(window).FeedKeyEvent(convertedEvent);
 }
 
+const KeyEvent& GetLastKeyEvent(Window window)
+{
+  return GetImplementation(window).GetLastKeyEvent();
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 882ee12..5c84bc4 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_WINDOW_DEVEL_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.
@@ -423,6 +423,14 @@ DALI_ADAPTOR_API void FeedWheelEvent(Window window, const Dali::WheelEvent& whee
  */
 DALI_ADAPTOR_API void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent);
 
+/**
+ * @brief Gets the last key event the window gets.
+ *
+ * @param[in] window The window instance.
+ * @return The last key event the window gets.
+ */
+DALI_ADAPTOR_API const KeyEvent& GetLastKeyEvent(Window window);
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 86dcbd0..4dc1c20 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL HEADERS
 #include <dali/devel-api/adaptor-framework/orientation.h>
+#include <dali/devel-api/events/key-event-devel.h>
 #include <dali/integration-api/core.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/public-api/actors/actor.h>
@@ -94,7 +95,8 @@ Window::Window()
   mVisibilityChangedSignal(),
   mTransitionEffectEventSignal(),
   mKeyboardRepeatSettingsChangedSignal(),
-  mAuxiliaryMessageSignal()
+  mAuxiliaryMessageSignal(),
+  mLastKeyEevent()
 {
 }
 
@@ -836,6 +838,8 @@ void Window::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
 
 void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
 {
+  mLastKeyEevent = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast<Dali::KeyEvent::State>(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass);
+
   FeedKeyEvent(keyEvent);
 }
 
@@ -1141,6 +1145,11 @@ bool Window::IsWindowRotating() const
   return mWindowSurface->IsWindowRotating();
 }
 
+const Dali::KeyEvent& Window::GetLastKeyEvent() const
+{
+  return mLastKeyEevent;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index ebf996c..9bfe3b3 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_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.
@@ -422,6 +422,11 @@ public: // Dali::Internal::Adaptor::SceneHolder
    */
   bool IsWindowRotating() const;
 
+  /**
+   * @copydoc Dali::DevelWindow::GetLastKeyEvent()
+   */
+  const Dali::KeyEvent& GetLastKeyEvent() const;
+
 private:
   /**
    * @brief Enumeration for orietation mode.
@@ -697,6 +702,8 @@ private:
   TransitionEffectEventSignalType         mTransitionEffectEventSignal;
   KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
   AuxiliaryMessageSignalType              mAuxiliaryMessageSignal;
+
+  Dali::KeyEvent mLastKeyEevent;
 };
 
 } // namespace Adaptor