From 7981aaf9473db213949a54dffea7e0344d7cb182 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Wed, 12 Apr 2017 20:39:40 +0900 Subject: [PATCH 01/16] Make widget work. The data of '___PLUGID' key is used on accessibility environment. A widget process window such as 'Alarm Widget' on wearable is using same data. Becase the widget process could make more than one window, the data should be the instance ID, NOT the application ID to separate thoes windows. Change-Id: I2ee38bc57128b4c6497111b1628183512ed9e0f2 --- screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index 5a78547..ea1d1ad 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -454,7 +454,7 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, g_hash_table_insert(toolkit_evas_h->type_h->toolkit_table, toolkit_evas_h->img_tbm, toolkit_evas_h); /* Set data to use in accessibility */ - snprintf(plug_id, sizeof(plug_id), "%s:%d", appid, pid); + snprintf(plug_id, sizeof(plug_id), "%s:%d", instance_id, pid); evas_object_data_set(toolkit_evas_h->img_tbm, "___PLUGID", strdup(plug_id)); evas_object_event_callback_add(toolkit_evas_h->img_tbm, EVAS_CALLBACK_MOVE, __obj_update_visibility, toolkit_evas_h); -- 2.7.4 From a1cd61562a92ccf4432ca7738a72d717417b90d2 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 13 Apr 2017 10:46:26 +0900 Subject: [PATCH 02/16] Fix the exception handling about creating type handle Change-Id: I5daaa5a488909929d77c1ece677d4dc40667bbbd Signed-off-by: Hwankyu Jhun --- screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index ea1d1ad..7dc3cec 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -79,15 +79,19 @@ EXPORT_API int screen_connector_toolkit_evas_init(Evas_Object *win, screen_conne 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)); - g_hash_table_insert(__type_table, GINT_TO_POINTER(type), type_h); + if (type_h == NULL) { + LOGE("Out of memory"); + return -1; + } type_h->toolkit_table = g_hash_table_new(g_direct_hash, g_direct_equal); 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; -- 2.7.4 From ebb735b76f184727c822bd58e17ea1107cb59d8f Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 14 Apr 2017 13:44:25 +0900 Subject: [PATCH 03/16] Release version 1.1.10 Changes: - Fix the exception handling about creating type handle - Make widget work - Fix memory leak - Fix memory leak Change-Id: If1bfff9f1dde953a24ca1e3dfe5e670415a6f560 Signed-off-by: Hwankyu Jhun --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index a5ce933..fdc2d36 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.1.9 +Version: 1.1.10 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From e5b91194895ffb1bb3b1b32a77c14dbb42963c64 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Wed, 19 Apr 2017 14:05:53 +0900 Subject: [PATCH 04/16] Fix toolkit_table destroy bug screen_connector_toolkit_evas_fini is called remote surface is destroyed but screen_connector_toolkit_evas_h will not freed, so callback which have a screen_connector_toolkit_evas_h as a user data like __rs_cb_mouse_move callback could cause crash when they try to send event through already destroyed remote surface Change-Id: Ifda77fa1cb0244186179c7ffe2dc77b536593586 Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 149 +++++++++++---------- 1 file changed, 80 insertions(+), 69 deletions(-) diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index 7dc3cec..bf2585d 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -34,6 +34,7 @@ #endif #define LOG_TAG "SC_WATCHER_EVAS" +#define SC_TOOLKIT_HANDLE_TAG "SC_TOOLKIT_HANDLE_TAG" struct _screen_connector_type_evas_h { GHashTable *toolkit_table; @@ -70,6 +71,53 @@ static void __destroy_type_h(gpointer data) free(type_h); } +static void __clear_img_tbm(screen_connector_toolkit_evas_h toolkit_evas_h) +{ + char *plug_id; + + if (toolkit_evas_h->img_tbm == NULL) + return; + + plug_id = evas_object_data_del(toolkit_evas_h->img_tbm, "___PLUGID"); + if (plug_id) + free(plug_id); + + evas_object_del(toolkit_evas_h->img_tbm); + toolkit_evas_h->img_tbm = NULL; +} + +static void __clear_img_file(screen_connector_toolkit_evas_h toolkit_evas_h) +{ + if (toolkit_evas_h->img_file == NULL) + return; + + evas_object_del(toolkit_evas_h->img_file); + toolkit_evas_h->img_file = NULL; +} + +static void __destroy_toolkit_evas_h(gpointer data) +{ + char *plug_id; + screen_connector_toolkit_evas_h toolkit_evas_h = data; + + if (!toolkit_evas_h) + return; + + if (toolkit_evas_h->img_tbm != NULL) { + plug_id = evas_object_data_del(toolkit_evas_h->img_tbm, "___PLUGID"); + if (plug_id) + free(plug_id); + } + + if (toolkit_evas_h->toolkit_h) + screen_connector_toolkit_remove(toolkit_evas_h->toolkit_h); + + if (toolkit_evas_h->ops) + free(toolkit_evas_h->ops); + + free(toolkit_evas_h); +} + EXPORT_API int screen_connector_toolkit_evas_init(Evas_Object *win, screen_connector_screen_type_e type) { screen_connector_type_evas_h type_h; @@ -85,7 +133,7 @@ EXPORT_API int screen_connector_toolkit_evas_init(Evas_Object *win, screen_conne return -1; } - type_h->toolkit_table = g_hash_table_new(g_direct_hash, g_direct_equal); + type_h->toolkit_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, __destroy_toolkit_evas_h); if (!type_h->toolkit_table) { LOGE("failed to create table"); free(type_h); @@ -124,7 +172,7 @@ EXPORT_API int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e return screen_connector_toolkit_fini(type); } -static bool __obj_is_visible(Evas_Object *obj, screen_connector_toolkit_evas_h toolkit_evas_h) +static bool __obj_is_visible(screen_connector_toolkit_evas_h toolkit_evas_h) { int x, y, w, h; Ecore_Wl_Window *window = NULL; @@ -136,9 +184,14 @@ static bool __obj_is_visible(Evas_Object *obj, screen_connector_toolkit_evas_h t return false; } + if (toolkit_evas_h->img_tbm == NULL) { + LOGE("img_tbm is NULL"); + return false; + } + window = elm_win_wl_window_get(toolkit_evas_h->type_h->viewer_win); ecore_wl_window_geometry_get(window, &window_x, &window_y, &window_w, &window_h); - evas_object_geometry_get(obj, &x, &y, &w, &h); + evas_object_geometry_get(toolkit_evas_h->img_tbm, &x, &y, &w, &h); rotation = ecore_wl_window_rotation_get(window); if (x >= 0 && x < window_w && @@ -196,7 +249,7 @@ static void __obj_update_visibility(void *data, Evas *e, Evas_Object *obj, void return; } - if (__obj_is_visible(obj, toolkit_evas_h)) + if (__obj_is_visible(toolkit_evas_h)) __set_visibility(toolkit_evas_h, VISIBILITY_TYPE_UNOBSCURED); else __set_visibility(toolkit_evas_h, VISIBILITY_TYPE_FULLY_OBSCURED); @@ -390,25 +443,6 @@ 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_toolkit_evas_h toolkit_evas_h) -{ - if (toolkit_evas_h->img_tbm == NULL) - return; - - g_hash_table_remove(toolkit_evas_h->type_h->toolkit_table, toolkit_evas_h->img_tbm); - evas_object_del(toolkit_evas_h->img_tbm); - toolkit_evas_h->img_tbm = NULL; -} - -static void __clear_img_file(screen_connector_toolkit_evas_h toolkit_evas_h) -{ - if (toolkit_evas_h->img_file == NULL) - return; - - evas_object_del(toolkit_evas_h->img_file); - toolkit_evas_h->img_file = NULL; -} - static void __toolkit_update_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, const char *appid, const char *instance_id, const int pid, void *data) @@ -455,11 +489,13 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, __rs_cb_resize, toolkit_evas_h); /* Store toolkit_evas_h */ - g_hash_table_insert(toolkit_evas_h->type_h->toolkit_table, toolkit_evas_h->img_tbm, toolkit_evas_h); + g_hash_table_insert(toolkit_evas_h->type_h->toolkit_table, strdup(instance_id), toolkit_evas_h); /* Set data to use in accessibility */ snprintf(plug_id, sizeof(plug_id), "%s:%d", instance_id, pid); evas_object_data_set(toolkit_evas_h->img_tbm, "___PLUGID", strdup(plug_id)); + + evas_object_data_set(toolkit_evas_h->img_tbm, SC_TOOLKIT_HANDLE_TAG, toolkit_evas_h); evas_object_event_callback_add(toolkit_evas_h->img_tbm, EVAS_CALLBACK_MOVE, __obj_update_visibility, toolkit_evas_h); } @@ -538,25 +574,6 @@ static void __toolkit_added_cb(const char *appid, const char *instance_id, const { } -static void __free_toolkit_evas_h(screen_connector_toolkit_evas_h toolkit_evas_h) -{ - if (!toolkit_evas_h) - return; - - if (toolkit_evas_h->toolkit_h) - screen_connector_toolkit_remove(toolkit_evas_h->toolkit_h); - - __clear_img_file(toolkit_evas_h); - __clear_img_tbm(toolkit_evas_h); - - if (toolkit_evas_h->ops) { - free(toolkit_evas_h->ops); - toolkit_evas_h->ops = NULL; - } - - free(toolkit_evas_h); -} - static void __toolkit_removed_cb(const char *appid, const char *instance_id, const int pid, void *data) { screen_connector_toolkit_evas_h toolkit_evas_h; @@ -569,20 +586,18 @@ static void __toolkit_removed_cb(const char *appid, const char *instance_id, con return; } - if (toolkit_evas_h->type_h->toolkit_table != NULL && toolkit_evas_h->img_tbm != NULL) { - g_hash_table_remove(toolkit_evas_h->type_h->toolkit_table, toolkit_evas_h->img_tbm); - - /* Remove data used in accessibility */ + if (toolkit_evas_h->img_tbm != NULL) { plug_id = evas_object_data_del(toolkit_evas_h->img_tbm, "___PLUGID"); - free(plug_id); - } + if (plug_id) + free(plug_id); - if (toolkit_evas_h->img_tbm != NULL) + evas_object_data_del(toolkit_evas_h->img_tbm, SC_TOOLKIT_HANDLE_TAG); toolkit_evas_h->ops->removed_cb(appid, instance_id, pid, toolkit_evas_h->img_tbm, toolkit_evas_h->data); - else if (toolkit_evas_h->img_file != NULL) + } else if (toolkit_evas_h->img_file != NULL) { toolkit_evas_h->ops->removed_cb(appid, instance_id, pid, toolkit_evas_h->img_file, toolkit_evas_h->data); + } - __free_toolkit_evas_h(toolkit_evas_h); + g_hash_table_remove(toolkit_evas_h->type_h->toolkit_table, instance_id); } EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(screen_connector_toolkit_evas_ops *ops, char *id, @@ -628,10 +643,18 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(scr EXPORT_API int screen_connector_toolkit_evas_remove(screen_connector_toolkit_evas_h handle) { + const char *instance_id; + if (handle == NULL) return -1; - __free_toolkit_evas_h(handle); + instance_id = screen_connector_toolkit_get_instance_id(handle->toolkit_h); + if (instance_id == NULL) { + LOGE("Null instance_id"); + return -1; + } + g_hash_table_remove(handle->type_h->toolkit_table, instance_id); + return 0; } @@ -643,7 +666,6 @@ EXPORT_API int screen_connector_toolkit_evas_update(const char *appid, const cha static void __send_visibility(gpointer key, gpointer value, gpointer user_data) { screen_connector_toolkit_evas_h toolkit_evas_h = (screen_connector_toolkit_evas_h)value; - Evas_Object *evas_obj = (Evas_Object *)key; unsigned int event = GPOINTER_TO_INT(user_data); int ret; visibility_type type; @@ -651,7 +673,7 @@ static void __send_visibility(gpointer key, gpointer value, gpointer user_data) if (toolkit_evas_h->freeze) return; - if (!__obj_is_visible(evas_obj, toolkit_evas_h)) + if (!__obj_is_visible(toolkit_evas_h)) return; if (event) @@ -661,7 +683,7 @@ static void __send_visibility(gpointer key, gpointer value, gpointer user_data) ret = __set_visibility(toolkit_evas_h, type); if (ret == -1) - LOGE("failed to set object visibility set %p to %d", evas_obj, type); + LOGE("failed to set object visibility set %p to %d", toolkit_evas_h->img_tbm, type); } static Eina_Bool __visibility_cb(void *data, int type, void *event) @@ -712,21 +734,10 @@ EXPORT_API int screen_connector_toolkit_evas_stop_visibility_notify(void) screen_connector_toolkit_evas_h __find_toolkit_evas_h(Evas_Object *obj) { screen_connector_toolkit_evas_h toolkit_evas_h; - GHashTableIter iter; - gpointer key, value; - screen_connector_type_evas_h cur_type; - g_hash_table_iter_init(&iter, __type_table); - while (g_hash_table_iter_next(&iter, &key, &value)) { - cur_type = (screen_connector_type_evas_h)value; - if (cur_type->toolkit_table) { - toolkit_evas_h = g_hash_table_lookup(cur_type->toolkit_table, obj); - if (toolkit_evas_h != NULL) - return toolkit_evas_h; - } - } + toolkit_evas_h = evas_object_data_get(obj, SC_TOOLKIT_HANDLE_TAG); - return NULL; + return toolkit_evas_h; } EXPORT_API int screen_connector_toolkit_evas_freeze_visibility(Evas_Object *obj, visibility_type type) -- 2.7.4 From e4674c573afede712f7f0b92afefaae90dd46e73 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Tue, 18 Apr 2017 20:24:13 +0900 Subject: [PATCH 05/16] Add bind surface APIs - screen_connector_toolkit_add_with_surface - screen_connector_toolkit_evas_add_with_win Change-Id: I375e74a3a6b26da81befff3109987fc9b9a32234 Signed-off-by: Hyunho Kang --- .../include/screen_connector_toolkit.h | 2 + .../src/screen_connector_toolkit.c | 61 +++++++++++++++++++++ .../include/screen_connector_toolkit_evas.h | 3 ++ .../src/screen_connector_toolkit_evas.c | 62 ++++++++++++++++++++++ 4 files changed, 128 insertions(+) diff --git a/screen_connector_watcher/include/screen_connector_toolkit.h b/screen_connector_watcher/include/screen_connector_toolkit.h index a5db07e..39968b1 100644 --- a/screen_connector_watcher/include/screen_connector_toolkit.h +++ b/screen_connector_watcher/include/screen_connector_toolkit.h @@ -78,6 +78,8 @@ screen_connector_toolkit_h screen_connector_toolkit_create_handle(char *id, int screen_connector_toolkit_ops *ops, void *data); struct tizen_remote_surface *screen_connector_toolkit_get_trs(screen_connector_toolkit_h h); int screen_connector_toolkit_redirect_surface(screen_connector_toolkit_h info); +screen_connector_toolkit_h screen_connector_toolkit_add_with_surface(screen_connector_toolkit_ops *ops, char *id, + screen_connector_screen_type_e type, struct wl_surface *surface, void *data); #ifdef __cplusplus } diff --git a/screen_connector_watcher/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c index 910d73f..3a36df2 100644 --- a/screen_connector_watcher/src/screen_connector_toolkit.c +++ b/screen_connector_watcher/src/screen_connector_toolkit.c @@ -52,6 +52,7 @@ struct _screen_connector_toolkit_h { struct tizen_remote_surface *surface; struct _screen_connector_type_h *type_h; void *data; + struct wl_surface *bind_surface; }; static GHashTable *__type_table; @@ -110,6 +111,9 @@ EXPORT_API int screen_connector_toolkit_redirect_surface(screen_connector_toolki tizen_remote_surface_add_listener(toolkit_h->surface, &__rs_listener, toolkit_h); tizen_remote_surface_redirect(toolkit_h->surface); + if (toolkit_h->bind_surface != NULL) + tizen_remote_surface_manager_bind_surface(rsm, toolkit_h->bind_surface, toolkit_h->surface); + return 0; } @@ -271,6 +275,63 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_create_handle(cha return toolkit_h; } +EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add_with_surface(screen_connector_toolkit_ops *ops, char *id, + screen_connector_screen_type_e type, struct wl_surface *surface, void *data) +{ + screen_connector_toolkit_h toolkit_h; + screen_connector_type_h type_h; + screen_connector_toolkit_ops *ops_copy; + + if (id == NULL || ops == NULL) { + LOGE("Invalid param"); + return NULL; + } + + type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type)); + if (type_h == NULL) { + LOGE("type %d is not initialized !!", type); + return NULL; + } + + ops_copy = (screen_connector_toolkit_ops *)calloc(1, sizeof(screen_connector_toolkit_ops)); + if (ops_copy == NULL) { + LOGE("ops_copy calloc fail"); + return NULL; + } + memcpy(ops_copy, ops, sizeof(screen_connector_toolkit_ops)); + + toolkit_h = (screen_connector_toolkit_h)calloc(1, sizeof(struct _screen_connector_toolkit_h)); + if (toolkit_h == NULL) { + LOGE("toolkit_h calloc fail"); + free(ops_copy); + return NULL; + } + + toolkit_h->instance_id = strdup(id); + if (toolkit_h->instance_id == NULL) { + LOGE("strdup id fail"); + free(ops_copy); + free(toolkit_h); + return NULL; + } + + toolkit_h->data = data; + toolkit_h->ops = ops_copy; + toolkit_h->type_h = type_h; + toolkit_h->bind_surface = surface; + + if (type_h->toolkit_table == NULL) + type_h->toolkit_table = g_hash_table_new_full(g_str_hash, + g_str_equal, free, __destroy_toolkit_h); + + g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h); + + if (type_h->aul_handle == NULL) + aul_screen_connector_add_screen_viewer(__aul_screen_viewer_cb, type, true, type_h, &type_h->aul_handle); + + return toolkit_h; +} + EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add(screen_connector_toolkit_ops *ops, char *id, screen_connector_screen_type_e type, void *data) { diff --git a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h index 1fb75f6..d0d4a89 100644 --- a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h @@ -105,6 +105,9 @@ int screen_connector_toolkit_evas_get_pid(Evas_Object *obj, int *pid); screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_by_rid(screen_connector_toolkit_evas_ops *ops, int res_id, screen_connector_screen_type_e type, void *data); int screen_connector_toolkit_evas_get_rid(Evas_Object *obj, int *resource_id); +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); + /** * @} diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index bf2585d..cb9b226 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -600,6 +600,68 @@ static void __toolkit_removed_cb(const char *appid, const char *instance_id, con g_hash_table_remove(toolkit_evas_h->type_h->toolkit_table, instance_id); } +EXPORT_API 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) +{ + screen_connector_toolkit_evas_h handle; + screen_connector_toolkit_evas_ops *evas_ops; + screen_connector_toolkit_ops toolkit_ops; + screen_connector_type_evas_h type_h; + int int_type = type; + struct wl_surface *surface; + Ecore_Wl_Window *wl_win; + + if (win == NULL || ops == NULL || id == NULL + || type < SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET + || type > SCREEN_CONNECTOR_SCREEEN_TYPE_ALL) { + LOGE("Invalid param NULL"); + return NULL; + } + + wl_win = elm_win_wl_window_get(win); + if (wl_win == NULL) { + LOGE("failed to get wl_win"); + return NULL; + } + + surface = ecore_wl_window_surface_get(wl_win); + if (surface == NULL) { + LOGE("failed to get surface"); + return NULL; + } + + type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(int_type)); + if (type_h == NULL) { + LOGE("type %d is not initialized !!", type); + return NULL; + } + + toolkit_ops.added_cb = __toolkit_added_cb; + toolkit_ops.updated_cb = NULL; + toolkit_ops.removed_cb = __toolkit_removed_cb; + + evas_ops = (screen_connector_toolkit_evas_ops *)calloc(1, sizeof(screen_connector_toolkit_evas_ops)); + if (evas_ops == NULL) { + LOGE("evas_ops calloc fail"); + return NULL; + } + + memcpy(evas_ops, ops, sizeof(screen_connector_toolkit_evas_ops)); + handle = (screen_connector_toolkit_evas_h)calloc(1, sizeof(struct _screen_connector_toolkit_evas_h)); + if (handle == NULL) { + LOGE("handle calloc fail"); + free(evas_ops); + return NULL; + } + handle->img_type = -1; + handle->ops = evas_ops; + handle->data = data; + handle->type_h = type_h; + handle->toolkit_h = screen_connector_toolkit_add_with_surface(&toolkit_ops, id, type, surface, handle); + + return handle; +} + EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(screen_connector_toolkit_evas_ops *ops, char *id, screen_connector_screen_type_e type, void *data) { -- 2.7.4 From fb542f9154193683c27a941cfae2e37bc9b81c0d Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 21 Apr 2017 13:37:18 +0900 Subject: [PATCH 06/16] Release version 1.2.0 Changes: - Add bind surface APIs - Fix toolkit_table destroy bug Change-Id: I73000c68ff3fe95acee3ae3953961fdea252c47d Signed-off-by: Hyunho Kang --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index fdc2d36..b22c29d 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.1.10 +Version: 1.2.0 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From acf380a217578c085f28fa13b10f8cba00f5ae53 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Wed, 26 Apr 2017 14:08:33 +0900 Subject: [PATCH 07/16] Delay resuming time - This patch allows some widgets to postpone getting resuming callback - If widgets change the visibility repeatedly, the performance will not be good - Added API will help to adjust the delayed resuming time - By default, the delayed resuming time is 0 Change-Id: I87edb61a7706bd0abf28fe63c9289c56635d64e5 Signed-off-by: Junghoon Park --- .../include/screen_connector_toolkit_evas.h | 1 + .../src/screen_connector_toolkit_evas.c | 51 +++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h index d0d4a89..b1ae572 100644 --- a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h @@ -65,6 +65,7 @@ int screen_connector_toolkit_evas_init(Evas_Object *win, screen_connector_screen int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e type); screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(screen_connector_toolkit_evas_ops *ops, char *id, screen_connector_screen_type_e type, void *data); +int screen_connector_toolkit_evas_set_delayed_resuming_time(int ms); int screen_connector_toolkit_evas_remove(screen_connector_toolkit_evas_h handle); int screen_connector_toolkit_evas_update(const char *appid, const char *instance_id); int screen_connector_toolkit_evas_start_visibility_notify(void); diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index cb9b226..d53e0ed 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -52,11 +52,13 @@ struct _screen_connector_toolkit_evas_h { uint32_t img_type; struct wl_buffer *pre_buffer; struct _screen_connector_type_evas_h *type_h; + guint resuming_timer; void *data; }; static GHashTable *__type_table = NULL; static Ecore_Event_Handler *__visibility_listener; +static int __delayed_resuming_time; static void __destroy_type_h(gpointer data) { @@ -115,6 +117,9 @@ static void __destroy_toolkit_evas_h(gpointer data) if (toolkit_evas_h->ops) free(toolkit_evas_h->ops); + if (toolkit_evas_h->resuming_timer > 0) + g_source_remove(toolkit_evas_h->resuming_timer); + free(toolkit_evas_h); } @@ -169,6 +174,8 @@ EXPORT_API int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e __type_table = NULL; } + __delayed_resuming_time = 0; + return screen_connector_toolkit_fini(type); } @@ -211,6 +218,22 @@ static bool __obj_is_visible(screen_connector_toolkit_evas_h toolkit_evas_h) return false; } +static gboolean __resuming_timeout_cb(gpointer user_data) +{ + screen_connector_toolkit_evas_h toolkit_evas_h = user_data; + struct tizen_remote_surface *surface; + + surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h); + if (surface) { + tizen_remote_surface_transfer_visibility(surface, + TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE); + } + + toolkit_evas_h->resuming_timer = 0; + + return G_SOURCE_REMOVE; +} + static int __set_visibility(screen_connector_toolkit_evas_h toolkit_evas_h, visibility_type type) { int obscured; @@ -234,9 +257,28 @@ static int __set_visibility(screen_connector_toolkit_evas_h toolkit_evas_h, visi } surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h); - if (surface) + if (!surface) + return -1; + + if (__delayed_resuming_time == 0) { tizen_remote_surface_transfer_visibility(surface, obscured); + return 0; + } + + if (obscured == TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_INVISIBLE) { + if (toolkit_evas_h->resuming_timer > 0) { + g_source_remove(toolkit_evas_h->resuming_timer); + toolkit_evas_h->resuming_timer = 0; + } + tizen_remote_surface_transfer_visibility(surface, obscured); + } else { + if (toolkit_evas_h->resuming_timer == 0) { + toolkit_evas_h->resuming_timer = g_timeout_add(__delayed_resuming_time, + __resuming_timeout_cb, toolkit_evas_h); + } + } + return 0; } @@ -600,6 +642,13 @@ static void __toolkit_removed_cb(const char *appid, const char *instance_id, con g_hash_table_remove(toolkit_evas_h->type_h->toolkit_table, instance_id); } +EXPORT_API int screen_connector_toolkit_evas_set_delayed_resuming_time(int ms) +{ + __delayed_resuming_time = ms; + + return 0; +} + EXPORT_API 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) { -- 2.7.4 From 18498e0b1b8785ccbfbec95a1958aed1511f8306 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 12 May 2017 09:57:35 +0900 Subject: [PATCH 08/16] Add mouse in/out handling logic Change-Id: I4b87825c3bfb29851b1a12430c26da22245b2159 Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index d53e0ed..b4bf4fe 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -468,6 +468,80 @@ static void __rs_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *eve ev->timestamp); } +static void __rs_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + screen_connector_toolkit_evas_h toolkit_evas_h = (screen_connector_toolkit_evas_h)data; + Evas_Event_Mouse_In *ev = event_info; + const char *desc = evas_device_description_get(ev->dev); + int x; + int y; + int w; + int h; + struct tizen_remote_surface *surface; + + evas_object_geometry_get(obj, &x, &y, &w, &h); + LOGD("mouse in: %d %d", ev->canvas.x - x, ev->canvas.y - y); + + if (desc == NULL) + desc = ""; + + surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h); + if (surface == NULL) { + LOGE("surface is NULL"); + return; + } + + tizen_remote_surface_transfer_mouse_event( + surface, + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_IN, + 0, + 0, + ev->canvas.x - x, + ev->canvas.y - y, + 0, + 0, + 0, + 0, + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +static void __rs_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + screen_connector_toolkit_evas_h toolkit_evas_h = (screen_connector_toolkit_evas_h)data; + Evas_Event_Mouse_Out *ev = event_info; + const char *desc = evas_device_description_get(ev->dev); + struct tizen_remote_surface *surface; + + LOGD("mouse out"); + if (desc == NULL) + desc = ""; + + surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h); + if (surface == NULL) { + LOGE("surface is NULL"); + return; + } + + tizen_remote_surface_transfer_mouse_event( + surface, + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_OUT, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + static void __rs_cb_show(void *data, Evas *e, Evas_Object *obj, void *event_info) { LOGD("show"); @@ -521,6 +595,12 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, EVAS_CALLBACK_MOUSE_WHEEL, __rs_cb_mouse_wheel, toolkit_evas_h); evas_object_event_callback_add(toolkit_evas_h->img_tbm, + EVAS_CALLBACK_MOUSE_IN, + __rs_cb_mouse_in, toolkit_evas_h); + evas_object_event_callback_add(toolkit_evas_h->img_tbm, + EVAS_CALLBACK_MOUSE_OUT, + __rs_cb_mouse_out, toolkit_evas_h); + evas_object_event_callback_add(toolkit_evas_h->img_tbm, EVAS_CALLBACK_SHOW, __rs_cb_show, toolkit_evas_h); evas_object_event_callback_add(toolkit_evas_h->img_tbm, -- 2.7.4 From c9c6c1722a0bc848f213c130c7987f12030a5055 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 12 May 2017 10:36:56 +0900 Subject: [PATCH 09/16] Release version 1.2.1 Changes: - Delay resuming time - Add mouse in/out handling logic Change-Id: Ib12d1df12113aee95136c485a4bc3167c655d4c2 Signed-off-by: Hyunho Kang --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index b22c29d..aed9486 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.2.0 +Version: 1.2.1 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From fcefc9d15e719d27fcc34919d2fd2eca079259fc Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 16 May 2017 11:18:24 +0900 Subject: [PATCH 10/16] Add APIs to control visibility Change-Id: I901d56fce6ab6703f865388fd361157b374f82d6 Signed-off-by: Junghoon Park --- .../include/screen_connector_toolkit_evas.h | 1 + .../src/screen_connector_toolkit_evas.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h index b1ae572..7cd665d 100644 --- a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h @@ -72,6 +72,7 @@ int screen_connector_toolkit_evas_start_visibility_notify(void); int screen_connector_toolkit_evas_stop_visibility_notify(void); int screen_connector_toolkit_evas_freeze_visibility(Evas_Object *obj, visibility_type type); int screen_connector_toolkit_evas_thaw_visibility(Evas_Object *obj); +int screen_connector_toolkit_evas_send_visibility(Evas_Object *obj, visibility_type type); int screen_connector_toolkit_evas_send_mouse_up(Evas_Object *obj); int screen_connector_toolkit_evas_send_touch_cancel(Evas_Object *obj); diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index b4bf4fe..856d363 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -959,6 +959,19 @@ EXPORT_API int screen_connector_toolkit_evas_thaw_visibility(Evas_Object *obj) return 0; } +EXPORT_API int screen_connector_toolkit_evas_send_visibility(Evas_Object *obj, visibility_type type) +{ + screen_connector_toolkit_evas_h toolkit_evas_h; + + toolkit_evas_h = __find_toolkit_evas_h(obj); + if (!toolkit_evas_h) { + LOGE("obj not found"); + return -1; + } + + return __set_visibility(toolkit_evas_h, type); +} + EXPORT_API int screen_connector_toolkit_evas_send_mouse_up(Evas_Object *obj) { screen_connector_toolkit_evas_h toolkit_evas_h; -- 2.7.4 From 9aa15f9d996452848326df4430976c982842823c Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Thu, 18 May 2017 17:14:45 +0900 Subject: [PATCH 11/16] Release version 1.2.2 Changes: - Add APIs to control visibility Change-Id: I4d335bf69a6087c8170492801b0209881e82e7d8 Signed-off-by: Junghoon Park --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index aed9486..38d630e 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.2.1 +Version: 1.2.2 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 90bac99e6166992f06a86ea370c13583314e21d1 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Thu, 11 May 2017 14:09:39 +0900 Subject: [PATCH 12/16] Add APIs for binding and unbinding window Change-Id: I0ae4e1aaff04896400047ed9867fd5c75f823cb6 Signed-off-by: Junghoon Park --- .../include/screen_connector_toolkit.h | 3 ++ .../src/screen_connector_toolkit.c | 34 ++++++++++++++++++++++ .../include/screen_connector_toolkit_evas.h | 3 ++ .../src/screen_connector_toolkit_evas.c | 34 ++++++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/screen_connector_watcher/include/screen_connector_toolkit.h b/screen_connector_watcher/include/screen_connector_toolkit.h index 39968b1..8b8a80d 100644 --- a/screen_connector_watcher/include/screen_connector_toolkit.h +++ b/screen_connector_watcher/include/screen_connector_toolkit.h @@ -81,6 +81,9 @@ int screen_connector_toolkit_redirect_surface(screen_connector_toolkit_h info); screen_connector_toolkit_h screen_connector_toolkit_add_with_surface(screen_connector_toolkit_ops *ops, char *id, screen_connector_screen_type_e type, struct wl_surface *surface, void *data); +int screen_connector_toolkit_bind(screen_connector_toolkit_h h, struct wl_surface *surface); +int screen_connector_toolkit_unbind(screen_connector_toolkit_h h); + #ifdef __cplusplus } #endif diff --git a/screen_connector_watcher/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c index 3a36df2..d1747b2 100644 --- a/screen_connector_watcher/src/screen_connector_toolkit.c +++ b/screen_connector_watcher/src/screen_connector_toolkit.c @@ -474,3 +474,37 @@ EXPORT_API struct tizen_remote_surface *screen_connector_toolkit_get_trs(screen_ return h->surface; } + +EXPORT_API int screen_connector_toolkit_bind(screen_connector_toolkit_h h, + struct wl_surface *surface) +{ + struct tizen_remote_surface_manager *rsm = screen_connector_get_rsm(); + + if (!h || !rsm || !(h->surface)) { + LOGE("invalid argument %p %p", h, rsm); + + return -1; + } + + tizen_remote_surface_manager_bind_surface(rsm, surface, h->surface); + + return 0; +} + +EXPORT_API int screen_connector_toolkit_unbind(screen_connector_toolkit_h h) +{ + struct tizen_remote_surface_manager *rsm = screen_connector_get_rsm(); + + if (!h || !rsm || !(h->surface)) { + LOGE("invalid argument %p %p", h, rsm); + + return -1; + } + + tizen_remote_surface_manager_bind_surface(rsm, NULL, h->surface); + tizen_remote_surface_redirect(h->surface); + + return 0; +} + + diff --git a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h index 7cd665d..95ed241 100644 --- a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h @@ -75,6 +75,9 @@ int screen_connector_toolkit_evas_thaw_visibility(Evas_Object *obj); int screen_connector_toolkit_evas_send_visibility(Evas_Object *obj, visibility_type type); int screen_connector_toolkit_evas_send_mouse_up(Evas_Object *obj); int screen_connector_toolkit_evas_send_touch_cancel(Evas_Object *obj); +int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_h h, Evas_Object *win); +int screen_connector_toolkit_evas_unbind(screen_connector_toolkit_evas_h h); + /** * @brief Add screen connector toolkit by rid. diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index 856d363..631b767 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -1126,3 +1126,37 @@ EXPORT_API int screen_connector_toolkit_evas_get_pid(Evas_Object *obj, int *pid) return 0; } + +EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_h h, + Evas_Object *win) +{ + struct wl_surface *surface; + Ecore_Wl_Window *wl_win; + + if (!h) + return -1; + + wl_win = elm_win_wl_window_get(win); + if (!wl_win) { + LOGE("failed to get wl_win"); + return -1; + } + + surface = ecore_wl_window_surface_get(wl_win); + if (!surface) { + LOGE("failed to get surface"); + return -1; + } + + return screen_connector_toolkit_bind(h->toolkit_h, surface); +} + +EXPORT_API int screen_connector_toolkit_evas_unbind(screen_connector_toolkit_evas_h h) +{ + if (!h || !(h->toolkit_h)) { + LOGE("invalid argument %p", h); + return -1; + } + + return screen_connector_toolkit_unbind(h->toolkit_h); +} -- 2.7.4 From 22c053a2c63f4ae10027a3ef842eaf569b810f2e Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Fri, 19 May 2017 11:14:42 +0900 Subject: [PATCH 13/16] Release version 1.2.3 Changes: - Add APIs for binding and unbinding window Change-Id: If2734a40b1a13768e2020343a1a95623348c737b Signed-off-by: Junghoon Park --- packaging/libscreen_connector.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index 38d630e..76e9979 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -1,6 +1,6 @@ Name: libscreen_connector Summary: Library for developing the application -Version: 1.2.2 +Version: 1.2.3 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From e8a3bca0355fc7bc735876529aebcb55cab78839 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 25 May 2017 19:36:43 +0900 Subject: [PATCH 14/16] Add buffer changed event filter Some watcher application like task-manager want to receive only file type update event. Using these APIs developer can filter update event. - screen_connector_watcher_set_changed_event_filter - screen_connector_watcher_evas_set_changed_event_filter Change-Id: I773f6817d3ab6c2ac58941b1948940daaed90976 Signed-off-by: Hyunho Kang --- .../include/screen_connector_watcher.h | 10 ++++++++ .../src/screen_connector_trs.c | 2 +- .../src/screen_connector_watcher.c | 30 ++++++++++++++++++++++ .../include/screen_connector_watcher_evas.h | 9 +++++++ .../src/screen_connector_watcher_evas.c | 5 ++++ 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/screen_connector_watcher/include/screen_connector_watcher.h b/screen_connector_watcher/include/screen_connector_watcher.h index 31d6b85..b2b4816 100644 --- a/screen_connector_watcher/include/screen_connector_watcher.h +++ b/screen_connector_watcher/include/screen_connector_watcher.h @@ -23,6 +23,14 @@ extern "C" { #endif +typedef enum { + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_NONE, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_TBM, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_IMAGE_FILE, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_ALL = + TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_IMAGE_FILE, +} screen_connector_changed_event_filter_type; + typedef void (*screen_connector_watcher_added_cb)(const char *appid, const char *instance_id, const int pid, void *data); typedef void (*screen_connector_watcher_removed_cb)(const char *appid, const char *instance_id, const int pid, void *data); typedef void (*screen_connector_watcher_update_cb)(struct tizen_remote_surface *trs, uint32_t type, struct wl_buffer *tbm, @@ -53,6 +61,8 @@ int screen_connector_watcher_set_resource_id(screen_connector_watcher_h h, int r struct tizen_remote_surface *screen_connector_watcher_get_trs(screen_connector_watcher_h h); screen_connector_watcher_h screen_connector_watcher_create_handle(char *id, int pid, screen_connector_watcher_ops *ops, void *data); int screen_connector_watcher_redirect_surface(screen_connector_info_h info); +int screen_connector_watcher_set_changed_event_filter(screen_connector_watcher_h h, + screen_connector_changed_event_filter_type type); #ifdef __cplusplus } diff --git a/screen_connector_watcher/src/screen_connector_trs.c b/screen_connector_watcher/src/screen_connector_trs.c index fedb303..548fcc1 100644 --- a/screen_connector_watcher/src/screen_connector_trs.c +++ b/screen_connector_watcher/src/screen_connector_trs.c @@ -72,7 +72,7 @@ int screen_connector_trs_init(void) if (!strcmp(global->interface, "tizen_remote_surface_manager")) { __rsm = wl_registry_bind(registry, global->id, &tizen_remote_surface_manager_interface, - global->version < 4 ? global->version : 4); + global->version < 5 ? global->version : 5); } } diff --git a/screen_connector_watcher/src/screen_connector_watcher.c b/screen_connector_watcher/src/screen_connector_watcher.c index 02bd07b..e78a339 100644 --- a/screen_connector_watcher/src/screen_connector_watcher.c +++ b/screen_connector_watcher/src/screen_connector_watcher.c @@ -43,6 +43,7 @@ struct _screen_connector_watcher_h { void *data; GHashTable *info_table; aul_screen_viewer_h aul_handle; + screen_connector_changed_event_filter_type changed_filter; }; struct _screen_connector_info_h { @@ -54,6 +55,7 @@ struct _screen_connector_info_h { struct tizen_remote_surface *surface; bool renderable; void *data; + screen_connector_changed_event_filter_type changed_filter; }; static void __buffer_updated(void *data, struct tizen_remote_surface *trs, struct wl_buffer *buffer, uint32_t time) @@ -106,6 +108,8 @@ EXPORT_API int screen_connector_watcher_redirect_surface(screen_connector_info_h LOGD("resource_id : %d, (%p)", info->surface_id, info->surface); tizen_remote_surface_add_listener(info->surface, &__rs_listener, info); tizen_remote_surface_redirect(info->surface); + tizen_remote_surface_set_buffer_changed_event_filter(info->surface, info->changed_filter); + LOGD("set filter [%d] for [%s]", info->changed_filter, info->instance_id); return 0; } @@ -158,6 +162,7 @@ static void __aul_screen_viewer_cb(const char *appid, const char *instance_id, info->ops = watcher_h->ops; info->data = watcher_h->data; info->renderable = false; + info->changed_filter = watcher_h->changed_filter; if (event_type == AUL_SCREEN_CONNECTOR_EVENT_TYPE_ADD) { @@ -228,6 +233,7 @@ EXPORT_API screen_connector_watcher_h screen_connector_watcher_add(screen_connec LOGE("watcher_h calloc fail"); return NULL; } + watcher_h->changed_filter = SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_ALL; watcher_h->data = data; watcher_h->ops = ops; watcher_h->info_table = g_hash_table_new_full(g_str_hash, @@ -301,3 +307,27 @@ EXPORT_API void *screen_connector_watcher_get_user_data(screen_connector_info_h { return h->data; } + +EXPORT_API int screen_connector_watcher_set_changed_event_filter(screen_connector_watcher_h h, + screen_connector_changed_event_filter_type type) +{ + GHashTableIter iter; + gpointer key, value; + screen_connector_info_h info; + + if (h == NULL || h->info_table == NULL) { + LOGE("Invalid param"); + return -1; + } + + g_hash_table_iter_init(&iter, h->info_table); + while (g_hash_table_iter_next(&iter, &key, &value)) { + info = (screen_connector_info_h)value; + LOGD("set filter [%d] for [%s]", type, info->instance_id); + tizen_remote_surface_set_buffer_changed_event_filter(info->surface, type); + } + + h->changed_filter = type; + + return 0; +} diff --git a/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h b/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h index 75959dd..d1e67d8 100644 --- a/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h @@ -36,6 +36,13 @@ extern "C" { * @addtogroup CAPI_SCREEN_CONNECTOR_WATCHER_EVAS_MODULE * @{ */ +typedef enum { + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_NONE, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_TBM, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_IMAGE_FILE, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_ALL = + TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_IMAGE_FILE, +} screen_connector_evas_changed_event_filter_type; typedef void (*screen_connector_watcher_evas_added_cb)(const char *appid, const char *instance_id, const int pid, void *data); typedef void (*screen_connector_watcher_evas_removed_cb)(const char *appid, const char *instance_id, const int pid, void *data); @@ -55,6 +62,8 @@ int screen_connector_watcher_evas_fini(void); screen_connector_watcher_evas_h screen_connector_watcher_evas_add(screen_connector_watcher_evas_ops *ops, void *data); int screen_connector_watcher_evas_remove(screen_connector_watcher_evas_h h); int screen_connector_watcher_evas_update(screen_connector_watcher_evas_h watcher_evas_h, const char *instance_id); +int screen_connector_watcher_evas_set_changed_event_filter(screen_connector_watcher_evas_h watcher_evas_h, + screen_connector_evas_changed_event_filter_type type); /** * @} 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 0e4d177..b39b4cf 100644 --- a/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c @@ -302,3 +302,8 @@ EXPORT_API int screen_connector_watcher_evas_update(screen_connector_watcher_eva return screen_connector_watcher_update(watcher_evas_h->watcher_h, instance_id); } +EXPORT_API int screen_connector_watcher_evas_set_changed_event_filter(screen_connector_watcher_evas_h watcher_evas_h, + screen_connector_evas_changed_event_filter_type type) +{ + return screen_connector_watcher_set_changed_event_filter(watcher_evas_h->watcher_h, type); +} -- 2.7.4 From 302617dcdd84c0d7c0c7cffc60a9ee4960169d2b Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 26 May 2017 10:58:50 +0900 Subject: [PATCH 15/16] Move unversioned so file to devel package Unversioned so file is not needed at runtime. It is only used at build time. Change-Id: I9577e22b392145460c5cb36e4a155d5563561134 Signed-off-by: Hyunho Kang --- packaging/libscreen_connector.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index 76e9979..a904f0f 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -69,12 +69,13 @@ Header & package configuration files to support development of the widget viewer %files -n %{name}_watcher %manifest %{name}_watcher.manifest -%attr(0644,root,root) %{_libdir}/%{name}_watcher.so* +%attr(0644,root,root) %{_libdir}/%{name}_watcher.so.* %license LICENSE %files -n %{name}_watcher-devel %{_includedir}/screen_connector_watcher/*.h %{_libdir}/pkgconfig/screen_connector_watcher.pc +%attr(0644,root,root) %{_libdir}/%{name}_watcher.so ################################################# @@ -101,12 +102,13 @@ Header & package configuration files to support development of the widget viewer %files -n %{name}_provider %manifest %{name}_provider.manifest -%attr(0644,root,root) %{_libdir}/%{name}_provider.so* +%attr(0644,root,root) %{_libdir}/%{name}_provider.so.* %license LICENSE %files -n %{name}_provider-devel %{_includedir}/screen_connector_provider/*.h %{_libdir}/pkgconfig/screen_connector_provider.pc +%attr(0644,root,root) %{_libdir}/%{name}_provider.so ################################################# @@ -133,12 +135,13 @@ Header & package configuration files to support development of the widget viewer %files -n %{name}_watcher_evas %manifest %{name}_watcher_evas.manifest -%attr(0644,root,root) %{_libdir}/%{name}_watcher_evas.so* +%attr(0644,root,root) %{_libdir}/%{name}_watcher_evas.so.* %license LICENSE %files -n %{name}_watcher_evas-devel %{_includedir}/screen_connector_watcher_evas/*.h %{_libdir}/pkgconfig/screen_connector_watcher_evas.pc +%attr(0644,root,root) %{_libdir}/%{name}_watcher_evas.so # End of a file -- 2.7.4 From ccbbd8ee1c6b87fe36907ca4b4d6f3fd56c62ace Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 1 Jun 2017 00:56:38 +0000 Subject: [PATCH 16/16] Revert "Add buffer changed event filter" This reverts commit e8a3bca0355fc7bc735876529aebcb55cab78839. Change-Id: I16e93b0a732792aafbc40fcdb1efbeac63241cc4 --- .../include/screen_connector_watcher.h | 10 -------- .../src/screen_connector_trs.c | 2 +- .../src/screen_connector_watcher.c | 30 ---------------------- .../include/screen_connector_watcher_evas.h | 9 ------- .../src/screen_connector_watcher_evas.c | 5 ---- 5 files changed, 1 insertion(+), 55 deletions(-) diff --git a/screen_connector_watcher/include/screen_connector_watcher.h b/screen_connector_watcher/include/screen_connector_watcher.h index b2b4816..31d6b85 100644 --- a/screen_connector_watcher/include/screen_connector_watcher.h +++ b/screen_connector_watcher/include/screen_connector_watcher.h @@ -23,14 +23,6 @@ extern "C" { #endif -typedef enum { - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_NONE, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_TBM, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_IMAGE_FILE, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_ALL = - TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_IMAGE_FILE, -} screen_connector_changed_event_filter_type; - typedef void (*screen_connector_watcher_added_cb)(const char *appid, const char *instance_id, const int pid, void *data); typedef void (*screen_connector_watcher_removed_cb)(const char *appid, const char *instance_id, const int pid, void *data); typedef void (*screen_connector_watcher_update_cb)(struct tizen_remote_surface *trs, uint32_t type, struct wl_buffer *tbm, @@ -61,8 +53,6 @@ int screen_connector_watcher_set_resource_id(screen_connector_watcher_h h, int r struct tizen_remote_surface *screen_connector_watcher_get_trs(screen_connector_watcher_h h); screen_connector_watcher_h screen_connector_watcher_create_handle(char *id, int pid, screen_connector_watcher_ops *ops, void *data); int screen_connector_watcher_redirect_surface(screen_connector_info_h info); -int screen_connector_watcher_set_changed_event_filter(screen_connector_watcher_h h, - screen_connector_changed_event_filter_type type); #ifdef __cplusplus } diff --git a/screen_connector_watcher/src/screen_connector_trs.c b/screen_connector_watcher/src/screen_connector_trs.c index 548fcc1..fedb303 100644 --- a/screen_connector_watcher/src/screen_connector_trs.c +++ b/screen_connector_watcher/src/screen_connector_trs.c @@ -72,7 +72,7 @@ int screen_connector_trs_init(void) if (!strcmp(global->interface, "tizen_remote_surface_manager")) { __rsm = wl_registry_bind(registry, global->id, &tizen_remote_surface_manager_interface, - global->version < 5 ? global->version : 5); + global->version < 4 ? global->version : 4); } } diff --git a/screen_connector_watcher/src/screen_connector_watcher.c b/screen_connector_watcher/src/screen_connector_watcher.c index e78a339..02bd07b 100644 --- a/screen_connector_watcher/src/screen_connector_watcher.c +++ b/screen_connector_watcher/src/screen_connector_watcher.c @@ -43,7 +43,6 @@ struct _screen_connector_watcher_h { void *data; GHashTable *info_table; aul_screen_viewer_h aul_handle; - screen_connector_changed_event_filter_type changed_filter; }; struct _screen_connector_info_h { @@ -55,7 +54,6 @@ struct _screen_connector_info_h { struct tizen_remote_surface *surface; bool renderable; void *data; - screen_connector_changed_event_filter_type changed_filter; }; static void __buffer_updated(void *data, struct tizen_remote_surface *trs, struct wl_buffer *buffer, uint32_t time) @@ -108,8 +106,6 @@ EXPORT_API int screen_connector_watcher_redirect_surface(screen_connector_info_h LOGD("resource_id : %d, (%p)", info->surface_id, info->surface); tizen_remote_surface_add_listener(info->surface, &__rs_listener, info); tizen_remote_surface_redirect(info->surface); - tizen_remote_surface_set_buffer_changed_event_filter(info->surface, info->changed_filter); - LOGD("set filter [%d] for [%s]", info->changed_filter, info->instance_id); return 0; } @@ -162,7 +158,6 @@ static void __aul_screen_viewer_cb(const char *appid, const char *instance_id, info->ops = watcher_h->ops; info->data = watcher_h->data; info->renderable = false; - info->changed_filter = watcher_h->changed_filter; if (event_type == AUL_SCREEN_CONNECTOR_EVENT_TYPE_ADD) { @@ -233,7 +228,6 @@ EXPORT_API screen_connector_watcher_h screen_connector_watcher_add(screen_connec LOGE("watcher_h calloc fail"); return NULL; } - watcher_h->changed_filter = SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_ALL; watcher_h->data = data; watcher_h->ops = ops; watcher_h->info_table = g_hash_table_new_full(g_str_hash, @@ -307,27 +301,3 @@ EXPORT_API void *screen_connector_watcher_get_user_data(screen_connector_info_h { return h->data; } - -EXPORT_API int screen_connector_watcher_set_changed_event_filter(screen_connector_watcher_h h, - screen_connector_changed_event_filter_type type) -{ - GHashTableIter iter; - gpointer key, value; - screen_connector_info_h info; - - if (h == NULL || h->info_table == NULL) { - LOGE("Invalid param"); - return -1; - } - - g_hash_table_iter_init(&iter, h->info_table); - while (g_hash_table_iter_next(&iter, &key, &value)) { - info = (screen_connector_info_h)value; - LOGD("set filter [%d] for [%s]", type, info->instance_id); - tizen_remote_surface_set_buffer_changed_event_filter(info->surface, type); - } - - h->changed_filter = type; - - return 0; -} diff --git a/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h b/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h index d1e67d8..75959dd 100644 --- a/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h @@ -36,13 +36,6 @@ extern "C" { * @addtogroup CAPI_SCREEN_CONNECTOR_WATCHER_EVAS_MODULE * @{ */ -typedef enum { - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_NONE, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_TBM, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_IMAGE_FILE, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_ALL = - TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_BUFFER_CHANGED_EVENT_FILTER_IMAGE_FILE, -} screen_connector_evas_changed_event_filter_type; typedef void (*screen_connector_watcher_evas_added_cb)(const char *appid, const char *instance_id, const int pid, void *data); typedef void (*screen_connector_watcher_evas_removed_cb)(const char *appid, const char *instance_id, const int pid, void *data); @@ -62,8 +55,6 @@ int screen_connector_watcher_evas_fini(void); screen_connector_watcher_evas_h screen_connector_watcher_evas_add(screen_connector_watcher_evas_ops *ops, void *data); int screen_connector_watcher_evas_remove(screen_connector_watcher_evas_h h); int screen_connector_watcher_evas_update(screen_connector_watcher_evas_h watcher_evas_h, const char *instance_id); -int screen_connector_watcher_evas_set_changed_event_filter(screen_connector_watcher_evas_h watcher_evas_h, - screen_connector_evas_changed_event_filter_type type); /** * @} 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 b39b4cf..0e4d177 100644 --- a/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c @@ -302,8 +302,3 @@ EXPORT_API int screen_connector_watcher_evas_update(screen_connector_watcher_eva return screen_connector_watcher_update(watcher_evas_h->watcher_h, instance_id); } -EXPORT_API int screen_connector_watcher_evas_set_changed_event_filter(screen_connector_watcher_evas_h watcher_evas_h, - screen_connector_evas_changed_event_filter_type type) -{ - return screen_connector_watcher_set_changed_event_filter(watcher_evas_h->watcher_h, type); -} -- 2.7.4