From ad23f7e5787e269085d40721d9819d3e2b7725d0 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 26 Jul 2017 12:03:23 +0900 Subject: [PATCH 01/16] Add missing code to find type handle The screen_connector_toolkit_init() MUST be called before calling screen_connector_toolkit_add(). Change-Id: I1e6692dab3293b0947889d6a7156effa5b59edd8 Signed-off-by: Hwankyu Jhun --- screen_connector_watcher/src/screen_connector_toolkit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/screen_connector_watcher/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c index 4e5b043..90c07e4 100644 --- a/screen_connector_watcher/src/screen_connector_toolkit.c +++ b/screen_connector_watcher/src/screen_connector_toolkit.c @@ -390,6 +390,12 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add(screen_connec return NULL; } + type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type)); + if (type_h == NULL) { + LOGE("Type(%s) is not initializaed", 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"); -- 2.7.4 From afdcf0b2ce3ae2593bc1a447b6e598879387c431 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 20 Jul 2017 15:53:27 +0900 Subject: [PATCH 02/16] Send move event before mouse up event For consistency with old version of widget framework Change-Id: Ib4d3dd9282f69f580a371dc79d901a9100ffd326 Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 45 ++++++++++++++++++++++ 1 file changed, 45 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 b32c04f..5349bf0 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -70,6 +70,21 @@ struct _screen_connector_toolkit_evas_h { void *data; }; +struct _move_event_info { + double x; + double y; + double rx; + double ry; + double pressure; + double angle; + double class; + double sub_class; + const char *desc; + unsigned int timestamp; +}; + +static struct _move_event_info __last_move; + static GHashTable *__cur_buffer_table = NULL; static GHashTable *__type_table = NULL; static Ecore_Event_Handler *__visibility_listener; @@ -481,6 +496,25 @@ static void __rs_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_ return; } + /* + * We need to send last move event for + * consistency with old widget framework + */ + tizen_remote_surface_transfer_mouse_event(surface, + TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE, + 0, + 0, + __last_move.x, + __last_move.y, + __last_move.rx, + __last_move.ry, + __last_move.pressure, + __last_move.angle, + __last_move.class, + __last_move.sub_class, + __last_move.desc, + __last_move.timestamp); + tizen_remote_surface_transfer_mouse_event(surface, TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP, 0, @@ -510,6 +544,17 @@ static void __rs_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *even evas_object_geometry_get(obj, &x, &y, &w, &h); + __last_move.x = ev->cur.canvas.x - x; + __last_move.y = ev->cur.canvas.y - y; + __last_move.rx = wl_fixed_from_double(ev->radius_x); + __last_move.ry = wl_fixed_from_double(ev->radius_y); + __last_move.pressure = wl_fixed_from_double(ev->pressure); + __last_move.angle = wl_fixed_from_double(ev->angle); + __last_move.class = evas_device_class_get(ev->dev); + __last_move.sub_class = evas_device_subclass_get(ev->dev); + __last_move.desc = desc; + __last_move.timestamp = ev->timestamp; + LOGD("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y); if (desc == NULL) -- 2.7.4 From 525e6626c07915a606816650f3fb5522b52a5c55 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Tue, 1 Aug 2017 17:44:29 +0900 Subject: [PATCH 03/16] Modify log level Change-Id: Idb42508475d29b5afadf2dcc7ddb16886f447cf3 Signed-off-by: Hyunho Kang --- screen_connector_watcher/src/screen_connector_toolkit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screen_connector_watcher/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c index 90c07e4..c463e2d 100644 --- a/screen_connector_watcher/src/screen_connector_toolkit.c +++ b/screen_connector_watcher/src/screen_connector_toolkit.c @@ -182,7 +182,7 @@ static void __aul_screen_viewer_cb(const char *appid, const char *instance_id, toolkit_h = (screen_connector_toolkit_h)g_hash_table_lookup(type_h->toolkit_table, instance_id); if (toolkit_h == NULL) { - LOGD("It's not my instance_id, maybe alread removed %s ", instance_id); + LOGW("It's not my instance_id, maybe alread removed %s ", instance_id); return; } -- 2.7.4 From a952e6651bd2d9948e2d158342aa25d3034a9861 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Thu, 3 Aug 2017 17:19:09 +0900 Subject: [PATCH 04/16] Cancel mouse event when the widget is invisible - After wdiget is paused, the event for mouse events may be ignored - If mouse-up event is missed, a button will not be enabled again - To cover this issue, mouse-cancel event should be sent when the widget is paused Change-Id: Ife9eec5971dab78a949ab0826f91a902740365bc Signed-off-by: Junghoon Park --- screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c | 7 +++++-- 1 file changed, 5 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 5349bf0..453b3da 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -59,7 +59,6 @@ struct _screen_connector_toolkit_evas_h { screen_connector_toolkit_h toolkit_h; int freeze; bool is_init; - bool cancel_touch; Evas_Object *img_tbm; Evas_Object *img_file; uint32_t img_type; @@ -384,6 +383,9 @@ static int __set_visibility(screen_connector_toolkit_evas_h toolkit_evas_h, visi return -1; if (__delayed_resuming_time == 0) { + if (obscured == TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_INVISIBLE) + tizen_remote_surface_transfer_touch_cancel(surface); + tizen_remote_surface_transfer_visibility(surface, obscured); return 0; @@ -394,6 +396,8 @@ static int __set_visibility(screen_connector_toolkit_evas_h toolkit_evas_h, visi g_source_remove(toolkit_evas_h->resuming_timer); toolkit_evas_h->resuming_timer = 0; } + + tizen_remote_surface_transfer_touch_cancel(surface); tizen_remote_surface_transfer_visibility(surface, obscured); } else { if (toolkit_evas_h->resuming_timer == 0) { @@ -1174,7 +1178,6 @@ EXPORT_API int screen_connector_toolkit_evas_send_touch_cancel(Evas_Object *obj) } tizen_remote_surface_transfer_touch_cancel(surface); - toolkit_evas_h->cancel_touch = true; } else { LOGE("surface not yet initialized."); return -1; -- 2.7.4 From a5c94cea9e785704ed46941d148b42aba095dcdd Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 3 Aug 2017 20:51:03 +0900 Subject: [PATCH 05/16] Fix mouse up crash If DESC value do not copied, tizen_remote_surface_transfer_mouse_event will send trash value. Change-Id: I4690a1d76671f7ce4394c7c9b36e2a78795b23b3 Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 48 +++++----------------- 1 file changed, 11 insertions(+), 37 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 453b3da..bb9e8b4 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -69,21 +69,6 @@ struct _screen_connector_toolkit_evas_h { void *data; }; -struct _move_event_info { - double x; - double y; - double rx; - double ry; - double pressure; - double angle; - double class; - double sub_class; - const char *desc; - unsigned int timestamp; -}; - -static struct _move_event_info __last_move; - static GHashTable *__cur_buffer_table = NULL; static GHashTable *__type_table = NULL; static Ecore_Event_Handler *__visibility_listener; @@ -501,23 +486,23 @@ static void __rs_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_ } /* - * We need to send last move event for + * We need to send move event for * consistency with old widget framework */ tizen_remote_surface_transfer_mouse_event(surface, TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE, 0, 0, - __last_move.x, - __last_move.y, - __last_move.rx, - __last_move.ry, - __last_move.pressure, - __last_move.angle, - __last_move.class, - __last_move.sub_class, - __last_move.desc, - __last_move.timestamp); + ev->canvas.x - x, + ev->canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); tizen_remote_surface_transfer_mouse_event(surface, TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP, @@ -548,17 +533,6 @@ static void __rs_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *even evas_object_geometry_get(obj, &x, &y, &w, &h); - __last_move.x = ev->cur.canvas.x - x; - __last_move.y = ev->cur.canvas.y - y; - __last_move.rx = wl_fixed_from_double(ev->radius_x); - __last_move.ry = wl_fixed_from_double(ev->radius_y); - __last_move.pressure = wl_fixed_from_double(ev->pressure); - __last_move.angle = wl_fixed_from_double(ev->angle); - __last_move.class = evas_device_class_get(ev->dev); - __last_move.sub_class = evas_device_subclass_get(ev->dev); - __last_move.desc = desc; - __last_move.timestamp = ev->timestamp; - LOGD("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y); if (desc == NULL) -- 2.7.4 From 8e24c3cae7bfec9d9a2b0758010a7dcc6579752c Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Tue, 8 Aug 2017 11:12:14 +0900 Subject: [PATCH 06/16] Add api to get auto visibility - screen_connector_toolkit_evas_auto_visibility Change-Id: I7896c097d45573f06cea2a2d8e81e53831027389 Signed-off-by: Hyunho Kang --- .../include/screen_connector_toolkit_evas.h | 3 ++- .../src/screen_connector_toolkit_evas.c | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) 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 6b16d7d..31164d6 100644 --- a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h @@ -114,7 +114,8 @@ 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); int screen_connector_toolkit_evas_is_visible(Evas_Object *obj, bool *is_visible); - +visibility_type screen_connector_toolkit_evas_auto_visibility( + screen_connector_toolkit_evas_h h); /** * @} 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 bb9e8b4..ed3e337 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -66,6 +66,7 @@ struct _screen_connector_toolkit_evas_h { struct _screen_connector_type_evas_h *type_h; guint resuming_timer; GList *viewer_visibility_list; + visibility_type auto_visibility; void *data; }; @@ -404,9 +405,11 @@ static void __obj_update_visibility(void *data, Evas *e, Evas_Object *obj, void } if (__obj_is_visible(toolkit_evas_h)) - __set_visibility(toolkit_evas_h, VISIBILITY_TYPE_UNOBSCURED); + toolkit_evas_h->auto_visibility = VISIBILITY_TYPE_UNOBSCURED; else - __set_visibility(toolkit_evas_h, VISIBILITY_TYPE_FULLY_OBSCURED); + toolkit_evas_h->auto_visibility = VISIBILITY_TYPE_FULLY_OBSCURED; + + __set_visibility(toolkit_evas_h, toolkit_evas_h->auto_visibility); } static void __rs_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) @@ -987,6 +990,7 @@ static void __send_visibility(gpointer key, gpointer value, gpointer user_data) LOGW("set visibility to %d", type); ret = __set_visibility(toolkit_evas_h, type); + toolkit_evas_h->auto_visibility = type; if (ret == -1) LOGE("failed to set object visibility set %p to %d", toolkit_evas_h->img_tbm, type); } @@ -1308,3 +1312,14 @@ EXPORT_API int screen_connector_toolkit_evas_unbind(screen_connector_toolkit_eva return screen_connector_toolkit_unbind(h->toolkit_h); } + +EXPORT_API visibility_type screen_connector_toolkit_evas_auto_visibility( + screen_connector_toolkit_evas_h h) +{ + if (!h) { + LOGE("invalid argument %p", h); + return -1; + } + + return h->auto_visibility; +} -- 2.7.4 From 21ff0080dd0b0d146da9370e4f2c9da08a09c6d5 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Wed, 9 Aug 2017 22:21:58 +0900 Subject: [PATCH 07/16] Clear buffer reference when toolkit removed When provider died referenced remote surface buffer should be released Change-Id: I8f7dd1542b2596b9f4afc11b99d5f5c327476ebe Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 10 ++++++++++ 1 file changed, 10 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 ed3e337..164b4f5 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -165,7 +165,9 @@ static void __clear_img_file(screen_connector_toolkit_evas_h toolkit_evas_h) static void __destroy_toolkit_evas_h(gpointer data) { char *plug_id; + cur_buffer_info_h c_buf_info; screen_connector_toolkit_evas_h toolkit_evas_h = data; + struct tizen_remote_surface *surface; if (!toolkit_evas_h) return; @@ -206,6 +208,14 @@ static void __destroy_toolkit_evas_h(gpointer data) EVAS_CALLBACK_MOVE, __obj_update_visibility); + c_buf_info = g_hash_table_lookup(__cur_buffer_table, + toolkit_evas_h->cur_buffer); + if (c_buf_info != NULL) { + surface = screen_connector_toolkit_get_trs( + toolkit_evas_h->toolkit_h); + __cur_buffer_info_unref(surface, c_buf_info); + } + plug_id = evas_object_data_del(toolkit_evas_h->img_tbm, "___PLUGID"); if (plug_id) free(plug_id); -- 2.7.4 From 93fc7aec67a91c27d450c4d0afcf4bc7a8f3ea85 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Thu, 10 Aug 2017 18:17:17 +0900 Subject: [PATCH 08/16] Cancel touch event when the screen is binding Change-Id: Iafdc141469730d9963ee0625a0d115716329899d Signed-off-by: Junghoon Park --- screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c | 5 ++++- 1 file changed, 4 insertions(+), 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 164b4f5..9ce2c63 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -1282,6 +1282,7 @@ EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_ struct wl_surface *surface; Ecore_Wl_Window *wl_win; viewer_visibility_h visibility_h; + struct tizen_remote_surface *trs; if (!h) return -1; @@ -1309,7 +1310,9 @@ EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_ h->viewer_visibility_list = g_list_append(h->viewer_visibility_list, visibility_h); - + trs = screen_connector_toolkit_get_trs(h->toolkit_h); + if (trs) + tizen_remote_surface_transfer_touch_cancel(trs); return screen_connector_toolkit_bind(h->toolkit_h, surface); } -- 2.7.4 From 2008679a88c2593b8928b33243f72aae707e41b3 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Wed, 16 Aug 2017 12:04:34 +0900 Subject: [PATCH 09/16] Unref buffer before bind surface Buffer should be released before bind, if not watch window can not use one buffer which referenced by watch application Change-Id: I780e709776366e8a40a083c3c7fd08451cb4983e Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 12 ++++++++++++ 1 file changed, 12 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 9ce2c63..fdf095b 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -1283,6 +1283,7 @@ EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_ Ecore_Wl_Window *wl_win; viewer_visibility_h visibility_h; struct tizen_remote_surface *trs; + cur_buffer_info_h c_buf_info; if (!h) return -1; @@ -1313,6 +1314,17 @@ EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_ trs = screen_connector_toolkit_get_trs(h->toolkit_h); if (trs) tizen_remote_surface_transfer_touch_cancel(trs); + + if (h->cur_buffer) { + if (tizen_remote_surface_get_version(trs) + >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) { + c_buf_info = g_hash_table_lookup( + __cur_buffer_table, h->cur_buffer); + if (c_buf_info != NULL) + __cur_buffer_info_unref(trs, c_buf_info); + } + } + return screen_connector_toolkit_bind(h->toolkit_h, surface); } -- 2.7.4 From af1aca75409c637badc25f50ca6069c65f762dcb Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Wed, 16 Aug 2017 17:06:46 +0900 Subject: [PATCH 10/16] Send multi-down/up events to Display Server - The events for multi-touch were not considered Change-Id: Iabe2d27f719fb8e2064caf7cfb4473309c07e7f4 Signed-off-by: Junghoon Park --- .../src/screen_connector_toolkit_evas.c | 108 +++++++++++++++++++++ 1 file changed, 108 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 fdf095b..a8eceae 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -77,6 +77,8 @@ static int __delayed_resuming_time; static void __rs_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); static void __rs_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void __rs_cb_touch_multi_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void __rs_cb_touch_multi_up(void *data, Evas *e, Evas_Object *obj, void *event_info); static void __rs_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); static void __rs_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info); static void __rs_cb_show(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -184,6 +186,14 @@ static void __destroy_toolkit_evas_h(gpointer data) __rs_cb_mouse_up); evas_object_event_callback_del( toolkit_evas_h->img_tbm, + EVAS_CALLBACK_MULTI_DOWN, + __rs_cb_touch_multi_down); + evas_object_event_callback_del( + toolkit_evas_h->img_tbm, + EVAS_CALLBACK_MULTI_UP, + __rs_cb_touch_multi_up); + evas_object_event_callback_del( + toolkit_evas_h->img_tbm, EVAS_CALLBACK_MOUSE_MOVE, __rs_cb_mouse_move); evas_object_event_callback_del( @@ -533,6 +543,98 @@ static void __rs_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_ ev->timestamp); } +static void __rs_cb_touch_multi_down(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_Multi_Down *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("multi down: %d %d", ev->canvas.x - x, ev->canvas.y - y); + + if (desc == NULL) + desc = ""; + + if (screen_connector_toolkit_check_input_disabled(toolkit_evas_h->toolkit_h, + SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_UP_DOWN)) { + LOGD("multi down disabled"); + return; + } + + surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h); + if (surface == NULL) { + LOGE("surface is NULL"); + return; + } + + tizen_remote_surface_transfer_touch_event(surface, + TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_DOWN, + ev->device, + 1, + ev->canvas.x - x, + ev->canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + +static void __rs_cb_touch_multi_up(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_Multi_Up *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("multi up: %d %d", ev->canvas.x - x, ev->canvas.y - y); + + if (desc == NULL) + desc = ""; + + if (screen_connector_toolkit_check_input_disabled(toolkit_evas_h->toolkit_h, + SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_UP_DOWN)) { + LOGD("multi up disabled"); + return; + } + + surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h); + if (surface == NULL) { + LOGE("surface is NULL"); + return; + } + + tizen_remote_surface_transfer_touch_event(surface, + TIZEN_REMOTE_SURFACE_EVENT_TYPE_TOUCH_UP, + ev->device, + 1, + ev->canvas.x - x, + ev->canvas.y - y, + wl_fixed_from_double(ev->radius_x), + wl_fixed_from_double(ev->radius_y), + wl_fixed_from_double(ev->pressure), + wl_fixed_from_double(ev->angle), + evas_device_class_get(ev->dev), + evas_device_subclass_get(ev->dev), + desc, + ev->timestamp); +} + static void __rs_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) { screen_connector_toolkit_evas_h toolkit_evas_h = (screen_connector_toolkit_evas_h)data; @@ -660,6 +762,12 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, EVAS_CALLBACK_MOUSE_UP, __rs_cb_mouse_up, toolkit_evas_h); evas_object_event_callback_add(toolkit_evas_h->img_tbm, + EVAS_CALLBACK_MULTI_DOWN, + __rs_cb_touch_multi_down, toolkit_evas_h); + evas_object_event_callback_add(toolkit_evas_h->img_tbm, + EVAS_CALLBACK_MULTI_UP, + __rs_cb_touch_multi_up, toolkit_evas_h); + evas_object_event_callback_add(toolkit_evas_h->img_tbm, EVAS_CALLBACK_MOUSE_MOVE, __rs_cb_mouse_move, toolkit_evas_h); evas_object_event_callback_add(toolkit_evas_h->img_tbm, -- 2.7.4 From c239e6329ab6de6e721c8a0c8a1007786c54a2c7 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Wed, 16 Aug 2017 22:34:27 +0900 Subject: [PATCH 11/16] Fix viewer list handling bug Change-Id: Id3ab579548e6dd5a7e7b4bb3f353f90415d275ba Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 114 +++++++++++++++------ 1 file changed, 82 insertions(+), 32 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 a8eceae..2004d00 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -67,6 +67,7 @@ struct _screen_connector_toolkit_evas_h { guint resuming_timer; GList *viewer_visibility_list; visibility_type auto_visibility; + int bind_win_id; void *data; }; @@ -93,6 +94,67 @@ static gint __comp_win_id(gconstpointer a, gconstpointer b) return !(win->win_id == GPOINTER_TO_INT(b)); } +static int __set_window_visibility_info( + screen_connector_toolkit_evas_h h, + int win_id, visibility_type visibility) +{ + viewer_visibility_h visibility_h; + GList *tmp_list = NULL; + + if (h->viewer_visibility_list) + tmp_list = g_list_find_custom( + h->viewer_visibility_list, + GINT_TO_POINTER(win_id), __comp_win_id); + + if (tmp_list == NULL) { + visibility_h = (viewer_visibility_h)calloc(1, + sizeof(struct _viewer_visibility_h)); + if (visibility_h == NULL) { + LOGE("Out of memory fail to alloc"); + return -1; + } + h->viewer_visibility_list = + g_list_append( + h->viewer_visibility_list, + visibility_h); + } else { + visibility_h = (viewer_visibility_h)tmp_list->data; + } + visibility_h->win_id = win_id; + visibility_h->visibility = visibility; + + LOGI("set win(%d) to (%d), len(%d)", win_id, visibility, g_list_length(h->viewer_visibility_list)); + + return 0; +} + +static int __remove_window_visibility_info( + screen_connector_toolkit_evas_h h, + int win_id) +{ + viewer_visibility_h visibility_h; + GList *tmp_list; + + tmp_list = g_list_find_custom( + h->viewer_visibility_list, + GINT_TO_POINTER(win_id), __comp_win_id); + + if (tmp_list == NULL) { + LOGE("win id %d not exist"); + return -1; + } + + visibility_h = (viewer_visibility_h)tmp_list->data; + h->viewer_visibility_list = g_list_remove( + h->viewer_visibility_list, + visibility_h); + free(visibility_h); + + LOGI("remove win(%d) len(%d)", win_id, g_list_length(h->viewer_visibility_list)); + + return 0; +} + static void __destroy_type_h(gpointer data) { screen_connector_type_evas_h type_h = (screen_connector_type_evas_h)data; @@ -745,6 +807,7 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, screen_connector_toolkit_evas_h toolkit_evas_h; cur_buffer_info_h c_buf_info; bool duplicate_buffer = false; + Ecore_Wl_Window *wl_win; toolkit_evas_h = (screen_connector_toolkit_evas_h)data; if (toolkit_evas_h->img_tbm == NULL) { @@ -793,6 +856,14 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, 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); + + wl_win = elm_win_wl_window_get( + toolkit_evas_h->type_h->viewer_win); + if (!wl_win) + LOGE("failed to get wl_win"); + + __set_window_visibility_info(toolkit_evas_h, ecore_wl_window_id_get(wl_win), + VISIBILITY_TYPE_UNKNOWN); } if (toolkit_evas_h->img_type != type) @@ -1053,7 +1124,6 @@ static void __send_visibility(gpointer key, gpointer value, gpointer user_data) Ecore_Wl_Event_Window_Visibility_Change *ev = user_data; int ret; visibility_type type; - GList *tmp_list = NULL; GList *iter; viewer_visibility_h visibility_h; @@ -1068,29 +1138,8 @@ static void __send_visibility(gpointer key, gpointer value, gpointer user_data) else type = VISIBILITY_TYPE_UNOBSCURED; - if (toolkit_evas_h->viewer_visibility_list) { - tmp_list = g_list_find_custom( - toolkit_evas_h->viewer_visibility_list, - GINT_TO_POINTER(ev->win), __comp_win_id); - } - - if (tmp_list == NULL) { - visibility_h = (viewer_visibility_h)calloc(1, - sizeof(struct _viewer_visibility_h)); - if (visibility_h == NULL) { - LOGE("Out of memory fail to alloc"); - return; - } - visibility_h->win_id = ev->win; - visibility_h->visibility = type; - toolkit_evas_h->viewer_visibility_list = - g_list_append(toolkit_evas_h->viewer_visibility_list, - visibility_h); - } else { - visibility_h = (viewer_visibility_h)tmp_list->data; - visibility_h->visibility = type; - } + __set_window_visibility_info(toolkit_evas_h, ev->win, type); type = VISIBILITY_TYPE_FULLY_OBSCURED; iter = toolkit_evas_h->viewer_visibility_list; while (iter != NULL) { @@ -1389,9 +1438,10 @@ EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_ { struct wl_surface *surface; Ecore_Wl_Window *wl_win; - viewer_visibility_h visibility_h; struct tizen_remote_surface *trs; cur_buffer_info_h c_buf_info; + int ret; + int bind_win_id; if (!h) return -1; @@ -1408,17 +1458,15 @@ EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_ return -1; } - visibility_h = (viewer_visibility_h)calloc(1, - sizeof(struct _viewer_visibility_h)); - if (visibility_h == NULL) { - LOGE("Out of memory fail to alloc"); + bind_win_id = ecore_wl_window_id_get(wl_win); + ret = __set_window_visibility_info(h, bind_win_id, + VISIBILITY_TYPE_UNKNOWN); + if (ret < 0) { + LOGE("failed to set visibility info"); return -1; } - visibility_h->win_id = ecore_wl_window_id_get(wl_win); - visibility_h->visibility = VISIBILITY_TYPE_UNKNOWN; + h->bind_win_id = bind_win_id; - h->viewer_visibility_list = - g_list_append(h->viewer_visibility_list, visibility_h); trs = screen_connector_toolkit_get_trs(h->toolkit_h); if (trs) tizen_remote_surface_transfer_touch_cancel(trs); @@ -1443,6 +1491,8 @@ EXPORT_API int screen_connector_toolkit_evas_unbind(screen_connector_toolkit_eva return -1; } + __remove_window_visibility_info(h, h->bind_win_id); + return screen_connector_toolkit_unbind(h->toolkit_h); } -- 2.7.4 From aa323773a0ca2776ac4f0bd54ced3dffd3198a12 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 17 Aug 2017 19:48:13 +0900 Subject: [PATCH 12/16] Fix deref after null Change-Id: I7ee8a408ea2c083fc29530aaf79c2c24161ac74f Signed-off-by: Hyunho Kang --- screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c | 6 +++++- 1 file changed, 5 insertions(+), 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 2004d00..7eda3cd 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -1468,8 +1468,12 @@ EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_ h->bind_win_id = bind_win_id; trs = screen_connector_toolkit_get_trs(h->toolkit_h); - if (trs) + if (trs) { tizen_remote_surface_transfer_touch_cancel(trs); + } else { + LOGE("failed to get tizen remote surface"); + return -1; + } if (h->cur_buffer) { if (tizen_remote_surface_get_version(trs) -- 2.7.4 From df2f2a5461d9cd98852e8bd4539298cd3ef726bc Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Mon, 21 Aug 2017 20:43:15 +0900 Subject: [PATCH 13/16] Do not use delayed resume for watch Change-Id: I4d3019fa937c25f58efaced3fc13376782e1e995 Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 9 ++++++++- 1 file changed, 8 insertions(+), 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 7eda3cd..2140a6c 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -68,6 +68,7 @@ struct _screen_connector_toolkit_evas_h { GList *viewer_visibility_list; visibility_type auto_visibility; int bind_win_id; + screen_connector_screen_type_e screen_type; void *data; }; @@ -415,6 +416,7 @@ static gboolean __resuming_timeout_cb(gpointer user_data) surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h); if (surface) { + LOGI("delayed resume"); tizen_remote_surface_transfer_visibility(surface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE); } @@ -450,10 +452,12 @@ static int __set_visibility(screen_connector_toolkit_evas_h toolkit_evas_h, visi if (!surface) return -1; - if (__delayed_resuming_time == 0) { + if (__delayed_resuming_time == 0 || + toolkit_evas_h->screen_type == SCREEN_CONNECTOR_SCREEEN_TYPE_WATCH) { if (obscured == TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_INVISIBLE) tizen_remote_surface_transfer_touch_cancel(surface); + LOGI("normal resume"); tizen_remote_surface_transfer_visibility(surface, obscured); return 0; @@ -1046,6 +1050,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_wit handle->data = data; handle->type_h = type_h; handle->toolkit_h = screen_connector_toolkit_add_with_surface(&toolkit_ops, id, type, surface, handle); + handle->screen_type = type; return handle; } @@ -1092,6 +1097,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(scr handle->data = data; handle->type_h = type_h; handle->toolkit_h = screen_connector_toolkit_add(&toolkit_ops, id, type, handle); + handle->screen_type = type; return handle; } @@ -1369,6 +1375,7 @@ EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_by_ handle->ops = evas_ops; handle->data = data; handle->type_h = type_h; + handle->screen_type = type; uuid_generate(u); uuid_unparse(u, uuid); -- 2.7.4 From aaa7258120a6adaa6a783cf9ee54f5f107e032ec Mon Sep 17 00:00:00 2001 From: Semun Lee Date: Mon, 21 Aug 2017 22:44:21 +0900 Subject: [PATCH 14/16] Manage toolkit handles in consistent way - upper layer is responsible for managing toolkits of lower layer Change-Id: I685035f8cade2e089392e0a01b44bf630f0a03d6 Signed-off-by: Semun Lee --- .../src/screen_connector_toolkit.c | 8 ++--- .../src/screen_connector_toolkit_evas.c | 42 ++++++++++++++-------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/screen_connector_watcher/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c index c463e2d..12f49d5 100644 --- a/screen_connector_watcher/src/screen_connector_toolkit.c +++ b/screen_connector_watcher/src/screen_connector_toolkit.c @@ -282,7 +282,7 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add_by_rid(screen 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_str_equal, free, NULL); g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h); @@ -341,7 +341,7 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add_with_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_str_equal, free, NULL); g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h); @@ -417,7 +417,7 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add(screen_connec 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_str_equal, free, NULL); g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h); @@ -445,7 +445,7 @@ EXPORT_API int screen_connector_toolkit_remove(screen_connector_toolkit_h h) } g_hash_table_remove(h->type_h->toolkit_table, h->instance_id); - + __destroy_toolkit_h(h); return 0; } 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 2140a6c..c4bbf2c 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -156,19 +156,6 @@ static int __remove_window_visibility_info( return 0; } -static void __destroy_type_h(gpointer data) -{ - screen_connector_type_evas_h type_h = (screen_connector_type_evas_h)data; - if (!type_h) - return; - - if (type_h->toolkit_table) { - g_hash_table_destroy(type_h->toolkit_table); - type_h->toolkit_table = NULL; - } - free(type_h); -} - static void __cur_buffer_info_ref(cur_buffer_info_h info) { info->ref_count++; @@ -311,6 +298,25 @@ static void __destroy_toolkit_evas_h(gpointer data) free(toolkit_evas_h); } +static void __destroy_type_h(gpointer data) +{ + GHashTableIter iter; + gpointer key, value; + screen_connector_type_evas_h type_h = (screen_connector_type_evas_h)data; + if (!type_h) + return; + + if (type_h->toolkit_table) { + g_hash_table_iter_init(&iter, type_h->toolkit_table); + while (g_hash_table_iter_next(&iter, &key, &value)) + __destroy_toolkit_evas_h(value); + + g_hash_table_destroy(type_h->toolkit_table); + type_h->toolkit_table = NULL; + } + free(type_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; @@ -327,7 +333,7 @@ EXPORT_API int screen_connector_toolkit_evas_init(Evas_Object *win, screen_conne 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); - type_h->toolkit_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, __destroy_toolkit_evas_h); + type_h->toolkit_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL); if (!type_h->toolkit_table) { LOGE("failed to create table"); return -1; @@ -341,6 +347,8 @@ EXPORT_API int screen_connector_toolkit_evas_init(Evas_Object *win, screen_conne EXPORT_API int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e type) { screen_connector_type_evas_h type_h; + GHashTableIter iter; + gpointer key, value; if (__type_table == NULL) { LOGI("__type_table is NULL"); @@ -350,6 +358,9 @@ EXPORT_API int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type)); if (type_h) { if (type_h->toolkit_table) { + g_hash_table_iter_init(&iter, type_h->toolkit_table); + while (g_hash_table_iter_next(&iter, &key, &value)) + __destroy_toolkit_evas_h(value); g_hash_table_destroy(type_h->toolkit_table); type_h->toolkit_table = NULL; } @@ -1114,8 +1125,11 @@ EXPORT_API int screen_connector_toolkit_evas_remove(screen_connector_toolkit_eva LOGE("Null instance_id"); return -1; } + g_hash_table_remove(handle->type_h->toolkit_table, instance_id); + __destroy_toolkit_evas_h(handle); + return 0; } -- 2.7.4 From d76cc70e6079cc3d8504dd483796284f2297bf21 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Tue, 22 Aug 2017 11:44:59 +0900 Subject: [PATCH 15/16] Add filter feature for screen_connector_toolkit Change-Id: I7aceb0ab0c9e1f6ac55532b69f1a23d68b267210 Signed-off-by: Hyunho Kang --- .../include/screen_connector_toolkit.h | 11 ++++++++++ .../src/screen_connector_toolkit.c | 24 ++++++++++++++++++++++ .../include/screen_connector_toolkit_evas.h | 10 +++++++++ .../src/screen_connector_toolkit_evas.c | 8 ++++++++ 4 files changed, 53 insertions(+) diff --git a/screen_connector_watcher/include/screen_connector_toolkit.h b/screen_connector_watcher/include/screen_connector_toolkit.h index a614720..a1d215e 100644 --- a/screen_connector_watcher/include/screen_connector_toolkit.h +++ b/screen_connector_watcher/include/screen_connector_toolkit.h @@ -25,6 +25,14 @@ extern "C" { #endif typedef enum { + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_NONE, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_ALL = + TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, +} screen_connector_changed_event_filter_type; + +typedef enum { SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_UP_DOWN = TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_UP_DOWN, SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_MOVE_X = TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X, SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_MOVE_Y = TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_Y, @@ -85,6 +93,9 @@ int screen_connector_toolkit_bind(screen_connector_toolkit_h h, struct wl_surfac int screen_connector_toolkit_unbind(screen_connector_toolkit_h h); bool screen_connector_toolkit_is_exist(char *id, screen_connector_screen_type_e type); +int screen_connector_toolkit_set_changed_event_filter( + screen_connector_toolkit_h h, + screen_connector_changed_event_filter_type type); #ifdef __cplusplus } diff --git a/screen_connector_watcher/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c index 12f49d5..66573d0 100644 --- a/screen_connector_watcher/src/screen_connector_toolkit.c +++ b/screen_connector_watcher/src/screen_connector_toolkit.c @@ -53,6 +53,7 @@ struct _screen_connector_toolkit_h { struct _screen_connector_type_h *type_h; void *data; struct wl_surface *bind_surface; + screen_connector_changed_event_filter_type changed_filter; }; static GHashTable *__type_table; @@ -110,6 +111,9 @@ EXPORT_API int screen_connector_toolkit_redirect_surface(screen_connector_toolki LOGD("resource_id : %d, (%p), %s", toolkit_h->surface_id, toolkit_h->surface, toolkit_h->instance_id); tizen_remote_surface_add_listener(toolkit_h->surface, &__rs_listener, toolkit_h); tizen_remote_surface_redirect(toolkit_h->surface); + tizen_remote_surface_set_changed_buffer_event_filter(toolkit_h->surface, + toolkit_h->changed_filter); + LOGD("set filter [%d] for [%s]", toolkit_h->changed_filter, toolkit_h->instance_id); if (toolkit_h->bind_surface != NULL) tizen_remote_surface_manager_bind_surface(rsm, toolkit_h->bind_surface, toolkit_h->surface); @@ -279,6 +283,7 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add_by_rid(screen toolkit_h->data = data; toolkit_h->ops = ops_copy; toolkit_h->type_h = type_h; + toolkit_h->changed_filter = SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE; if (type_h->toolkit_table == NULL) type_h->toolkit_table = g_hash_table_new_full(g_str_hash, @@ -338,6 +343,7 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add_with_surface( toolkit_h->ops = ops_copy; toolkit_h->type_h = type_h; toolkit_h->bind_surface = surface; + toolkit_h->changed_filter = SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE; if (type_h->toolkit_table == NULL) type_h->toolkit_table = g_hash_table_new_full(g_str_hash, @@ -414,6 +420,7 @@ EXPORT_API screen_connector_toolkit_h screen_connector_toolkit_add(screen_connec toolkit_h->data = data; toolkit_h->ops = ops_copy; toolkit_h->type_h = type_h; + toolkit_h->changed_filter = SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE; if (type_h->toolkit_table == NULL) type_h->toolkit_table = g_hash_table_new_full(g_str_hash, @@ -554,3 +561,20 @@ EXPORT_API int screen_connector_toolkit_unbind(screen_connector_toolkit_h h) } +EXPORT_API int screen_connector_toolkit_set_changed_event_filter( + screen_connector_toolkit_h h, + screen_connector_changed_event_filter_type type) +{ + if (h == NULL) { + LOGE("Invalid param"); + return -1; + } + + tizen_remote_surface_set_changed_buffer_event_filter(h->surface, type); + h->changed_filter = type; + LOGD("set filter [%d] for [%s]", + h->changed_filter, h->instance_id); + + return 0; +} + 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 31164d6..58073ed 100644 --- a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h @@ -38,6 +38,13 @@ extern "C" { * @addtogroup CAPI_SCREEN_CONNECTOR_WATCHER_EVAS_MODULE * @{ */ +typedef enum { + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_NONE, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_ALL = + TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, +} screen_connector_evas_changed_event_filter_type; typedef enum { VISIBILITY_TYPE_UNOBSCURED, @@ -116,6 +123,9 @@ screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_with_win(scree int screen_connector_toolkit_evas_is_visible(Evas_Object *obj, bool *is_visible); visibility_type screen_connector_toolkit_evas_auto_visibility( screen_connector_toolkit_evas_h h); +int screen_connector_toolkit_evas_set_changed_event_filter( + screen_connector_toolkit_evas_h toolkit_evas_h, + screen_connector_evas_changed_event_filter_type type); /** * @} 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 c4bbf2c..8c5544b 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -1531,3 +1531,11 @@ EXPORT_API visibility_type screen_connector_toolkit_evas_auto_visibility( return h->auto_visibility; } + +EXPORT_API int screen_connector_toolkit_evas_set_changed_event_filter( + screen_connector_toolkit_evas_h toolkit_evas_h, + screen_connector_evas_changed_event_filter_type type) +{ + return screen_connector_toolkit_set_changed_event_filter( + toolkit_evas_h->toolkit_h, type); +} -- 2.7.4 From 9509636995b52bcfa76c09ee5d6a61076be7816d Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Wed, 23 Aug 2017 21:15:46 +0900 Subject: [PATCH 16/16] Remove duplicate declaration Change-Id: Ia2bacc382d6e7b5614eb11d2aa985926ad684bec Signed-off-by: Hyunho Kang --- .../include/screen_connector_common.h | 42 ++++++++++++++++ .../include/screen_connector_toolkit.h | 11 +---- .../include/screen_connector_watcher.h | 11 +---- .../include/screen_connector_common_evas.h | 56 ++++++++++++++++++++++ .../include/screen_connector_toolkit_evas.h | 8 +--- .../include/screen_connector_watcher_evas.h | 8 +--- 6 files changed, 102 insertions(+), 34 deletions(-) create mode 100644 screen_connector_watcher/include/screen_connector_common.h create mode 100644 screen_connector_watcher_evas/include/screen_connector_common_evas.h diff --git a/screen_connector_watcher/include/screen_connector_common.h b/screen_connector_watcher/include/screen_connector_common.h new file mode 100644 index 0000000..4bb5149 --- /dev/null +++ b/screen_connector_watcher/include/screen_connector_common.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __SCREEN_CONNECTOR_COMMON_H__ +#define __SCREEN_CONNECTOR_COMMON_H__ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_NONE, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, + SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_ALL = + TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, +} screen_connector_changed_event_filter_type; + +#ifdef __cplusplus +} +#endif + +#endif /* __SCREEN_CONNECTOR_COMMON_H__ */ diff --git a/screen_connector_watcher/include/screen_connector_toolkit.h b/screen_connector_watcher/include/screen_connector_toolkit.h index a1d215e..1d91eee 100644 --- a/screen_connector_watcher/include/screen_connector_toolkit.h +++ b/screen_connector_watcher/include/screen_connector_toolkit.h @@ -17,22 +17,13 @@ #ifndef __SCREEN_CONNECTOR_TOOLKIT_H__ #define __SCREEN_CONNECTOR_TOOLKIT_H__ -#include -#include #include +#include #ifdef __cplusplus extern "C" { #endif typedef enum { - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_NONE, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_ALL = - TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, -} screen_connector_changed_event_filter_type; - -typedef enum { SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_UP_DOWN = TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_UP_DOWN, SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_MOVE_X = TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_X, SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_MOVE_Y = TIZEN_REMOTE_SURFACE_INPUT_EVENT_FILTER_MOUSE_MOVE_Y, diff --git a/screen_connector_watcher/include/screen_connector_watcher.h b/screen_connector_watcher/include/screen_connector_watcher.h index ca82edc..a9bc3e7 100644 --- a/screen_connector_watcher/include/screen_connector_watcher.h +++ b/screen_connector_watcher/include/screen_connector_watcher.h @@ -17,20 +17,11 @@ #ifndef __SCREEN_CONNECTOR_WATCHER_H__ #define __SCREEN_CONNECTOR_WATCHER_H__ -#include -#include +#include #ifdef __cplusplus extern "C" { #endif -typedef enum { - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_NONE, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, - SCREEN_CONNECTOR_CHANGED_EVENT_FILTER_ALL = - TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_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, diff --git a/screen_connector_watcher_evas/include/screen_connector_common_evas.h b/screen_connector_watcher_evas/include/screen_connector_common_evas.h new file mode 100644 index 0000000..f20fb8b --- /dev/null +++ b/screen_connector_watcher_evas/include/screen_connector_common_evas.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __SCREEN_CONNECTOR_COMMON_EVAS_H__ +#define __SCREEN_CONNECTOR_COMMON_EVAS_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file screen_connector_toolkit_evas.h + * @brief This file declares API of libscreen_connector library + * @since_tizen 3.0 + */ + +/** + * @addtogroup CAPI_SCREEN_CONNECTOR_WATCHER_EVAS_MODULE + * @{ + */ +typedef enum { + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_NONE, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, + SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_ALL = + TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, +} screen_connector_evas_changed_event_filter_type; + + + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __SCREEN_CONNECTOR_COMMON_EVAS_H__ */ 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 58073ed..fbf9356 100644 --- a/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -38,13 +39,6 @@ extern "C" { * @addtogroup CAPI_SCREEN_CONNECTOR_WATCHER_EVAS_MODULE * @{ */ -typedef enum { - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_NONE, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_ALL = - TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, -} screen_connector_evas_changed_event_filter_type; typedef enum { VISIBILITY_TYPE_UNOBSCURED, 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 97e4528..fbeb528 100644 --- a/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h +++ b/screen_connector_watcher_evas/include/screen_connector_watcher_evas.h @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -36,13 +37,6 @@ extern "C" { * @addtogroup CAPI_SCREEN_CONNECTOR_WATCHER_EVAS_MODULE * @{ */ -typedef enum { - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_NONE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_NONE, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_TBM = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_IMAGE_FILE = TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_IMAGE_FILE, - SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_ALL = - TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_EVENT_FILTER_TBM | TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_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); -- 2.7.4