Release buffer before setting filter 56/146456/4
authorJunghoon Park <jh9216.park@samsung.com>
Tue, 29 Aug 2017 02:03:18 +0000 (11:03 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Fri, 1 Sep 2017 08:00:21 +0000 (08:00 +0000)
Change-Id: I3ab0c15def108efae9418dabf1728619b713d185
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
Signed-off-by: Semun Lee <semun.lee@samsung.com>
screen_connector_watcher/src/screen_connector_toolkit.c
screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c

index 66573d0..5a7e018 100644 (file)
@@ -565,7 +565,7 @@ EXPORT_API int screen_connector_toolkit_set_changed_event_filter(
                screen_connector_toolkit_h h,
                screen_connector_changed_event_filter_type type)
 {
-       if (h == NULL) {
+       if (!h || !(h->surface)) {
                LOGE("Invalid param");
                return -1;
        }
index dec5059..18606d3 100644 (file)
@@ -72,6 +72,7 @@ struct _screen_connector_toolkit_evas_h {
        bool flick;
        int prev_y;
        void *data;
+       bool blocked;
 };
 
 static GHashTable *__cur_buffer_table = NULL;
@@ -845,6 +846,17 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type,
        Ecore_Wl_Window *wl_win;
 
        toolkit_evas_h = (screen_connector_toolkit_evas_h)data;
+
+       if (toolkit_evas_h->blocked || toolkit_evas_h->bind_win_id > 0) {
+               if (tizen_remote_surface_get_version(trs)
+                               >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) {
+                       tizen_remote_surface_release(trs, tbm);
+                       g_hash_table_remove(__cur_buffer_table, tbm);
+               }
+               close(img_file_fd); /* close passed fd */
+               return;
+       }
+
        if (toolkit_evas_h->img_tbm == NULL)    {
                LOGD("first added !!!! %d, %d %s", (toolkit_evas_h->img_tbm == NULL), type, appid);
                toolkit_evas_h->img_tbm = evas_object_image_filled_add(
@@ -983,6 +995,7 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type,
                        __clear_img_file(toolkit_evas_h);
                }
        }
+
        close(img_file_fd); /* close passed fd */
 }
 
@@ -1537,7 +1550,7 @@ EXPORT_API int screen_connector_toolkit_evas_unbind(screen_connector_toolkit_eva
        }
 
        __remove_window_visibility_info(h, h->bind_win_id);
-
+       h->bind_win_id = 0;
        return screen_connector_toolkit_unbind(h->toolkit_h);
 }
 
@@ -1556,6 +1569,44 @@ EXPORT_API 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)
 {
-       return screen_connector_toolkit_set_changed_event_filter(
+       cur_buffer_info_h c_buf_info;
+       struct tizen_remote_surface *trs;
+       int ret;
+
+       ret = screen_connector_toolkit_set_changed_event_filter(
                        toolkit_evas_h->toolkit_h, type);
+
+       if (ret < 0) {
+               LOGE("failed to set changed event filter");
+               return ret;
+       }
+
+       if (type != SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_ALL &&
+                       type != SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_TBM) {
+               LOGD("filter = %d", type);
+               toolkit_evas_h->blocked = false;
+               return ret;
+       }
+
+       trs = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h);
+       if (trs) {
+               tizen_remote_surface_transfer_touch_cancel(trs);
+       } else {
+               LOGE("failed to get tizen remote surface");
+               return -1;
+       }
+
+       toolkit_evas_h->blocked = true;
+       if (toolkit_evas_h->cur_buffer) {
+               if (tizen_remote_surface_get_version(trs)
+                               >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) {
+                       c_buf_info = g_hash_table_lookup(
+                                       __cur_buffer_table,
+                                       toolkit_evas_h->cur_buffer);
+                       if (c_buf_info != NULL)
+                               __cur_buffer_info_unref(trs, c_buf_info);
+               }
+       }
+
+       return 0;
 }