From 2e3ec621b8263bdadcb89b028a85c6a7d87b6d7e Mon Sep 17 00:00:00 2001 From: Sunghyun kim Date: Mon, 26 Aug 2019 19:50:36 +0900 Subject: [PATCH] Deprecate signal and add new signal for window Dali need to check which window is focused. So deprecate FocusChangedSignal and add new Signal for focus. and ResizeSignal is also changed for the same reason Change-Id: I463150de7889dbac87926c972a5991d37f79925c --- dali/devel-api/adaptor-framework/window-devel.cpp | 4 +++ dali/devel-api/adaptor-framework/window-devel.h | 8 +++++ dali/internal/window-system/common/window-impl.cpp | 13 +++++-- dali/internal/window-system/common/window-impl.h | 14 ++++++-- dali/public-api/adaptor-framework/window.cpp | 12 +++++++ dali/public-api/adaptor-framework/window.h | 42 +++++++++++++++++++--- 6 files changed, 84 insertions(+), 9 deletions(-) diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index 5057f14..9d93348 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -80,6 +80,10 @@ Window GetParent( Window window ) return GetImplementation( window ).GetParent(); } +Window DownCast( BaseHandle handle ) +{ + return Window( dynamic_cast( handle.GetObjectPtr()) ); +} } // 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 a7baa89..ca90c51 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -142,6 +142,14 @@ DALI_ADAPTOR_API void Unparent( Window window ); */ DALI_ADAPTOR_API Window GetParent( Window window ); +/** + * @brief Downcast sceneHolder to window + * + * @param[in] handle The handle need to downcast + * @return The window cast from SceneHolder + */ +DALI_ADAPTOR_API Window DownCast( BaseHandle handle ); + } // 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 4411ffa..7759dad 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -84,7 +84,9 @@ Window::Window() mWindowHeight( 0 ), mFocusChangedSignal(), mResizedSignal(), - mDeleteRequestSignal() + mDeleteRequestSignal(), + mFocusChangeSignal(), + mResizeSignal() { } @@ -456,7 +458,9 @@ void Window::SetSize( Dali::Window::WindowSize size ) mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize ); + Dali::Window handle( this ); mResizedSignal.Emit( newSize ); + mResizeSignal.Emit( handle, newSize ); mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize ); } @@ -512,8 +516,9 @@ void Window::SetPositionSize( PositionSize positionSize ) mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize ); + Dali::Window handle( this ); mResizedSignal.Emit( newSize ); - + mResizeSignal.Emit( handle, newSize ); mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize ); } } @@ -578,7 +583,9 @@ void Window::OnIconifyChanged( bool iconified ) void Window::OnFocusChanged( bool focusIn ) { + Dali::Window handle( this ); mFocusChangedSignal.Emit( focusIn ); + mFocusChangeSignal.Emit( handle, focusIn ); } void Window::OnOutputTransformed() @@ -625,7 +632,9 @@ void Window::OnRotation( const RotationEvent& rotation ) mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mRotationAngle, mWindowHeight ) ); // Emit signal + Dali::Window handle( this ); mResizedSignal.Emit( Dali::Window::WindowSize( mRotationAngle, mWindowHeight ) ); + mResizeSignal.Emit( handle, Dali::Window::WindowSize( mRotationAngle, mWindowHeight ) ); mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mRotationAngle, mWindowHeight ) ); } diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index ea4f24a..bebb11b 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -65,6 +65,8 @@ public: typedef Dali::Window::IndicatorSignalType IndicatorSignalType; typedef Dali::Window::FocusSignalType FocusSignalType; typedef Dali::Window::ResizedSignalType ResizedSignalType; + typedef Dali::Window::FocusChangeSignalType FocusChangeSignalType; + typedef Dali::Window::ResizeSignalType ResizeSignalType; typedef Signal< void () > SignalType; /** @@ -460,9 +462,17 @@ public: // Signals FocusSignalType& FocusChangedSignal() { return mFocusChangedSignal; } /** + * @copydoc Dali::Window::WindowFocusChangedSignal() + */ + FocusChangeSignalType& FocusChangeSignal() { return mFocusChangeSignal; } + /** * @copydoc Dali::Window::ResizedSignal() */ ResizedSignalType& ResizedSignal() { return mResizedSignal; } + /** + * @copydoc Dali::Window::ResizedSignal() + */ + ResizeSignalType& ResizeSignal() { return mResizeSignal; } /** * This signal is emitted when the window is requesting to be deleted @@ -503,8 +513,8 @@ private: FocusSignalType mFocusChangedSignal; ResizedSignalType mResizedSignal; SignalType mDeleteRequestSignal; - - + FocusChangeSignalType mFocusChangeSignal; + ResizeSignalType mResizeSignal; }; } // namespace Adaptor diff --git a/dali/public-api/adaptor-framework/window.cpp b/dali/public-api/adaptor-framework/window.cpp index 07ff286..14e8c04 100644 --- a/dali/public-api/adaptor-framework/window.cpp +++ b/dali/public-api/adaptor-framework/window.cpp @@ -189,9 +189,15 @@ Any Window::GetNativeHandle() const Window::FocusSignalType& Window::FocusChangedSignal() { + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: FocusChangedSignal is deprecated and will be removed from next release.\n" ); return GetImplementation(*this).FocusChangedSignal(); } +Window::FocusChangeSignalType& Window::FocusChangeSignal() +{ + return GetImplementation(*this).FocusChangeSignal(); +} + void Window::SetAcceptFocus( bool accept ) { GetImplementation(*this).SetAcceptFocus( accept ); @@ -309,9 +315,15 @@ int Window::GetBrightness() const Window::ResizedSignalType& Window::ResizedSignal() { + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ResizedSignal is deprecated and will be removed from next release.\n" ); return GetImplementation(*this).ResizedSignal(); } +Window::ResizeSignalType& Window::ResizeSignal() +{ + return GetImplementation(*this).ResizeSignal(); +} + void Window::SetSize( Window::WindowSize size ) { GetImplementation(*this).SetSize( size ); diff --git a/dali/public-api/adaptor-framework/window.h b/dali/public-api/adaptor-framework/window.h index 0d559c1..fe28f45 100755 --- a/dali/public-api/adaptor-framework/window.h +++ b/dali/public-api/adaptor-framework/window.h @@ -68,9 +68,10 @@ public: typedef Uint16Pair WindowPosition; ///< Window position type @SINCE_1_2.60 typedef Signal< void (bool) > IndicatorSignalType; ///< @DEPRECATED_1_4.9 @brief Indicator state signal type @SINCE_1_0.0 - typedef Signal< void (bool) > FocusSignalType; ///< Window focus signal type @SINCE_1_2.60 - typedef Signal< void (WindowSize) > ResizedSignalType; ///< Window resized signal type @SINCE_1_2.60 - + typedef Signal< void (bool) > FocusSignalType; ///< @DEPRECATED_1_4.35 @brief Window focus signal type @SINCE_1_2.60 + typedef Signal< void (WindowSize) > ResizedSignalType; ///< @DEPRECATED_1_4.35 @brief Window resized signal type @SINCE_1_2.60 + typedef Signal< void (Window,bool) > FocusChangeSignalType; ///< Window focus signal type @SINCE_1_4.35 + typedef Signal< void (Window,WindowSize) > ResizeSignalType; ///< Window resized signal type @SINCE_1_4.35 public: // Enumerations @@ -637,6 +638,7 @@ public: // Signals IndicatorSignalType& IndicatorVisibilityChangedSignal() DALI_DEPRECATED_API; /** + * @DEPRECATED_1_4.35 * @brief The user should connect to this signal to get a timing when window gains focus or loses focus. * * A callback of the following type may be connected: @@ -648,7 +650,7 @@ public: // Signals * @SINCE_1_2.60 * @return The signal to connect to */ - FocusSignalType& FocusChangedSignal(); + FocusSignalType& FocusChangedSignal() DALI_DEPRECATED_API; /** * @brief This signal is emitted when the window is resized. @@ -662,7 +664,37 @@ public: // Signals * @SINCE_1_2.60 * @return The signal to connect to */ - ResizedSignalType& ResizedSignal(); + ResizedSignalType& ResizedSignal() DALI_DEPRECATED_API; + + /** + * @brief The user should connect to this signal to get a timing when window gains focus or loses focus. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName( Window window, bool focusIn ); + * @endcode + * The parameter is true if window gains focus, otherwise false. + * and window means this signal was called from what window + * + * @SINCE_1_4.35 + * @return The signal to connect to + */ + FocusChangeSignalType& FocusChangeSignal(); + + /** + * @brief This signal is emitted when the window is resized. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName( Window window, int width, int height ); + * @endcode + * The parameters are the resized width and height. + * and window means this signal was called from what window + * + * @SINCE_1_4.35 + * @return The signal to connect to + */ + ResizeSignalType& ResizeSignal(); public: // Not intended for application developers /// @cond internal -- 2.7.4