[Tizen] Add methods to Window 26/275726/4
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:58:15 +0000 (13:58 +0900)
Add methods to get the last key/touch 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 0713159..ff7c519 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.
@@ -249,6 +249,16 @@ bool IsWindowRotating(Window window)
   return GetImplementation(window).IsWindowRotating();
 }
 
+const KeyEvent& GetLastKeyEvent(Window window)
+{
+  return GetImplementation(window).GetLastKeyEvent();
+}
+
+const TouchEvent& GetLastTouchEvent(Window window)
+{
+  return GetImplementation(window).GetLastTouchEvent();
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 459c289..5908132 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.
@@ -36,7 +36,6 @@ struct TouchPoint;
 
 namespace DevelWindow
 {
-
 typedef Signal<void()> EventProcessingFinishedSignalType; ///< Event Processing finished signal type
 
 typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< Key event signal type
@@ -488,6 +487,22 @@ DALI_ADAPTOR_API bool IsMinimized(Window window);
  */
 DALI_ADAPTOR_API bool IsWindowRotating(Window window);
 
+/**
+ * @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);
+
+/**
+ * @brief Gets the last touch event the window gets.
+ *
+ * @param[in] window The window instance.
+ * @return The last touch event the window gets.
+ */
+DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 2f1bd12..9cf83c9 100644 (file)
 
 // 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/integration-api/events/touch-integ.h>
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/camera-actor.h>
 #include <dali/public-api/actors/layer.h>
@@ -76,26 +78,28 @@ Window* Window::New(Any surface, const PositionSize& positionSize, const std::st
 Window::Window()
 : mWindowSurface(nullptr),
   mWindowBase(),
-  mIsTransparent(false),
-  mIsFocusAcceptable(true),
-  mIconified(false),
-  mOpaqueState(false),
-  mWindowRotationAcknowledgement(false),
-  mFocused(false),
   mParentWindow(NULL),
   mPreferredAngle(static_cast<int>(WindowOrientation::NO_ORIENTATION_PREFERENCE)),
   mRotationAngle(0),
   mWindowWidth(0),
   mWindowHeight(0),
-  mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT),
   mNativeWindowId(-1),
+  mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT),
   mDeleteRequestSignal(),
   mFocusChangeSignal(),
   mResizeSignal(),
   mVisibilityChangedSignal(),
   mTransitionEffectEventSignal(),
   mKeyboardRepeatSettingsChangedSignal(),
-  mAuxiliaryMessageSignal()
+  mAuxiliaryMessageSignal(),
+  mLastKeyEevent(),
+  mLastTouchEevent(),
+  mIsTransparent(false),
+  mIsFocusAcceptable(true),
+  mIconified(false),
+  mOpaqueState(false),
+  mWindowRotationAcknowledgement(false),
+  mFocused(false)
 {
 }
 
@@ -887,6 +891,7 @@ void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
 
 void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
 {
+  mLastTouchEevent = Dali::Integration::NewTouchEvent(timeStamp, point);
   FeedTouchPoint(point, timeStamp);
 }
 
@@ -897,6 +902,7 @@ 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);
 }
 
@@ -1202,6 +1208,16 @@ bool Window::IsWindowRotating() const
   return mWindowSurface->IsWindowRotating();
 }
 
+const Dali::KeyEvent& Window::GetLastKeyEvent() const
+{
+  return mLastKeyEevent;
+}
+
+const Dali::TouchEvent& Window::GetLastTouchEvent() const
+{
+  return mLastTouchEevent;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 12d1c7f..d2a9b77 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/adaptor-framework/window-enumerations.h>
+#include <dali/public-api/events/touch-event.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/object/property-array.h>
 #include <dali/public-api/object/ref-object.h>
@@ -89,7 +90,7 @@ public:
    * @param[in] isTransparent Whether window is transparent
    * @return A newly allocated Window
    */
-  static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className,  Dali::WindowType type, bool isTransparent = false);
+  static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent = false);
 
   /**
    * @copydoc Dali::Window::SetClass()
@@ -459,6 +460,16 @@ public: // Dali::Internal::Adaptor::SceneHolder
    */
   bool IsWindowRotating() const;
 
+  /**
+   * @copydoc Dali::DevelWindow::GetLastKeyEvent()
+   */
+  const Dali::KeyEvent& GetLastKeyEvent() const;
+
+  /**
+   * @copydoc Dali::DevelWindow::GetLastTouchEvent()
+   */
+  const Dali::TouchEvent& GetLastTouchEvent() const;
+
 private:
   /**
    * @brief Enumeration for orietation mode.
@@ -712,27 +723,19 @@ private:
   WindowBase*          mWindowBase;
   std::string          mName;
   std::string          mClassName;
-  bool                 mIsTransparent : 1;
-  bool                 mIsFocusAcceptable : 1;
-  bool                 mIconified : 1;
-  bool                 mOpaqueState : 1;
-  bool                 mWindowRotationAcknowledgement : 1;
-  bool                 mFocused : 1;
   Dali::Window         mParentWindow;
 
   OrientationPtr   mOrientation;
   std::vector<int> mAvailableAngles;
   int              mPreferredAngle;
 
-  int mRotationAngle;                    ///< The angle of the rotation
-  int mWindowWidth;                      ///< The width of the window
-  int mWindowHeight;                     ///< The height of the window
-
-  EventHandlerPtr mEventHandler;         ///< The window events handler
-
-  OrientationMode mOrientationMode;      ///< The physical screen mode is portrait or landscape
+  int mRotationAngle;  ///< The angle of the rotation
+  int mWindowWidth;    ///< The width of the window
+  int mWindowHeight;   ///< The height of the window
+  int mNativeWindowId; ///< The Native Window Id
 
-  int mNativeWindowId;                   ///< The Native Window Id
+  EventHandlerPtr mEventHandler;    ///< The window events handler
+  OrientationMode mOrientationMode; ///< The physical screen mode is portrait or landscape
 
   // Signals
   SignalType                              mDeleteRequestSignal;
@@ -743,6 +746,16 @@ private:
   KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
   AuxiliaryMessageSignalType              mAuxiliaryMessageSignal;
   AccessibilityHighlightSignalType        mAccessibilityHighlightSignal;
+
+  Dali::KeyEvent   mLastKeyEevent;
+  Dali::TouchEvent mLastTouchEevent;
+
+  bool mIsTransparent : 1;
+  bool mIsFocusAcceptable : 1;
+  bool mIconified : 1;
+  bool mOpaqueState : 1;
+  bool mWindowRotationAcknowledgement : 1;
+  bool mFocused : 1;
 };
 
 } // namespace Adaptor