From d85b184aed7f172f6a885baefa7aef253c05d569 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 23 Mar 2017 10:45:19 +0900 Subject: [PATCH 01/16] Set license using %license Change-Id: I3345dce2d17af2758e37f790532eb448dfd9485f Signed-off-by: Hyunho Kang --- packaging/libscreen_connector.spec | 6 +++--- screen_connector_provider/CMakeLists.txt | 3 +-- screen_connector_watcher/CMakeLists.txt | 1 - screen_connector_watcher_evas/CMakeLists.txt | 1 - 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packaging/libscreen_connector.spec b/packaging/libscreen_connector.spec index d9d69d0..9b9423e 100644 --- a/packaging/libscreen_connector.spec +++ b/packaging/libscreen_connector.spec @@ -70,7 +70,7 @@ 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* -%{_datarootdir}/license/%{name}_watcher +%license LICENSE %files -n %{name}_watcher-devel %{_includedir}/screen_connector_watcher/*.h @@ -102,7 +102,7 @@ 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* -%{_datarootdir}/license/%{name}_provider +%license LICENSE %files -n %{name}_provider-devel %{_includedir}/screen_connector_provider/*.h @@ -134,7 +134,7 @@ 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* -%{_datarootdir}/license/%{name}_watcher_evas +%license LICENSE %files -n %{name}_watcher_evas-devel %{_includedir}/screen_connector_watcher_evas/*.h diff --git a/screen_connector_provider/CMakeLists.txt b/screen_connector_provider/CMakeLists.txt index d509838..2e5280c 100644 --- a/screen_connector_provider/CMakeLists.txt +++ b/screen_connector_provider/CMakeLists.txt @@ -43,5 +43,4 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME} INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) -INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION include/${PROJECT_NAME} FILES_MATCHING PATTERN "*.h") -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}") +INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION include/${PROJECT_NAME} FILES_MATCHING PATTERN "*.h") \ No newline at end of file diff --git a/screen_connector_watcher/CMakeLists.txt b/screen_connector_watcher/CMakeLists.txt index 56ac0a4..15fd826 100644 --- a/screen_connector_watcher/CMakeLists.txt +++ b/screen_connector_watcher/CMakeLists.txt @@ -44,4 +44,3 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME} INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION include/${PROJECT_NAME} FILES_MATCHING PATTERN "*.h") -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}") diff --git a/screen_connector_watcher_evas/CMakeLists.txt b/screen_connector_watcher_evas/CMakeLists.txt index bb8e182..7d34623 100644 --- a/screen_connector_watcher_evas/CMakeLists.txt +++ b/screen_connector_watcher_evas/CMakeLists.txt @@ -41,4 +41,3 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME} INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION include/${PROJECT_NAME} FILES_MATCHING PATTERN "*.h") -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}") -- 2.7.4 From 59197d0db58ff9ca748fd264c8b93265f951da15 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 23 Mar 2017 13:50:01 +0900 Subject: [PATCH 02/16] Release version 1.1.8 Changes: - Set license using %license - Add tbm buffer destroy logic Change-Id: Idf1200bdd93101865171ec938d3b372f8c56ac65 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 9b9423e..574b801 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.7 +Version: 1.1.8 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From bce37e7bd85b5a2777f1dcebc999b598c35f3fcb Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 24 Mar 2017 17:39:29 +0900 Subject: [PATCH 03/16] Fix callback disapeared bug For locally declared callback function, screen_connector_toolkit_add should copy and store callback functions. Change-Id: I14ac550d5f062e03315046bedd0b69649972255f Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit.c | 23 ++++++++++++++++++++-- .../src/screen_connector_toolkit_evas.c | 22 ++++++++++----------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/screen_connector_watcher/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c index b9f31e4..910d73f 100644 --- a/screen_connector_watcher/src/screen_connector_toolkit.c +++ b/screen_connector_watcher/src/screen_connector_toolkit.c @@ -247,17 +247,26 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_create_handle(cha screen_connector_toolkit_ops *ops, void *data) { screen_connector_toolkit_h toolkit_h = NULL; + screen_connector_toolkit_ops *ops_copy; + + 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->surface_id = surface_id; toolkit_h->appid = strdup(id); toolkit_h->instance_id = strdup(id); toolkit_h->data = data; - toolkit_h->ops = ops; + toolkit_h->ops = ops_copy; return toolkit_h; } @@ -267,6 +276,7 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add(screen_connec { screen_connector_toolkit_h toolkit_h = NULL; screen_connector_type_h type_h = NULL; + screen_connector_toolkit_ops *ops_copy; if (id == NULL || ops == NULL) { LOGE("Invalid param"); @@ -279,14 +289,23 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add(screen_connec 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); toolkit_h->data = data; - toolkit_h->ops = ops; + toolkit_h->ops = ops_copy; toolkit_h->type_h = type_h; if (type_h->toolkit_table == NULL) 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 da88b31..5a78547 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -586,7 +586,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(scr { screen_connector_toolkit_evas_h handle; screen_connector_toolkit_evas_ops *evas_ops; - screen_connector_toolkit_ops *toolkit_ops; + screen_connector_toolkit_ops toolkit_ops; screen_connector_type_evas_h type_h; int int_type = type; @@ -596,10 +596,9 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(scr return NULL; } - toolkit_ops = (screen_connector_toolkit_ops *)calloc(1, sizeof(screen_connector_toolkit_ops)); - toolkit_ops->added_cb = __toolkit_added_cb; - toolkit_ops->updated_cb = __toolkit_update_cb; - toolkit_ops->removed_cb = __toolkit_removed_cb; + toolkit_ops.added_cb = __toolkit_added_cb; + toolkit_ops.updated_cb = __toolkit_update_cb; + 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) { @@ -618,7 +617,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(scr handle->ops = evas_ops; handle->data = data; handle->type_h = type_h; - handle->toolkit_h = screen_connector_toolkit_add(toolkit_ops, id, type, handle); + handle->toolkit_h = screen_connector_toolkit_add(&toolkit_ops, id, type, handle); return handle; } @@ -834,7 +833,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_by_ { screen_connector_toolkit_evas_h handle; screen_connector_toolkit_evas_ops *evas_ops; - screen_connector_toolkit_ops *toolkit_ops; + screen_connector_toolkit_ops toolkit_ops; screen_connector_type_evas_h type_h; char rid_str[32]; @@ -844,10 +843,9 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_by_ return NULL; } - toolkit_ops = (screen_connector_toolkit_ops *)calloc(1, sizeof(screen_connector_toolkit_ops)); - toolkit_ops->added_cb = __toolkit_added_cb; - toolkit_ops->updated_cb = __toolkit_update_cb; - toolkit_ops->removed_cb = __toolkit_removed_cb; + toolkit_ops.added_cb = __toolkit_added_cb; + toolkit_ops.updated_cb = __toolkit_update_cb; + 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) { @@ -868,7 +866,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_by_ handle->type_h = type_h; snprintf(rid_str, sizeof(rid_str), "%d", res_id); - handle->toolkit_h = screen_connector_toolkit_create_handle(rid_str, res_id, toolkit_ops, handle); + handle->toolkit_h = screen_connector_toolkit_create_handle(rid_str, res_id, &toolkit_ops, handle); screen_connector_toolkit_redirect_surface(handle->toolkit_h); return handle; -- 2.7.4 From 3f5bdefed32089d2c41b2510edcb81aa12473945 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Mon, 27 Mar 2017 10:47:15 +0900 Subject: [PATCH 04/16] Release version 1.1.9 Changes: - Fix callback disapeared bug Change-Id: I5c32d7f66a42e90a08f5b5c5cb21a6d372c8eb65 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 574b801..a5ce933 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.8 +Version: 1.1.9 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 7dc3034997783c336c8fcaab761d4cfffa93a0e9 Mon Sep 17 00:00:00 2001 From: "seungha.son" Date: Mon, 3 Apr 2017 09:39:45 +0900 Subject: [PATCH 05/16] Fix memory leak Signed-off-by: seungha.son Change-Id: I81669725500ecf915feca52bbb303aa8cb55bea1 --- screen_connector_watcher_evas/src/screen_connector_watcher_evas.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 3f0eddc..0e4d177 100644 --- a/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c @@ -231,18 +231,22 @@ static void __watcher_update_cb(struct tizen_remote_surface *trs, uint32_t type, EXPORT_API screen_connector_watcher_evas_h screen_connector_watcher_evas_add(screen_connector_watcher_evas_ops *ops, void *data) { - screen_connector_watcher_evas_h handle; screen_connector_watcher_evas_ops *evas_ops; screen_connector_watcher_ops *watcher_ops; watcher_ops = (screen_connector_watcher_ops *)calloc(1, sizeof(screen_connector_watcher_ops)); + if (watcher_ops == NULL) { + LOGE("watcher_ops calloc fail"); + return NULL; + } watcher_ops->added_cb = __watcher_added_cb; watcher_ops->updated_cb = __watcher_update_cb; watcher_ops->removed_cb = __watcher_removed_cb; evas_ops = (screen_connector_watcher_evas_ops *)calloc(1, sizeof(screen_connector_watcher_evas_ops)); if (evas_ops == NULL) { + free(watcher_ops); LOGE("evas_ops calloc fail"); return NULL; } @@ -251,6 +255,7 @@ EXPORT_API screen_connector_watcher_evas_h screen_connector_watcher_evas_add(scr handle = (screen_connector_watcher_evas_h)calloc(1, sizeof(struct _screen_connector_watcher_evas_h)); if (handle == NULL) { LOGE("handle calloc fail"); + free(watcher_ops); free(evas_ops); return NULL; } @@ -259,7 +264,6 @@ EXPORT_API screen_connector_watcher_evas_h screen_connector_watcher_evas_add(scr handle->watcher_h = screen_connector_watcher_add(watcher_ops, handle); return handle; - } static void __destroy_watcher_evas_handle(screen_connector_watcher_evas_h watcher_evas_h) -- 2.7.4 From 0b07eb5a3e067f73857aae585ac369433ad8e1fa Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Mon, 3 Apr 2017 10:27:59 +0900 Subject: [PATCH 06/16] Fix memory leak Change-Id: Ie3ff7bcbb7340b1e6336e19ad5b2e1ab667dda0e Signed-off-by: Hyunho Kang --- screen_connector_watcher/src/screen_connector_watcher.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/screen_connector_watcher/src/screen_connector_watcher.c b/screen_connector_watcher/src/screen_connector_watcher.c index 36df1d9..02bd07b 100644 --- a/screen_connector_watcher/src/screen_connector_watcher.c +++ b/screen_connector_watcher/src/screen_connector_watcher.c @@ -206,6 +206,9 @@ static void __destroy_watcher_h(screen_connector_watcher_h handle) if (!handle) return; + if (handle->ops) + free(handle->ops); + if (handle->aul_handle) aul_screen_connector_remove_screen_viewer(handle->aul_handle); -- 2.7.4 From 7981aaf9473db213949a54dffea7e0344d7cb182 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Wed, 12 Apr 2017 20:39:40 +0900 Subject: [PATCH 07/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 08/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 09/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 10/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 11/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 12/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 13/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 14/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 15/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 16/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