From: Wonsik Jung Date: Thu, 10 Oct 2019 02:52:51 +0000 (+0900) Subject: Fix unParent and rotation bug X-Git-Tag: dali_1.4.42~4^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=5ab925567d3544c1c958f61f25de989ea8eee09a Fix unParent and rotation bug 1. unParent bug When SetParnt and unParent are called, internal Window value is not reset. To fix, the internal window value type is changed the pointer. 2. rotation bug On rotation callback function, commit resize signal with invalid width. On SetEglWindowRotation(), wl_egl_window_tizen_set_rotation is called with invalid degree. Change-Id: I7aa141c5cd1f7e3bd70a3385d02ef81035b4dc78 --- diff --git a/dali/internal/window-system/common/window-base.h b/dali/internal/window-system/common/window-base.h index 5f29f56..c0252c2 100644 --- a/dali/internal/window-system/common/window-base.h +++ b/dali/internal/window-system/common/window-base.h @@ -331,13 +331,7 @@ public: /** * @copydoc Dali::Window::SetParent() */ - virtual void SetParent( Any parent ) = 0; - - /** - * @brief Check whether the window is matched or not. - * @return The result of matched. - */ - virtual bool IsMatchedWindow( Any window ) = 0; + virtual void SetParent( WindowBase* parentWinBase ) = 0; // Signals diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 7759dad..78d820c 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -629,14 +629,14 @@ void Window::OnRotation( const RotationEvent& rotation ) SurfaceResized(); - mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mRotationAngle, mWindowHeight ) ); + mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) ); // Emit signal Dali::Window handle( this ); - mResizedSignal.Emit( Dali::Window::WindowSize( mRotationAngle, mWindowHeight ) ); - mResizeSignal.Emit( handle, Dali::Window::WindowSize( mRotationAngle, mWindowHeight ) ); + mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) ); + mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) ); - mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mRotationAngle, mWindowHeight ) ); + mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) ); } void Window::OnPause() @@ -708,20 +708,20 @@ void Window::SetParent( Dali::Window& parent ) if ( DALI_UNLIKELY( parent ) ) { mParentWindow = parent; - Dali::Window grandParent = Dali::DevelWindow::GetParent( parent ); + Dali::Window self = Dali::Window( this ); // check circular parent window setting - if ( DALI_UNLIKELY( grandParent ) && mWindowBase->IsMatchedWindow( grandParent.GetNativeHandle() ) ) + if ( Dali::DevelWindow::GetParent( parent ) == self ) { Dali::DevelWindow::Unparent( parent ); } - mWindowBase->SetParent( parent.GetNativeHandle() ); + mWindowBase->SetParent( GetImplementation( mParentWindow ).mWindowBase ); } } void Window::Unparent() { - Any parent; - mWindowBase->SetParent( parent ); + mWindowBase->SetParent( nullptr ); + mParentWindow.Reset(); } Dali::Window Window::GetParent() diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp index 5b67e26..84b9b2e 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp @@ -2132,35 +2132,15 @@ void WindowBaseEcoreWl::CreateWindow( PositionSize positionSize ) } } -void WindowBaseEcoreWl::SetParent( Any parent ) +void WindowBaseEcoreWl::SetParent( WindowBase* parentWinBase ) { - Ecore_Wl_Window* mEcoreParent; - if( parent.Empty() == false ) + Ecore_Wl_Window* ecoreParent = NULL; + if( parentWinBase ) { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( parent.GetType() == typeid (Ecore_Wl_Window *) ) && "Parent's surface type is invalid" ); - mEcoreParent = AnyCast< Ecore_Wl_Window* >( parent ); - } - else - { - mEcoreParent = NULL; - } - ecore_wl_window_parent_set( mEcoreWindow, mEcoreParent ); -} - -bool WindowBaseEcoreWl::IsMatchedWindow( Any window ) -{ - bool ret = false; - if ( window.Empty() == false ) - { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( window.GetType() == typeid (Ecore_Wl_Window *) ) && "Window's surface type is invalid" ); - if ( AnyCast< Ecore_Wl_Window* >( window ) == mEcoreWindow ) - { - ret = true; - } + WindowBaseEcoreWl* winBaseEcore = static_cast( parentWinBase ); + ecoreParent = winBaseEcore->mEcoreWindow; } - return ret; + ecore_wl_window_parent_set( mEcoreWindow, ecoreParent ); } } // namespace Adaptor diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h index 922e278..e54ab94 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h @@ -417,12 +417,7 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent() */ - virtual void SetParent( Any parent ) override; - - /** - * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow() - */ - virtual bool IsMatchedWindow( Any window ) override; + virtual void SetParent( WindowBase* parentWinBase ) override; private: diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp index 2f5cf34..dc673ea 100755 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -1248,7 +1248,7 @@ void WindowBaseEcoreWl2::SetEglWindowRotation( int angle ) } case 90: { - rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90; + rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270; break; } case 180: @@ -2187,35 +2187,15 @@ void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize ) ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL ); } -void WindowBaseEcoreWl2::SetParent( Any parent ) +void WindowBaseEcoreWl2::SetParent( WindowBase* parentWinBase ) { - Ecore_Wl2_Window* mEcoreParent; - if( parent.Empty() == false ) + Ecore_Wl2_Window* ecoreParent = NULL; + if( parentWinBase ) { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( parent.GetType() == typeid (Ecore_Wl2_Window *) ) && "Parent's surface type is invalid" ); - mEcoreParent = AnyCast< Ecore_Wl2_Window* >( parent ); - } - else - { - mEcoreParent = NULL; - } - ecore_wl2_window_parent_set( mEcoreWindow, mEcoreParent ); -} - -bool WindowBaseEcoreWl2::IsMatchedWindow( Any window ) -{ - bool ret = false; - if ( window.Empty() == false ) - { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( window.GetType() == typeid (Ecore_Wl2_Window *) ) && "Window's surface type is invalid" ); - if ( AnyCast< Ecore_Wl2_Window*>( window ) == mEcoreWindow ) - { - ret = true; - } + WindowBaseEcoreWl2* winBaseEcore2 = static_cast( parentWinBase ); + ecoreParent = winBaseEcore2->mEcoreWindow; } - return ret; + ecore_wl2_window_parent_set( mEcoreWindow, ecoreParent ); } } // namespace Adaptor diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h index 2b45ae0..885aeeb 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h @@ -422,12 +422,7 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent() */ - virtual void SetParent( Any parent ) override; - - /** - * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow() - */ - virtual bool IsMatchedWindow( Any window ) override; + virtual void SetParent( WindowBase* parentWinBase ) override; private: diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp index 0c36b1d..45a4d59 100755 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp @@ -888,48 +888,22 @@ void WindowBaseEcoreX::CreateWindow( PositionSize positionSize, bool isTranspare } } -void WindowBaseEcoreX::SetParent( Any parent ) +void WindowBaseEcoreX::SetParent( WindowBase* parentWinBase ) { - Ecore_X_Window mEcoreParent; - if ( parent.Empty() == false ) + Ecore_X_Window ecoreParent = 0; + if( parentWinBase ) { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( (parent.GetType() == typeid (Ecore_X_Window) ) ) - && "Surface type is invalid" ); - - if ( parent.GetType() == typeid (Ecore_X_Window) ) - { - mEcoreParent = AnyCast< Ecore_X_Window >( parent ); - ecore_x_icccm_transient_for_set( mEcoreWindow, mEcoreParent ); - } - else - { - mEcoreParent = 0; - ecore_x_icccm_transient_for_unset( mEcoreWindow ); - } + WindowBaseEcoreX* winBaseEcoreX = static_cast( parentWinBase ); + ecoreParent = winBaseEcoreX->mEcoreWindow; + ecore_x_icccm_transient_for_set( mEcoreWindow, ecoreParent ); } else { - mEcoreParent = 0; + ecoreParent = 0; ecore_x_icccm_transient_for_unset( mEcoreWindow ); } } -bool WindowBaseEcoreX::IsMatchedWindow( Any window ) -{ - bool ret = false; - if ( window.Empty() == false ) - { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( (window.GetType() == typeid (Ecore_X_Window) ) ) && "Surface type is invalid" ); - if ( AnyCast< Ecore_X_Window >( window ) == mEcoreWindow ) - { - ret = true; - } - } - return ret; -} - } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h index 6c99f46..031445e 100644 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h @@ -351,12 +351,7 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent() */ - virtual void SetParent( Any parent ) override; - - /** - * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow() - */ - virtual bool IsMatchedWindow( Any window ) override; + virtual void SetParent( WindowBase* parentWinBase ) override; private: diff --git a/dali/internal/window-system/windows/window-base-win.cpp b/dali/internal/window-system/windows/window-base-win.cpp index 87af139..ef1c28d 100755 --- a/dali/internal/window-system/windows/window-base-win.cpp +++ b/dali/internal/window-system/windows/window-base-win.cpp @@ -552,16 +552,11 @@ void WindowBaseWin::EventEntry( TWinEventInfo *event ) } } -void WindowBaseWin::SetParent( Any parent ) +void WindowBaseWin::SetParent( WindowBase* parentWinBase ) { } -bool WindowBaseWin::IsMatchedWindow( Any window ) -{ - return false; -} - } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/windows/window-base-win.h b/dali/internal/window-system/windows/window-base-win.h index f19fdfc..5e99156 100755 --- a/dali/internal/window-system/windows/window-base-win.h +++ b/dali/internal/window-system/windows/window-base-win.h @@ -339,12 +339,7 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent() */ - virtual void SetParent( Any parent ) override; - - /** - * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow() - */ - virtual bool IsMatchedWindow( Any window ) override; + virtual void SetParent( WindowBase* parentWinBase ) override; private: