From: Eunki, Hong Date: Fri, 23 Aug 2024 01:55:10 +0000 (+0900) Subject: [tizen_9.0] Use InheritedVisibilityChanged signal instead of window visibility X-Git-Tag: accepted/tizen/unified/20240909.154227^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified_dev;p=platform%2Fcore%2Fuifw%2Fwidget-viewer-dali.git [tizen_9.0] Use InheritedVisibilityChanged signal instead of window visibility Let we use InheritedVisibilityChanged signal for check the widget's visibility. It could pause widget if widget view's parent is invisible, not only for the window. Change-Id: I81ef10ddcce389e5ba1ee266d697d90a07108ed3 Signed-off-by: Eunki, Hong --- diff --git a/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp b/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp index c993ef2..c1258cb 100644 --- a/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp +++ b/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp @@ -235,7 +235,7 @@ WidgetView::WidgetView() mResizeRequired( false ), mPaused( false ), mPausedManually( false ), - mWindowVisible( true ), + mWidgetVisible( false ), mPreviewEnable( true ), mKeepWidgetSize(false), mIsReadyToRender(false) @@ -263,7 +263,7 @@ WidgetView::WidgetView( const std::string& widgetId, const std::string& contentI mResizeRequired( false ), mPaused( false ), mPausedManually( false ), - mWindowVisible( true ), + mWidgetVisible( false ), mPreviewEnable( true ), mKeepWidgetSize(false), mIsReadyToRender(false) @@ -403,6 +403,7 @@ void WidgetView::InitializeEvents() auto self = Self(); self.TouchedSignal().Connect( this, &WidgetView::OnTouch ); self.WheelEventSignal().Connect( this, &WidgetView::OnWheelEvent ); + self.InheritedVisibilityChangedSignal().Connect( this, &WidgetView::OnInheritedVisibilityChanged ); // Accessibility self.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::FILLER); @@ -802,8 +803,7 @@ void WidgetView::SendWidgetEvent( int event ) case WIDGET_INSTANCE_EVENT_RESUME: { // Call Resume/Pause for reloading - bool needPaused = IsOutOfScreen(); - if( mWindowVisible && !needPaused) + if( mWidgetVisible && !IsOutOfScreen()) { ResumeWidgetInternally(); } @@ -1143,53 +1143,42 @@ Dali::Toolkit::DevelControl::ControlAccessible* WidgetView::CreateAccessibleObje void WidgetView::OnSceneConnection( int depth ) { - Control::OnSceneConnection( depth ); - Window window = DevelWindow::Get( Self() ); - if( window ) - { - DevelWindow::VisibilityChangedSignal( window ).Connect( this, &WidgetView::OnWindowVisibilityChanged ); + // Add Notification for check WidgetView is out-of-screen or not. + auto self = Self(); + mPositionUpdateNotification = self.AddPropertyNotification( Actor::Property::WORLD_POSITION, StepCondition( 1.0f, 1.0f ) ); + mPositionUpdateNotification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED ); + mSizeUpdateNotification = self.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ) ); + mSizeUpdateNotification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED ); + mScaleUpdateNotification = self.AddPropertyNotification( Actor::Property::WORLD_SCALE, StepCondition( 0.1f, 1.0f ) ); + mScaleUpdateNotification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED ); - // Add Notification for check WidgetView is out-of-screen or not. - auto self = Self(); - mPositionUpdateNotification = self.AddPropertyNotification( Actor::Property::WORLD_POSITION, StepCondition( 1.0f, 1.0f ) ); - mPositionUpdateNotification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED ); - mSizeUpdateNotification = self.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ) ); - mSizeUpdateNotification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED ); - mScaleUpdateNotification = self.AddPropertyNotification( Actor::Property::WORLD_SCALE, StepCondition( 0.1f, 1.0f ) ); - mScaleUpdateNotification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED ); + mPositionUpdateNotification.NotifySignal().Connect( this, &WidgetView::OnUpdateArea ); + mSizeUpdateNotification.NotifySignal().Connect( this, &WidgetView::OnUpdateArea ); + mScaleUpdateNotification.NotifySignal().Connect( this, &WidgetView::OnUpdateArea ); - mPositionUpdateNotification.NotifySignal().Connect( this, &WidgetView::OnUpdateArea ); - mSizeUpdateNotification.NotifySignal().Connect( this, &WidgetView::OnUpdateArea ); - mScaleUpdateNotification.NotifySignal().Connect( this, &WidgetView::OnUpdateArea ); - } + Control::OnSceneConnection( depth ); } void WidgetView::OnSceneDisconnection() { + Self().RemovePropertyNotification( mPositionUpdateNotification ); + Self().RemovePropertyNotification( mSizeUpdateNotification ); + Self().RemovePropertyNotification( mScaleUpdateNotification ); Control::OnSceneDisconnection(); - Window window = DevelWindow::Get( Self() ); - if( window ) - { - DevelWindow::VisibilityChangedSignal( window ).Disconnect( this, &WidgetView::OnWindowVisibilityChanged ); - - Self().RemovePropertyNotification( mPositionUpdateNotification ); - Self().RemovePropertyNotification( mSizeUpdateNotification ); - Self().RemovePropertyNotification( mScaleUpdateNotification ); - } } -void WidgetView::OnWindowVisibilityChanged( Window window, bool visible ) +void WidgetView::OnInheritedVisibilityChanged( Actor actor, bool isVisible ) { - mWindowVisible = visible; - bool needPaused = IsOutOfScreen(); + mWidgetVisible = isVisible; if( mPausedManually ) { - mPaused = ( needPaused || !mWindowVisible ); + mPaused = ( !mWidgetVisible || IsOutOfScreen()); DALI_LOG_RELEASE_INFO("Do not resume widget, because widget is paued manually [%p]\n", this); return; } - if( mWindowVisible && !needPaused) + const bool needPaused = IsOutOfScreen(); + if( mWidgetVisible && !needPaused) { ResumeWidgetInternally(); } @@ -1197,7 +1186,7 @@ void WidgetView::OnWindowVisibilityChanged( Window window, bool visible ) { PauseWidgetInternally(); } - DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnWindowVisibilityChanged: visibility is changed (visible: %d) [%p]\n", visible, this ); + DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInheritedVisibilityChanged: visibility is changed (visible: %d) [%p]\n", visible, this ); } void WidgetView::OnUpdateArea( Dali::PropertyNotification& source ) diff --git a/widget_viewer_dali/internal/widget_view/widget_view_impl.h b/widget_viewer_dali/internal/widget_view/widget_view_impl.h index 3599566..393dad1 100644 --- a/widget_viewer_dali/internal/widget_view/widget_view_impl.h +++ b/widget_viewer_dali/internal/widget_view/widget_view_impl.h @@ -508,9 +508,9 @@ private: void ResizeWidget(int width, int height); /** - * @brief Callback when the visibility of the window is changed. + * @brief Callback when the inherited visibility of the widget is changed. */ - void OnWindowVisibilityChanged( Window window, bool visible ); + void OnInheritedVisibilityChanged( Actor actor, bool visible ); /** * @brief Callback when the actor area is changed @@ -585,7 +585,7 @@ private: bool mResizeRequired; ///< Check whether widget instance need to resize. bool mPaused; ///< Check whether widget is paused or not bool mPausedManually; ///< Check whether widget is paused or not by application - bool mWindowVisible; ///< Check whether window is visible or not + bool mWidgetVisible; ///< Check whether widget is really visible or not (on scene + visible + window visible) bool mPreviewEnable; ///< Check whether preview is enable or not bool mKeepWidgetSize; ///< Check whether widget instance keep it's size or not bool mIsReadyToRender; ///< Check whether widget is ready to render or not