From fc597783f4c80e31775723641150853e91a6e12d Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Thu, 2 Jun 2022 16:29:20 +0900 Subject: [PATCH] [Tizen] Add methods to Window --- dali/devel-api/adaptor-framework/window-devel.cpp | 12 +++++- dali/devel-api/adaptor-framework/window-devel.h | 19 +++++++++- dali/internal/window-system/common/window-impl.cpp | 32 ++++++++++++---- dali/internal/window-system/common/window-impl.h | 43 ++++++++++++++-------- 4 files changed, 80 insertions(+), 26 deletions(-) diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index 0713159..ff7c519 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -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 diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index 459c289..5908132 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -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 EventProcessingFinishedSignalType; ///< Event Processing finished signal type typedef Signal 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 diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 3d7dd3a..b4aca26 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -20,8 +20,10 @@ // EXTERNAL HEADERS #include +#include #include #include +#include #include #include #include @@ -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(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(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass); FeedKeyEvent(keyEvent); } @@ -1209,6 +1215,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 diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 12d1c7f..d2a9b77 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include #include @@ -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 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 -- 2.7.4