mBuffer( NULL ),
mReloadFlag( false ),
mCreated( false ),
- mResizeRequired( false )
+ mResizeRequired( false ),
+ mCulled( false ),
+ mPausedManually( false )
{
}
mBuffer( NULL ),
mReloadFlag( false ),
mCreated( false ),
- mResizeRequired( false )
+ mResizeRequired( false ),
+ mCulled( false ),
+ mPausedManually( false )
{
}
}
bool WidgetView::PauseWidget()
+{
+ mPausedManually = true;
+ return PauseWidgetInternally();
+}
+
+bool WidgetView::ResumeWidget()
+{
+ mPausedManually = false;
+ return ResumeWidgetInternally();
+}
+
+bool WidgetView::PauseWidgetInternally()
{
int ret = widget_instance_pause( mInstanceId.c_str() );
if( ret < 0 )
return true;
}
-bool WidgetView::ResumeWidget()
+bool WidgetView::ResumeWidgetInternally()
{
int ret = widget_instance_resume( mInstanceId.c_str() );
if( ret < 0 )
mCreated = false;
mResizeRequired = false;
+ mPausedManually = false;
+
+ Self().RemovePropertyNotification( mViewCulledNotification );
+
return true;
}
return;
}
+ // Add Notification for check WidgetView is culled or not.
+ mViewCulledNotification = Self().AddPropertyNotification( Actor::Property::CULLED, LessThanCondition( 0.5f ) );
+ mViewCulledNotification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED );
+ mViewCulledNotification.NotifySignal().Connect( this, &WidgetView::OnChangeCulled );
+
ops.updated_cb = OnBufferUpdated;
ops.removed_cb = OnSurfaceRemoved;
ops.added_cb = OnBufferAdded;
mWatcherHandle = screen_connector_toolkit_add(&ops, (char *)instanceId, SCREEN_CONNECTOR_SCREEN_TYPE_WIDGET, this);
DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_launch is called. [%s, mPid = %d]\n", mWidgetId.c_str(), mPid );
widget_service_set_lifecycle_event_cb( mWidgetId.c_str(), WidgetLifeCycleCallback, this );
+
}
void WidgetView::OnSceneConnection( int depth )
DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnWindowVisibilityChanged: visibility is changed (visible: %d)\n", visible );
}
+void WidgetView::OnChangeCulled( Dali::PropertyNotification& source )
+{
+ bool isCulled = Self().GetProperty( Actor::Property::CULLED ).Get< bool >();
+
+ if( mPausedManually )
+ {
+ mCulled = isCulled;
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "Do not resume widget, because widget is paued manually \n");
+ return;
+ }
+
+ if( mCulled != isCulled )
+ {
+ if( isCulled )
+ {
+ PauseWidgetInternally();
+ }
+ else
+ {
+ ResumeWidgetInternally();
+ }
+ mCulled = isCulled;
+ }
+}
+
void WidgetView::OnSizeSet( const Vector3& targetSize )
{
}
#include <tbm_surface.h>
#include <screen_connector_toolkit.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/public-api/object/property-notification.h>
namespace Dali
{
virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize ) override ;
private:
+ /**
+ * @brief Call a PauseWidget internally
+ */
+ bool PauseWidgetInternally();
+
+ /**
+ * @brief Call a ResumeWidget internally
+ */
+ bool ResumeWidgetInternally();
+
/**
* @brief Callback when the visibility of the window is changed.
*/
void OnWindowVisibilityChanged( Window window, bool visible );
+ /**
+ * @brief Callback when the actor is out of the view frustum.
+ */
+ void OnChangeCulled( Dali::PropertyNotification& source );
+
// Undefined
WidgetView( const WidgetView& );
bool mReloadFlag;
bool mCreated;
bool mResizeRequired;
+ bool mCulled;
+ bool mPausedManually;
Dali::Property::Map mEffectPropertyMap;
+ Dali::PropertyNotification mViewCulledNotification;
// Signals
Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetAddedSignal;