Refactor screen-connector
authorHyunho Kang <hhstark.kang@samsung.com>
Wed, 22 Feb 2017 05:55:45 +0000 (14:55 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 9 Mar 2017 01:49:19 +0000 (10:49 +0900)
https://review.tizen.org/gerrit/#/c/115600/

Change-Id: I73295dae794ac0289eed9423de54830ed2c1e3b6
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
internal/widget_view/widget_view_impl.cpp
internal/widget_view/widget_view_impl.h
internal/widget_view_manager/widget_view_manager_impl.cpp

index 6013c30..b14fb19 100644 (file)
@@ -91,8 +91,9 @@ DALI_TYPE_REGISTRATION_END()
 
 struct wl_buffer* preBuffer;
 
-static void OnBufferChanged( struct tizen_remote_surface *surface, uint32_t type, struct wl_buffer *buffer,
-                              int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct wl_array *keys, void *data)
+static void OnBufferUpdated( struct tizen_remote_surface *surface, uint32_t type, struct wl_buffer *buffer,
+                              int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct wl_array *keys,
+                              const char *appid, const char *instance_id, const int pid, void *data)
 {
   Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
 
@@ -121,34 +122,11 @@ static void OnBufferChanged( struct tizen_remote_surface *surface, uint32_t type
   close( img_file_fd );
 }
 
-static void OnBufferUpdated( struct tizen_remote_surface* surface, wl_buffer* buffer, uint32_t time, void* data )
+static void OnBufferAdded( const char *appid, const char *instance_id, const int pid, void *data )
 {
-  Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
-
-  if( widgetView )
-  {
-    if( !widgetView->IsWidgetImageView() )
-    {
-      tizen_remote_surface_transfer_visibility( surface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
-
-      widgetView->CreateWidgetImageView();
-      widgetView->ConnectSignal( surface );
-    }
-
-    //get tbm surface from buffer
-    tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
-    widgetView->UpdateImageSource( tbmSurface );
-  }
-
-  if( preBuffer != NULL && tizen_remote_surface_get_version( surface ) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION )
-  {
-    tizen_remote_surface_release( surface, preBuffer );
-  }
-
-  preBuffer = buffer;
 }
 
-static void OnSurfaceMissing( struct tizen_remote_surface* surface, void* data )
+static void OnSurfaceRemoved( const char *appid, const char *instance_id, const int pid, void *data )
 {
   Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
 
@@ -703,7 +681,7 @@ void WidgetView::OnInitialize()
   char* previewPath = NULL;
   std::string previewImage;
   widget_size_type_e sizeType;
-  screen_connector_watcher_ops ops;
+  screen_connector_toolkit_ops ops;
 
   int ret = widget_instance_create( mWidgetId.c_str(), &instanceId );
   if( ret < 0 || !instanceId )
@@ -773,10 +751,10 @@ void WidgetView::OnInitialize()
     return;
   }
 
-  ops.change_cb = OnBufferChanged;
-  ops.missing_cb = OnSurfaceMissing;
-  ops.update_cb = OnBufferUpdated;
-  mWatcherHandle = screen_connector_watcher_add(&ops, (char *)mWidgetId.c_str(), this);
+  ops.updated_cb = OnBufferUpdated;
+  ops.removed_cb = OnSurfaceRemoved;
+  ops.added_cb = OnBufferAdded;
+  mWatcherHandle = screen_connector_toolkit_add(&ops, (char *)instanceId, SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET, this);
   DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_launch is called. [%s, mPid = %d]\n", mWidgetId.c_str(), mPid );
 
 }
@@ -942,7 +920,7 @@ float WidgetView::GetWidthForHeight( float height )
 
 void WidgetView::CloseRemoteSurface()
 {
-  screen_connector_watcher_remove( mWatcherHandle );
+  screen_connector_toolkit_remove( mWatcherHandle );
   mRemoteSurface = NULL;
 }
 
index a9eaf7c..006bdee 100644 (file)
@@ -28,7 +28,7 @@
 #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 <screen_connector_watcher.h>
+#include <screen_connector_toolkit.h>
 
 namespace Dali
 {
@@ -257,7 +257,7 @@ private:
   bool mPreviewVisible;
   bool mStateTextVisible;
   bool mPermanentDelete;
-  screen_connector_watcher_h mWatcherHandle;
+  screen_connector_toolkit_h mWatcherHandle;
   tizen_remote_surface* mRemoteSurface;
 
   // Signals
index 714bdb6..0d12e7e 100644 (file)
@@ -32,7 +32,7 @@
 #include <unistd.h>
 #include <widget_errno.h>
 #include <widget_instance.h>
-#include <screen_connector_watcher.h>
+#include <screen_connector_toolkit.h>
 
 namespace Dali
 {
@@ -147,7 +147,7 @@ WidgetViewManager::WidgetViewManager()
 
 WidgetViewManager::~WidgetViewManager()
 {
-  screen_connector_watcher_fini();
+  screen_connector_toolkit_fini(SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET);
   widget_instance_unlisten_event( WidgetViewManager::WidgetEventCallback );
   widget_instance_fini();
 }
@@ -167,7 +167,7 @@ int WidgetViewManager::Initialize( Application application, const std::string& n
   }
 
   // Binds tizen remote surface manager & connects callback
-  if( screen_connector_watcher_init() < 0 )
+  if( screen_connector_toolkit_init(SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET) < 0 )
   {
     return WIDGET_ERROR_FAULT;
   }