Merge branch 'tizen_3.0' into devel/tizen 35/150535/4 devel/tizen
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 18 Sep 2017 00:43:19 +0000 (09:43 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 21 Sep 2017 14:37:58 +0000 (23:37 +0900)
Change-Id: Ia7fb9598eaac1524b06f7fd3fcebf38f1dfab254
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
1  2 
screen_connector_provider/src/screen_connector_provider.c
screen_connector_watcher/include/screen_connector_toolkit.h
screen_connector_watcher/src/screen_connector_toolkit.c
screen_connector_watcher/src/screen_connector_watcher.c
screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h
screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c
screen_connector_watcher_evas/src/screen_connector_watcher_evas.c

@@@ -95,18 -93,12 +95,18 @@@ EXPORT_API screen_connector_provider_h 
  
        if (!__rsm) {
                LOGE("__rsm is not ready");
 -              return NULL;
 +              goto out;
        }
  
-       rsm_wrapper = wl_proxy_create_wrapper(__rsm);
-       if (!rsm_wrapper) {
-               LOGE("failed to create wl display wrapper");
+       if (!surface || !id) {
+               LOGE("invalid parameter");
 -              return NULL;
 +              goto out;
 +      }
 +
-       if (!surface || !id) {
-               LOGE("invalid parameter");
++      rsm_wrapper = wl_proxy_create_wrapper(__rsm);
++      if (!rsm_wrapper) {
++              LOGE("failed to create wl display wrapper");
 +              goto out;
        }
  
        display = ecore_wl_display_get();
@@@ -83,7 -82,11 +82,8 @@@ screen_connector_toolkit_h screen_conne
  
  int screen_connector_toolkit_bind(screen_connector_toolkit_h h, struct wl_surface *surface);
  int screen_connector_toolkit_unbind(screen_connector_toolkit_h h);
 -bool screen_connector_toolkit_is_exist(char *id,
 -              screen_connector_screen_type_e type);
 -int screen_connector_toolkit_set_changed_event_filter(
 -              screen_connector_toolkit_h h,
 -              screen_connector_changed_event_filter_type type);
 +bool screen_connector_toolkit_is_exist(const char *id, screen_connector_screen_type_e type);
++int screen_connector_toolkit_set_changed_event_filter(screen_connector_toolkit_h h, screen_connector_changed_event_filter_type type);
  
  #ifdef __cplusplus
  }
@@@ -552,4 -560,21 +559,19 @@@ EXPORT_API int screen_connector_toolkit
        return 0;
  }
  
 -
+ EXPORT_API int screen_connector_toolkit_set_changed_event_filter(
+               screen_connector_toolkit_h h,
+               screen_connector_changed_event_filter_type type)
+ {
+       if (!h || !(h->surface)) {
+               LOGE("Invalid param");
+               return -1;
+       }
+       tizen_remote_surface_set_changed_buffer_event_filter(h->surface, type);
+       h->changed_filter = type;
+       LOGD("set filter [%d] for [%s]",
+                       h->changed_filter, h->instance_id);
  
 -
+       return 0;
+ }
@@@ -76,7 -76,7 +76,6 @@@ static void __buffer_changed(void *data
        screen_connector_info_h info = (screen_connector_info_h)data;
  
        if (info && info->ops) {
--
                if (info->renderable) {
                        info->renderable = false;
                        tizen_remote_surface_set_remote_render(info->surface, 0);
@@@ -113,7 -115,11 +115,9 @@@ int screen_connector_toolkit_evas_get_r
  screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_with_win(screen_connector_toolkit_evas_ops *ops, char *id,
                screen_connector_screen_type_e type, Evas_Object *win, void *data);
  int screen_connector_toolkit_evas_is_visible(Evas_Object *obj, bool *is_visible);
 -visibility_type screen_connector_toolkit_evas_auto_visibility(
 -              screen_connector_toolkit_evas_h h);
 -int screen_connector_toolkit_evas_set_changed_event_filter(
 -              screen_connector_toolkit_evas_h toolkit_evas_h,
++visibility_type screen_connector_toolkit_evas_auto_visibility(screen_connector_toolkit_evas_h h);
++int screen_connector_toolkit_evas_set_changed_event_filter(screen_connector_toolkit_evas_h toolkit_evas_h,
+               screen_connector_evas_changed_event_filter_type type);
  
  /**
   * @}
@@@ -218,19 -332,15 +332,19 @@@ EXPORT_API int screen_connector_toolkit
  
        type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
        if (type_h == NULL) {
 -
                type_h = (screen_connector_type_evas_h)calloc(1, sizeof(struct _screen_connector_type_evas_h));
-               type_h->toolkit_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, __destroy_toolkit_evas_h);
 +              if (type_h == NULL) {
 +                      LOGE("Out of memory");
 +                      return -1;
 +              }
 +
+               g_hash_table_insert(__type_table, GINT_TO_POINTER(type), type_h);
+               type_h->toolkit_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
                if (!type_h->toolkit_table) {
                        LOGE("failed to create table");
-                       free(type_h);
                        return -1;
                }
-               g_hash_table_insert(__type_table, GINT_TO_POINTER(type), type_h);
        }
  
        type_h->viewer_win = win;
@@@ -350,7 -466,12 +470,12 @@@ static int __set_visibility(screen_conn
        if (!surface)
                return -1;
  
-       if (__delayed_resuming_time == 0) {
+       if (__delayed_resuming_time == 0 ||
 -              toolkit_evas_h->screen_type == SCREEN_CONNECTOR_SCREEEN_TYPE_WATCH) {
++              toolkit_evas_h->screen_type == SCREEN_CONNECTOR_SCREEN_TYPE_WATCH) {
+               if (obscured == TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_INVISIBLE)
+                       tizen_remote_surface_transfer_touch_cancel(surface);
+               LOGI("normal resume");
                tizen_remote_surface_transfer_visibility(surface, obscured);
  
                return 0;
@@@ -758,15 -965,12 +969,16 @@@ static void __toolkit_update_cb(struct 
        c_buf_info = g_hash_table_lookup(__cur_buffer_table, toolkit_evas_h->cur_buffer);
        if (c_buf_info == NULL) {
                c_buf_info = (cur_buffer_info_h)calloc(1, sizeof(struct _cur_buffer_info_h));
 -              c_buf_info->cur_buffer = toolkit_evas_h->cur_buffer;
 -              __cur_buffer_info_ref(c_buf_info);
 -              g_hash_table_insert(__cur_buffer_table, toolkit_evas_h->cur_buffer, c_buf_info);
 +              if (c_buf_info == NULL) {
 +                      LOGE("Out of memory");
 +              } else {
 +                      c_buf_info->cur_buffer = toolkit_evas_h->cur_buffer;
 +                      __cur_buffer_info_ref(c_buf_info);
 +                      g_hash_table_insert(__cur_buffer_table, toolkit_evas_h->cur_buffer, c_buf_info);
 +              }
        } else {
-               __cur_buffer_info_ref(c_buf_info);
+               if (!duplicate_buffer)
+                       __cur_buffer_info_ref(c_buf_info);
        }
  
        if (is_added) {
@@@ -810,6 -1016,8 +1024,8 @@@ static void __toolkit_removed_cb(const 
                return;
        }
  
 -      toolkit_table = toolkit_evas_h->type_h->toolkit_table;
++      toolkit_table = toolkit_evas_h->type_h->toolkit_table;
        if (toolkit_evas_h->img_tbm != NULL) {
                plug_id = evas_object_data_del(toolkit_evas_h->img_tbm, "___PLUGID");
                if (plug_id)
@@@ -979,7 -1194,26 +1202,25 @@@ static void __send_visibility(gpointer 
        else
                type = VISIBILITY_TYPE_UNOBSCURED;
  
 -
+       __set_window_visibility_info(toolkit_evas_h, ev->win, type);
+       type = VISIBILITY_TYPE_FULLY_OBSCURED;
+       iter = toolkit_evas_h->viewer_visibility_list;
+       while (iter != NULL) {
+               visibility_h = (viewer_visibility_h)iter->data;
+               if (visibility_h->visibility == VISIBILITY_TYPE_UNKNOWN) {
+                       LOGE("viewer not ready");
+                       return;
+               } else if (visibility_h->visibility ==
+                               VISIBILITY_TYPE_UNOBSCURED) {
+                       type = VISIBILITY_TYPE_UNOBSCURED;
+                       break;
+               }
+               iter = g_list_next(iter);
+       }
+       LOGW("set visibility to %d", type);
        ret = __set_visibility(toolkit_evas_h, type);
+       toolkit_evas_h->auto_visibility = type;
        if (ret == -1)
                LOGE("failed to set object visibility  set %p to %d", toolkit_evas_h->img_tbm, type);
  }
@@@ -76,27 -76,9 +76,28 @@@ static void __clear_img_file(img_info_
  static img_info_h __create_img_info(const char *appid, const char *instance_id, int pid)
  {
        img_info_h info = (img_info_h)calloc(1, sizeof(struct _img_info_h));
++
 +      if (info == NULL) {
 +              LOGE("Fail to calloc img info");
 +              return NULL;
 +      }
 +
        info->appid = strdup(appid);
 +      if (info->appid == NULL) {
 +              LOGE("Fail to strdup appid");
 +              free(info);
 +              return NULL;
 +      }
 +
        info->instance_id = strdup(instance_id);
 +      if (info->instance_id == NULL) {
 +              LOGE("Fail to strdup appid");
 +              free(info->appid);
 +              free(info);
 +              return NULL;
 +      }
        info->pid = pid;
 +
        return info;
  }