Set RetryState When widget creation fails 34/254534/1 accepted/tizen/6.0/unified/20210304.102931 submit/tizen_6.0/20210304.074341
authortscholb <scholb.kim@samsung.com>
Tue, 2 Mar 2021 07:28:24 +0000 (16:28 +0900)
committerSunghyun Kim <scholb.kim@samsung.com>
Thu, 4 Mar 2021 07:05:58 +0000 (16:05 +0900)
when widget creation fails, the widget should be in a retry state and
can be reexcuted through the touch

Change-Id: I5a87f1249d8a1727f3143ab86ef60f222ff8c2e3

widget_viewer_dali/internal/widget_view/widget_view_impl.cpp

index db0031a1812ec61eb9af51c05cc17dfd95402083..755305e60f71ec5b3479f7072421f6f584476b17 100644 (file)
@@ -717,6 +717,11 @@ void WidgetView::SendWidgetEvent( int event )
     }
     case WIDGET_INSTANCE_EVENT_CREATE_ABORTED:
     {
+      // Set RetryState
+      DALI_LOG_ERROR("widget aborted. please re-run widget.");
+      ShowLoadingState( false );
+      ShowRetryState( true );
+      CloseRemoteSurface();
       mWidgetCreationAbortedSignal.Emit( handle );
       break;
     }
@@ -1111,6 +1116,9 @@ void WidgetView::OnInitialize()
   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 );
+
+  Self().TouchedSignal().Connect( this, &WidgetView::OnTouch );
+  Self().WheelEventSignal().Connect( this, &WidgetView::OnWheelEvent );
 }
 
 void WidgetView::OnSceneConnection( int depth )
@@ -1239,11 +1247,6 @@ bool WidgetView::OnTouch( Dali::Actor actor, const Dali::TouchEvent& event )
     return false;
   }
 
-  if( mRemoteSurface == NULL )
-  {
-    return false;
-  }
-
   Device::Class::Type deviceType = event.GetDeviceClass( 0 );
   if( deviceType == Device::Class::MOUSE )
   {
@@ -1261,6 +1264,7 @@ bool WidgetView::OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event
 {
   if( mRemoteSurface == NULL )
   {
+    DALI_LOG_ERROR("There is no RemoteSurface so it can not use WheelEvent");
     return false;
   }
   //ToDo: We should check TIZEN_INPUT_DEVICE_CLAS_MOUSE
@@ -1279,6 +1283,7 @@ bool WidgetView::OnKeyEvent( const Dali::KeyEvent& event )
 {
   if( mRemoteSurface == NULL )
   {
+    DALI_LOG_ERROR("There is no RemoteSurface so it can not use KeyEvent");
     return false;
   }
 
@@ -1526,8 +1531,9 @@ float WidgetView::TextPixelToPointSize( int pixelSize )
 void WidgetView::MouseIn( const Dali::TouchEvent& event )
 {
   Vector2 localPos = event.GetLocalPosition( 0 );
-
-  tizen_remote_surface_transfer_mouse_event( mRemoteSurface,
+  if( mRemoteSurface )
+  {
+    tizen_remote_surface_transfer_mouse_event( mRemoteSurface,
                                              TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_IN,
                                              0,
                                              0,
@@ -1542,11 +1548,14 @@ void WidgetView::MouseIn( const Dali::TouchEvent& event )
                                              "",
                                              event.GetTime()
                                            );
+  }
 }
 
 void WidgetView::MouseOut( const Dali::TouchEvent& event )
 {
-  tizen_remote_surface_transfer_mouse_event( mRemoteSurface,
+  if( mRemoteSurface )
+  {
+    tizen_remote_surface_transfer_mouse_event( mRemoteSurface,
                                              TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_OUT,
                                              0,
                                              0,
@@ -1561,6 +1570,7 @@ void WidgetView::MouseOut( const Dali::TouchEvent& event )
                                              "",
                                              event.GetTime()
                                            );
+  }
 }
 
 bool WidgetView::MouseEvent( const Dali::TouchEvent& event )
@@ -1601,6 +1611,12 @@ bool WidgetView::MouseEvent( const Dali::TouchEvent& event )
     }
   }
 
+  if( mRemoteSurface == NULL )
+  {
+    DALI_LOG_ERROR("There is no RemoteSurface so it can not use MouseEvent");
+    return false;
+  }
+
   Vector2 localPos = event.GetLocalPosition( 0 );
 
   tizen_remote_surface_transfer_mouse_event( mRemoteSurface,
@@ -1670,6 +1686,12 @@ bool WidgetView::TouchEvent( const Dali::TouchEvent& event )
     }
   }
 
+  if( mRemoteSurface == NULL )
+  {
+    DALI_LOG_ERROR("There is no RemoteSurface so it can not use TouchEvent");
+    return false;
+  }
+
   Vector2 localPos = event.GetLocalPosition( 0 );
 
   tizen_remote_surface_transfer_touch_event( mRemoteSurface,
@@ -1697,7 +1719,6 @@ void WidgetView::UpdateBuffer( struct tizen_remote_surface *surface, struct wl_b
     tizen_remote_surface_transfer_visibility( surface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
 
     CreateWidgetRenderer();
-    ConnectSignal( surface );
   }
 
   if( !buffer )