summaryrefslogtreecommitdiff
path: root/screen_connector_watcher_evas
diff options
context:
space:
mode:
authorHyunho Kang <hhstark.kang@samsung.com>2017-01-24 11:59:16 +0900
committerHyunho Kang <hhstark.kang@samsung.com>2017-01-24 12:57:04 +0900
commitbeef22b1e1617335ced16bbcbf67f6d57b74f137 (patch)
tree9f704287ccc62955b5278185f598aadcaf49bf33 /screen_connector_watcher_evas
parentb615969580f1a1919b47fcb86f7d0ee4ecedc610 (diff)
downloadscreen-connector-beef22b1e1617335ced16bbcbf67f6d57b74f137.tar.gz
screen-connector-beef22b1e1617335ced16bbcbf67f6d57b74f137.tar.bz2
screen-connector-beef22b1e1617335ced16bbcbf67f6d57b74f137.zip
Change-Id: I8bb5c15ea0a247c33e9450698d0529926a1a0f86 Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
Diffstat (limited to 'screen_connector_watcher_evas')
-rw-r--r--screen_connector_watcher_evas/src/screen_connector_watcher_evas.c59
1 files changed, 50 insertions, 9 deletions
diff --git a/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c b/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c
index a690fff..f9774f5 100644
--- a/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c
+++ b/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c
@@ -41,6 +41,7 @@ struct _screen_connector_watcher_evas_h {
bool cancel_touch;
Evas_Object *img_tbm;
Evas_Object *img_file;
+ uint32_t img_type;
struct wl_buffer *pre_buffer;
void *data;
};
@@ -55,6 +56,7 @@ static void __destroy_watcher_evas_handle(screen_connector_watcher_evas_h h)
return;
free(h->ops);
free(h);
+ h = NULL;
}
EXPORT_API int screen_connector_watcher_evas_init(Evas_Object *win)
@@ -296,6 +298,25 @@ static void __rs_cb_resize(void *data, Evas *e, Evas_Object *obj, void *event_in
__obj_update_visibility(data, e, obj, event_info);
}
+static void __clear_img_tbm(screen_connector_watcher_evas_h watcher_evas_h)
+{
+ if (watcher_evas_h->img_tbm == NULL)
+ return;
+
+ g_hash_table_remove(__watcher_tbl, watcher_evas_h->img_tbm);
+ evas_object_del(watcher_evas_h->img_tbm);
+ watcher_evas_h->img_tbm = NULL;
+}
+
+static void __clear_img_file(screen_connector_watcher_evas_h watcher_evas_h)
+{
+ if (watcher_evas_h->img_file == NULL)
+ return;
+
+ evas_object_del(watcher_evas_h->img_file);
+ watcher_evas_h->img_file = NULL;
+}
+
static void __watcher_change_cb(struct tizen_remote_surface *trs, uint32_t type, struct wl_buffer *tbm,
int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct wl_array *keys, void *data)
{
@@ -352,9 +373,11 @@ static void __watcher_change_cb(struct tizen_remote_surface *trs, uint32_t type,
evas_object_data_set(watcher_evas_h->img_tbm, "___PLUGID", strdup(plug_id));
evas_object_event_callback_add(watcher_evas_h->img_tbm,
EVAS_CALLBACK_MOVE, __obj_update_visibility, watcher_evas_h);
+ }
+ if (watcher_evas_h->img_type != type)
is_added = true;
- }
+ watcher_evas_h->img_type = type;
/* check type of given buffer */
if (type == TIZEN_REMOTE_SURFACE_BUFFER_TYPE_TBM) {
@@ -382,7 +405,6 @@ static void __watcher_change_cb(struct tizen_remote_surface *trs, uint32_t type,
evas_object_image_fill_set(watcher_evas_h->img_file, 0, 0, width, height);
evas_object_resize(watcher_evas_h->img_file, width, height);
munmap(map, img_file_size);
- close(img_file_fd); /* close passed fd */
evas_object_image_native_surface_set(watcher_evas_h->img_tbm, NULL); /* set null to previous object for the tbm type */
}
@@ -394,14 +416,29 @@ static void __watcher_change_cb(struct tizen_remote_surface *trs, uint32_t type,
watcher_evas_h->pre_buffer = tbm;
if (is_added) {
- LOGD("call added !!!! %s", appid);
- watcher_evas_h->ops->added(appid, watcher_evas_h->img_tbm,
- watcher_evas_h->data);
+ LOGD("call added !!!! %s, type %d", appid, type);
+ if (type == TIZEN_REMOTE_SURFACE_BUFFER_TYPE_IMAGE_FILE) {
+ watcher_evas_h->ops->added(appid, watcher_evas_h->img_file,
+ watcher_evas_h->data);
+ __clear_img_tbm(watcher_evas_h);
+ } else {
+ watcher_evas_h->ops->added(appid, watcher_evas_h->img_tbm,
+ watcher_evas_h->data);
+ __clear_img_file(watcher_evas_h);
+ }
} else {
- LOGD("call updated !!!! %s", appid);
- watcher_evas_h->ops->updated(appid, watcher_evas_h->img_tbm,
- watcher_evas_h->data);
+ LOGD("call updated !!!! %s, type %d", appid, type);
+ if (type == TIZEN_REMOTE_SURFACE_BUFFER_TYPE_IMAGE_FILE) {
+ watcher_evas_h->ops->updated(appid, watcher_evas_h->img_file,
+ watcher_evas_h->data);
+ __clear_img_tbm(watcher_evas_h);
+ } else {
+ watcher_evas_h->ops->updated(appid, watcher_evas_h->img_tbm,
+ watcher_evas_h->data);
+ __clear_img_file(watcher_evas_h);
+ }
}
+ close(img_file_fd); /* close passed fd */
}
static void __watcher_update_cb(struct tizen_remote_surface *trs, struct wl_buffer *buffer, uint32_t time, void *data)
@@ -450,7 +487,10 @@ static void __watcher_missing_cb(struct tizen_remote_surface *trs, void *data)
}
appid = screen_connector_watcher_get_appid(watcher_evas_h->watcher_h);
- watcher_evas_h->ops->removed(appid, watcher_evas_h->img_tbm, watcher_evas_h->data);
+ if (watcher_evas_h->img_tbm != NULL)
+ watcher_evas_h->ops->removed(appid, watcher_evas_h->img_tbm, watcher_evas_h->data);
+ else
+ watcher_evas_h->ops->removed(appid, watcher_evas_h->img_file, watcher_evas_h->data);
__free_watcher_evas_h(watcher_evas_h);
}
@@ -476,6 +516,7 @@ EXPORT_API screen_connector_watcher_evas_h screen_connector_watcher_evas_add(scr
LOGE("handle calloc fail");
return NULL;
}
+ handle->img_type = -1;
handle->ops = evas_ops;
handle->data = data;
handle->watcher_h = screen_connector_watcher_add(&watcher_ops, id, handle);