Change default permanent delete flag and add CloseRemoteSurface
authortaeyoon <taeyoon0.lee@samsung.com>
Tue, 13 Dec 2016 11:50:51 +0000 (20:50 +0900)
committertaeyoon <taeyoon0.lee@samsung.com>
Tue, 13 Dec 2016 11:55:50 +0000 (20:55 +0900)
Change-Id: I152abc4c15c3cb30dc6c6da63eba95f04c0144ce

internal/widget_view/widget_view_impl.cpp
internal/widget_view/widget_view_impl.h

index d08218f..a98d16b 100644 (file)
@@ -89,7 +89,7 @@ DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "activateFaultedWidget",
 
 DALI_TYPE_REGISTRATION_END()
 
 
 DALI_TYPE_REGISTRATION_END()
 
-static void OnSurfaceUpdate( struct tizen_remote_surface* surface, wl_buffer* buffer, uint32_t time, void* data )
+static void OnBufferUpdate( struct tizen_remote_surface* surface, wl_buffer* buffer, uint32_t time, void* data )
 {
   Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
 
 {
   Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
 
@@ -111,12 +111,17 @@ static void OnSurfaceUpdate( struct tizen_remote_surface* surface, wl_buffer* bu
 
 static void OnSurfaceMissing( struct tizen_remote_surface* surface, void* data )
 {
 
 static void OnSurfaceMissing( struct tizen_remote_surface* surface, void* data )
 {
-  //ToDo: WidgetDeletedSignal
+  Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
+
+  if( widgetView )
+  {
+    widgetView->CloseRemoteSurface();
+  }
 }
 
 
 static struct aul_rsm_handler_s remoteSurfaceHandler = {
 }
 
 
 static struct aul_rsm_handler_s remoteSurfaceHandler = {
-  OnSurfaceUpdate,
+  OnBufferUpdate,
   OnSurfaceMissing,
 };
 
   OnSurfaceMissing,
 };
 
@@ -143,14 +148,13 @@ WidgetView::WidgetView()
   mInstanceId(),
   mContentInfo(),
   mTitle(),
   mInstanceId(),
   mContentInfo(),
   mTitle(),
-  mBundle( NULL ),
   mWidth( 0 ),
   mHeight( 0 ),
   mPid( 0 ),
   mUpdatePeriod( 0.0 ),
   mPreviewVisible( true ),
   mStateTextVisible( true ),
   mWidth( 0 ),
   mHeight( 0 ),
   mPid( 0 ),
   mUpdatePeriod( 0.0 ),
   mPreviewVisible( true ),
   mStateTextVisible( true ),
-  mPermanentDelete( true ),
+  mPermanentDelete( false ),
   mRemoteSurface( NULL )
 {
 }
   mRemoteSurface( NULL )
 {
 }
@@ -161,14 +165,13 @@ WidgetView::WidgetView( const std::string& widgetId, const std::string& contentI
   mInstanceId(),
   mContentInfo( contentInfo ),
   mTitle(),
   mInstanceId(),
   mContentInfo( contentInfo ),
   mTitle(),
-  mBundle( NULL ),
   mWidth( width ),
   mHeight( height ),
   mPid( 0 ),
   mUpdatePeriod( updatePeriod ),
   mPreviewVisible( true ),
   mStateTextVisible( true ),
   mWidth( width ),
   mHeight( height ),
   mPid( 0 ),
   mUpdatePeriod( updatePeriod ),
   mPreviewVisible( true ),
   mStateTextVisible( true ),
-  mPermanentDelete( true ),
+  mPermanentDelete( false ),
   mRemoteSurface( NULL )
 {
 }
   mRemoteSurface( NULL )
 {
 }
@@ -184,11 +187,6 @@ WidgetView::~WidgetView()
       widget_instance_destroy( mInstanceId.c_str() );
     }
   }
       widget_instance_destroy( mInstanceId.c_str() );
     }
   }
-
-  if( mBundle )
-  {
-    bundle_free( mBundle );
-  }
 }
 
 bool WidgetView::PauseWidget()
 }
 
 bool WidgetView::PauseWidget()
@@ -772,7 +770,7 @@ void WidgetView::UpdateImageSource( tbm_surface_h source )
 
 void WidgetView::ConnectSignal( tizen_remote_surface* surface )
 {
 
 void WidgetView::ConnectSignal( tizen_remote_surface* surface )
 {
-  if( mWidgetImageView )
+  if( mWidgetImageView && surface )
   {
     mRemoteSurface = surface;
 
   {
     mRemoteSurface = surface;
 
@@ -786,7 +784,7 @@ bool WidgetView::OnTouch( Dali::Actor actor, const Dali::TouchData& event )
 {
   tizen_remote_surface_event_type type = TIZEN_REMOTE_SURFACE_EVENT_TYPE_NONE;
 
 {
   tizen_remote_surface_event_type type = TIZEN_REMOTE_SURFACE_EVENT_TYPE_NONE;
 
-  if( event.GetPointCount() == 0 )
+  if( event.GetPointCount() == 0 || mRemoteSurface == NULL )
   {
     return false;
   }
   {
     return false;
   }
@@ -843,6 +841,10 @@ bool WidgetView::OnTouch( Dali::Actor actor, const Dali::TouchData& event )
 
 bool WidgetView::OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event )
 {
 
 bool WidgetView::OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event )
 {
+  if( mRemoteSurface == NULL )
+  {
+    return false;
+  }
   //ToDo: We should check TIZEN_INPUT_DEVICE_CLAS_MOUSE
   tizen_remote_surface_transfer_mouse_wheel( mRemoteSurface,
                                              event.direction,
   //ToDo: We should check TIZEN_INPUT_DEVICE_CLAS_MOUSE
   tizen_remote_surface_transfer_mouse_wheel( mRemoteSurface,
                                              event.direction,
@@ -896,6 +898,12 @@ float WidgetView::GetWidthForHeight( float height )
   }
 }
 
   }
 }
 
+void WidgetView::CloseRemoteSurface()
+{
+  aul_rsm_viewer_unset_surface_handler( mInstanceId.c_str() );
+  mRemoteSurface = NULL;
+}
+
 } // namespace Internal
 
 } // namespace WidgetView
 } // namespace Internal
 
 } // namespace WidgetView
index 651e6b4..94669d2 100644 (file)
@@ -28,7 +28,6 @@
 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <wayland-extension/tizen-remote-surface-client-protocol.h>
 #include <tbm_surface.h>
 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <wayland-extension/tizen-remote-surface-client-protocol.h>
 #include <tbm_surface.h>
-#include <bundle.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -141,6 +140,8 @@ public: // Internal API
 
   bool OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event );
 
 
   bool OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event );
 
+  void CloseRemoteSurface();
+
 public: //Signals
 
   /**
 public: //Signals
 
   /**
@@ -247,8 +248,6 @@ private:
   std::string mContentInfo;
   std::string mTitle;
 
   std::string mContentInfo;
   std::string mTitle;
 
-  bundle* mBundle;
-
   int mWidth;
   int mHeight;
   int mPid;
   int mWidth;
   int mHeight;
   int mPid;