summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2017-09-18 09:43:19 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2017-09-21 23:37:58 +0900
commitf6e0e9298b1043ba8e5ef19bcfa8a98438f498cb (patch)
tree7eb2eefcb1b1fd2931406b8dd704dd071498ddf7
parent6b63e6e8f5758c9a6a28acc7d115b9e5bb74e97c (diff)
parentd0c67063ea8da218b36eb76c54be37650252ecd7 (diff)
downloadscreen-connector-devel/tizen.tar.gz
screen-connector-devel/tizen.tar.bz2
screen-connector-devel/tizen.zip
Merge branch 'tizen_3.0' into devel/tizendevel/tizen
Change-Id: Ia7fb9598eaac1524b06f7fd3fcebf38f1dfab254 Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--screen_connector_provider/src/screen_connector_provider.c10
-rw-r--r--screen_connector_watcher/include/screen_connector_common.h42
-rw-r--r--screen_connector_watcher/include/screen_connector_toolkit.h4
-rw-r--r--screen_connector_watcher/include/screen_connector_watcher.h11
-rw-r--r--screen_connector_watcher/src/screen_connector_toolkit.c32
-rw-r--r--screen_connector_watcher/src/screen_connector_watcher.c1
-rw-r--r--screen_connector_watcher_evas/include/screen_connector_common_evas.h56
-rw-r--r--screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h6
-rw-r--r--screen_connector_watcher_evas/include/screen_connector_watcher_evas.h8
-rw-r--r--screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c501
-rw-r--r--screen_connector_watcher_evas/src/screen_connector_watcher_evas.c1
11 files changed, 556 insertions, 116 deletions
diff --git a/screen_connector_provider/src/screen_connector_provider.c b/screen_connector_provider/src/screen_connector_provider.c
index 403c975..44225b2 100644
--- a/screen_connector_provider/src/screen_connector_provider.c
+++ b/screen_connector_provider/src/screen_connector_provider.c
@@ -98,14 +98,14 @@ EXPORT_API screen_connector_provider_h screen_connector_provider_create(const ch
goto out;
}
- rsm_wrapper = wl_proxy_create_wrapper(__rsm);
- if (!rsm_wrapper) {
- LOGE("failed to create wl display wrapper");
+ if (!surface || !id) {
+ LOGE("invalid parameter");
goto out;
}
- if (!surface || !id) {
- LOGE("invalid parameter");
+ rsm_wrapper = wl_proxy_create_wrapper(__rsm);
+ if (!rsm_wrapper) {
+ LOGE("failed to create wl display wrapper");
goto out;
}
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 <tizen.h>
+#include <wayland-client.h>
+#include <wayland-tbm-client.h>
+#include <wayland-extension/tizen-extension-client-protocol.h>
+#include <tizen-remote-surface-client-protocol.h>
+
+#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 473b072..d0e535c 100644
--- a/screen_connector_watcher/include/screen_connector_toolkit.h
+++ b/screen_connector_watcher/include/screen_connector_toolkit.h
@@ -17,9 +17,8 @@
#ifndef __SCREEN_CONNECTOR_TOOLKIT_H__
#define __SCREEN_CONNECTOR_TOOLKIT_H__
-#include <wayland-client.h>
-#include <wayland-tbm-client.h>
#include <aul_screen_connector.h>
+#include <screen_connector_common.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -84,6 +83,7 @@ screen_connector_toolkit_h screen_connector_toolkit_add_with_surface(screen_conn
int screen_connector_toolkit_bind(screen_connector_toolkit_h h, struct wl_surface *surface);
int screen_connector_toolkit_unbind(screen_connector_toolkit_h h);
bool screen_connector_toolkit_is_exist(const 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/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 <wayland-client.h>
-#include <wayland-tbm-client.h>
+#include <screen_connector_common.h>
#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/src/screen_connector_toolkit.c b/screen_connector_watcher/src/screen_connector_toolkit.c
index 1e3dcd6..343b420 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);
@@ -182,7 +186,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;
}
@@ -279,10 +283,11 @@ 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,
- g_str_equal, free, __destroy_toolkit_h);
+ g_str_equal, free, NULL);
g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h);
@@ -338,10 +343,11 @@ 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,
- g_str_equal, free, __destroy_toolkit_h);
+ g_str_equal, free, NULL);
g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h);
@@ -413,10 +419,11 @@ 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,
- g_str_equal, free, __destroy_toolkit_h);
+ g_str_equal, free, NULL);
g_hash_table_insert(type_h->toolkit_table, strdup(id), toolkit_h);
@@ -444,7 +451,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;
}
@@ -552,4 +559,19 @@ EXPORT_API int screen_connector_toolkit_unbind(screen_connector_toolkit_h h)
return 0;
}
+EXPORT_API int screen_connector_toolkit_set_changed_event_filter(
+ screen_connector_toolkit_h h,
+ screen_connector_changed_event_filter_type type)
+{
+ if (!h || !(h->surface)) {
+ 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/src/screen_connector_watcher.c b/screen_connector_watcher/src/screen_connector_watcher.c
index e9dd976..596533a 100644
--- a/screen_connector_watcher/src/screen_connector_watcher.c
+++ b/screen_connector_watcher/src/screen_connector_watcher.c
@@ -76,7 +76,6 @@ static void __buffer_changed(void *data, struct tizen_remote_surface *trs, uint3
screen_connector_info_h info = (screen_connector_info_h)data;
if (info && info->ops) {
-
if (info->renderable) {
info->renderable = false;
tizen_remote_surface_set_remote_render(info->surface, 0);
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 <tizen.h>
+#include <wayland-client.h>
+#include <wayland-tbm-client.h>
+
+#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 65c7724..b5150cc 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 <wayland-client.h>
#include <wayland-tbm-client.h>
#include <screen_connector_toolkit.h>
+#include <screen_connector_common_evas.h>
#ifdef __cplusplus
extern "C" {
@@ -43,6 +44,7 @@ typedef enum {
VISIBILITY_TYPE_UNOBSCURED,
VISIBILITY_TYPE_PARTIALLY_OBSCURED,
VISIBILITY_TYPE_FULLY_OBSCURED,
+ VISIBILITY_TYPE_UNKNOWN,
} visibility_type;
typedef void (*screen_connector_toolkit_evas_added_cb)(const char *appid, const char *instance_id, const int pid,
@@ -113,7 +115,9 @@ 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);
+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/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 <tizen_type.h>
#include <wayland-extension/tizen-extension-client-protocol.h>
#include <tizen-remote-surface-client-protocol.h>
+#include <screen_connector_common_evas.h>
#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);
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 7a2f98f..a176d9f 100644
--- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c
+++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c
@@ -48,19 +48,31 @@ struct _cur_buffer_info_h {
};
typedef struct _cur_buffer_info_h *cur_buffer_info_h;
+struct _viewer_visibility_h {
+ visibility_type visibility;
+ int win_id;
+};
+typedef struct _viewer_visibility_h *viewer_visibility_h;
+
struct _screen_connector_toolkit_evas_h {
screen_connector_toolkit_evas_ops *ops;
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;
struct wl_buffer *cur_buffer;
struct _screen_connector_type_evas_h *type_h;
guint resuming_timer;
+ GList *viewer_visibility_list;
+ visibility_type auto_visibility;
+ int bind_win_id;
+ screen_connector_screen_type_e screen_type;
+ bool flick;
+ int prev_y;
void *data;
+ bool blocked;
};
static GHashTable *__cur_buffer_table = NULL;
@@ -70,6 +82,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);
@@ -77,17 +91,72 @@ static void __rs_cb_hide(void *data, Evas *e, Evas_Object *obj, void *event_info
static void __rs_cb_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void __obj_update_visibility(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void __destroy_type_h(gpointer data)
+static gint __comp_win_id(gconstpointer a, gconstpointer b)
{
- screen_connector_type_evas_h type_h = (screen_connector_type_evas_h)data;
- if (!type_h)
- return;
+ viewer_visibility_h win = (viewer_visibility_h)a;
- if (type_h->toolkit_table) {
- g_hash_table_destroy(type_h->toolkit_table);
- type_h->toolkit_table = NULL;
+ 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;
}
- free(type_h);
+ 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 __cur_buffer_info_ref(cur_buffer_info_h info)
@@ -95,7 +164,7 @@ static void __cur_buffer_info_ref(cur_buffer_info_h info)
info->ref_count++;
}
-static void __cur_buffer_info_unref(struct tizen_remote_surface *trs, cur_buffer_info_h info)
+static bool __cur_buffer_info_unref(struct tizen_remote_surface *trs, cur_buffer_info_h info)
{
tbm_surface_h cur_tbm_surface;
@@ -105,7 +174,10 @@ static void __cur_buffer_info_unref(struct tizen_remote_surface *trs, cur_buffer
cur_tbm_surface = (tbm_surface_h)wl_buffer_get_user_data(info->cur_buffer);
tbm_surface_internal_unref(cur_tbm_surface);
g_hash_table_remove(__cur_buffer_table, info->cur_buffer);
+ return true;
}
+
+ return false;
}
static void __destroy_cur_buffer(gpointer data)
@@ -148,7 +220,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;
@@ -165,6 +239,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(
@@ -189,9 +271,19 @@ 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);
+
+ __clear_img_tbm(toolkit_evas_h);
}
if (toolkit_evas_h->toolkit_h)
@@ -203,9 +295,31 @@ static void __destroy_toolkit_evas_h(gpointer data)
if (toolkit_evas_h->resuming_timer > 0)
g_source_remove(toolkit_evas_h->resuming_timer);
+ if (toolkit_evas_h->viewer_visibility_list)
+ g_list_free_full(toolkit_evas_h->viewer_visibility_list, free);
+
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;
@@ -224,13 +338,13 @@ EXPORT_API int screen_connector_toolkit_evas_init(Evas_Object *win, screen_conne
return -1;
}
- type_h->toolkit_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, __destroy_toolkit_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, NULL);
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;
@@ -240,6 +354,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");
@@ -249,6 +365,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;
}
@@ -315,6 +434,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);
}
@@ -350,7 +470,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_SCREEN_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;
@@ -361,6 +486,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) {
@@ -382,9 +509,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)
@@ -401,6 +530,8 @@ static void __rs_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *even
evas_object_geometry_get(obj, &x, &y, &w, &h);
LOGD("mouse down: %d %d", ev->canvas.x - x, ev->canvas.y - y);
+ toolkit_evas_h->flick = false;
+ toolkit_evas_h->prev_y = ev->canvas.y - y;
if (desc == NULL)
desc = "";
@@ -463,6 +594,25 @@ static void __rs_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_
return;
}
+ /*
+ * 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,
+ 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,
0,
@@ -479,10 +629,10 @@ static void __rs_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_
ev->timestamp);
}
-static void __rs_cb_mouse_move(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)
{
screen_connector_toolkit_evas_h toolkit_evas_h = (screen_connector_toolkit_evas_h)data;
- Evas_Event_Mouse_Move *ev = event_info;
+ Evas_Event_Multi_Down *ev = event_info;
const char *desc = evas_device_description_get(ev->dev);
int x;
int y;
@@ -492,14 +642,14 @@ static void __rs_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *even
evas_object_geometry_get(obj, &x, &y, &w, &h);
- LOGD("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y);
+ 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_MOVE_X_Y)) {
- LOGD("mouse move disabled");
+ SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_UP_DOWN)) {
+ LOGD("multi down disabled");
return;
}
@@ -509,12 +659,12 @@ static void __rs_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *even
return;
}
- tizen_remote_surface_transfer_mouse_event(surface,
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE,
- 0,
- 0,
- ev->cur.canvas.x - x,
- ev->cur.canvas.y - y,
+ 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),
@@ -525,21 +675,27 @@ static void __rs_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *even
ev->timestamp);
}
-static void __rs_cb_mouse_wheel(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)
{
screen_connector_toolkit_evas_h toolkit_evas_h = (screen_connector_toolkit_evas_h)data;
- Evas_Event_Mouse_Wheel *ev = event_info;
+ 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;
- LOGD("mouse wheel");
+ 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_WHEEL)) {
- LOGD("mouse wheel disabled");
+ SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_UP_DOWN)) {
+ LOGD("multi up disabled");
return;
}
@@ -549,83 +705,111 @@ static void __rs_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *eve
return;
}
- tizen_remote_surface_transfer_mouse_wheel(surface,
- ev->direction,
- ev->z,
+ 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_in(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)
{
screen_connector_toolkit_evas_h toolkit_evas_h = (screen_connector_toolkit_evas_h)data;
- Evas_Event_Mouse_In *ev = event_info;
+ Evas_Event_Mouse_Move *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;
+ int delta_y;
evas_object_geometry_get(obj, &x, &y, &w, &h);
- LOGD("mouse in: %d %d", ev->canvas.x - x, ev->canvas.y - y);
+
+ LOGD("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y);
if (desc == NULL)
desc = "";
+ if (screen_connector_toolkit_check_input_disabled(toolkit_evas_h->toolkit_h,
+ SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_MOVE_X_Y)) {
+ LOGD("mouse move 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_mouse_event(
- surface,
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_IN,
- 0,
- 0,
- ev->canvas.x - x,
- ev->canvas.y - y,
- 0,
- 0,
+ if (toolkit_evas_h->flick) {
+ LOGD("flick event");
+ return;
+ }
+
+ delta_y = ev->cur.canvas.y - y - toolkit_evas_h->prev_y;
+ if (delta_y < 0)
+ delta_y *= -1;
+
+ if (delta_y > 10) {
+ toolkit_evas_h->flick = true;
+ return;
+ }
+
+ toolkit_evas_h->prev_y = ev->cur.canvas.y - y;
+ tizen_remote_surface_transfer_mouse_event(surface,
+ TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE,
0,
0,
+ ev->cur.canvas.x - x,
+ ev->cur.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_out(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)
{
screen_connector_toolkit_evas_h toolkit_evas_h = (screen_connector_toolkit_evas_h)data;
- Evas_Event_Mouse_Out *ev = event_info;
+ Evas_Event_Mouse_Wheel *ev = event_info;
const char *desc = evas_device_description_get(ev->dev);
struct tizen_remote_surface *surface;
- LOGD("mouse out");
+ LOGD("mouse wheel");
+
if (desc == NULL)
desc = "";
+ if (screen_connector_toolkit_check_input_disabled(toolkit_evas_h->toolkit_h,
+ SCREEN_CONNECTOR_INPUT_TYPE_MOUSE_WHEEL)) {
+ LOGD("mouse wheel 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_mouse_event(
- surface,
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_OUT,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
+ tizen_remote_surface_transfer_mouse_wheel(surface,
+ ev->direction,
+ ev->z,
evas_device_class_get(ev->dev),
evas_device_subclass_get(ev->dev),
desc,
@@ -662,8 +846,21 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type,
char plug_id[256];
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->blocked || toolkit_evas_h->bind_win_id > 0) {
+ if (tizen_remote_surface_get_version(trs)
+ >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) {
+ tizen_remote_surface_release(trs, tbm);
+ g_hash_table_remove(__cur_buffer_table, tbm);
+ }
+ close(img_file_fd); /* close passed fd */
+ return;
+ }
+
if (toolkit_evas_h->img_tbm == NULL) {
LOGD("first added !!!! %d, %d %s", (toolkit_evas_h->img_tbm == NULL), type, appid);
toolkit_evas_h->img_tbm = evas_object_image_filled_add(
@@ -679,18 +876,18 @@ 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,
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,
@@ -710,6 +907,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)
@@ -749,8 +954,14 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type,
if (toolkit_evas_h->cur_buffer) {
if (tizen_remote_surface_get_version(trs) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) {
c_buf_info = g_hash_table_lookup(__cur_buffer_table, toolkit_evas_h->cur_buffer);
- if (c_buf_info != NULL)
- __cur_buffer_info_unref(trs, c_buf_info);
+ if (c_buf_info != NULL) {
+ if (c_buf_info->cur_buffer != tbm) {
+ __cur_buffer_info_unref(trs, c_buf_info);
+ } else {
+ duplicate_buffer = true;
+ LOGW("Same buffer %p", tbm);
+ }
+ }
}
}
@@ -766,7 +977,8 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type,
g_hash_table_insert(__cur_buffer_table, toolkit_evas_h->cur_buffer, c_buf_info);
}
} else {
- __cur_buffer_info_ref(c_buf_info);
+ if (!duplicate_buffer)
+ __cur_buffer_info_ref(c_buf_info);
}
if (is_added) {
@@ -791,6 +1003,7 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type,
__clear_img_file(toolkit_evas_h);
}
}
+
close(img_file_fd); /* close passed fd */
}
@@ -802,6 +1015,7 @@ static void __toolkit_removed_cb(const char *appid, const char *instance_id, con
{
screen_connector_toolkit_evas_h toolkit_evas_h;
char *plug_id;
+ GHashTable *toolkit_table;
LOGD("missing %s %s", appid, instance_id);
toolkit_evas_h = (screen_connector_toolkit_evas_h)data;
@@ -810,6 +1024,8 @@ static void __toolkit_removed_cb(const char *appid, const char *instance_id, con
return;
}
+
+ toolkit_table = toolkit_evas_h->type_h->toolkit_table;
if (toolkit_evas_h->img_tbm != NULL) {
plug_id = evas_object_data_del(toolkit_evas_h->img_tbm, "___PLUGID");
if (plug_id)
@@ -821,7 +1037,7 @@ static void __toolkit_removed_cb(const char *appid, const char *instance_id, con
toolkit_evas_h->ops->removed_cb(appid, instance_id, pid, toolkit_evas_h->img_file, toolkit_evas_h->data);
}
- g_hash_table_remove(toolkit_evas_h->type_h->toolkit_table, instance_id);
+ g_hash_table_remove(toolkit_table, instance_id);
}
EXPORT_API int screen_connector_toolkit_evas_set_delayed_resuming_time(int ms)
@@ -889,6 +1105,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;
}
@@ -935,6 +1152,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;
}
@@ -951,8 +1169,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;
}
@@ -964,9 +1185,11 @@ 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;
- unsigned int event = GPOINTER_TO_INT(user_data);
+ Ecore_Wl_Event_Window_Visibility_Change *ev = user_data;
int ret;
visibility_type type;
+ GList *iter;
+ viewer_visibility_h visibility_h;
if (toolkit_evas_h->freeze)
return;
@@ -974,12 +1197,30 @@ static void __send_visibility(gpointer key, gpointer value, gpointer user_data)
if (!__obj_is_visible(toolkit_evas_h))
return;
- if (event)
+ if (ev->fully_obscured)
type = VISIBILITY_TYPE_FULLY_OBSCURED;
else
type = VISIBILITY_TYPE_UNOBSCURED;
+ __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) {
+ visibility_h = (viewer_visibility_h)iter->data;
+ if (visibility_h->visibility == VISIBILITY_TYPE_UNKNOWN) {
+ LOGE("viewer not ready");
+ return;
+ } else if (visibility_h->visibility ==
+ VISIBILITY_TYPE_UNOBSCURED) {
+ type = VISIBILITY_TYPE_UNOBSCURED;
+ break;
+ }
+ iter = g_list_next(iter);
+ }
+
+ 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);
}
@@ -1001,8 +1242,8 @@ static Eina_Bool __visibility_cb(void *data, int type, void *event)
while (g_hash_table_iter_next(&iter, &key, &value)) {
cur_type = (screen_connector_type_evas_h)value;
if (cur_type->toolkit_table)
- g_hash_table_foreach(cur_type->toolkit_table, __send_visibility,
- GINT_TO_POINTER(ev->fully_obscured));
+ g_hash_table_foreach(cur_type->toolkit_table,
+ __send_visibility, ev);
}
return ECORE_CALLBACK_RENEW;
@@ -1145,7 +1386,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;
@@ -1192,6 +1432,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);
@@ -1237,11 +1478,34 @@ EXPORT_API int screen_connector_toolkit_evas_get_pid(Evas_Object *obj, int *pid)
return 0;
}
+EXPORT_API int screen_connector_toolkit_evas_is_visible(Evas_Object *obj, bool *is_visible)
+{
+ screen_connector_toolkit_evas_h toolkit_evas_h;
+
+ if (obj == NULL || is_visible == NULL) {
+ LOGE("invalid argument");
+ return -1;
+ }
+ toolkit_evas_h = __find_toolkit_evas_h(obj);
+ if (!toolkit_evas_h) {
+ LOGE("obj not found");
+ return -1;
+ }
+
+ *is_visible = __obj_is_visible(toolkit_evas_h);
+
+ return 0;
+}
+
EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_h h,
Evas_Object *win)
{
struct wl_surface *surface;
Ecore_Wl_Window *wl_win;
+ struct tizen_remote_surface *trs;
+ cur_buffer_info_h c_buf_info;
+ int ret;
+ int bind_win_id;
if (!h)
return -1;
@@ -1258,6 +1522,33 @@ EXPORT_API int screen_connector_toolkit_evas_bind(screen_connector_toolkit_evas_
return -1;
}
+ 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;
+ }
+ h->bind_win_id = bind_win_id;
+
+ trs = screen_connector_toolkit_get_trs(h->toolkit_h);
+ 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)
+ >= 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);
}
@@ -1268,24 +1559,64 @@ EXPORT_API int screen_connector_toolkit_evas_unbind(screen_connector_toolkit_eva
return -1;
}
+ __remove_window_visibility_info(h, h->bind_win_id);
+ h->bind_win_id = 0;
return screen_connector_toolkit_unbind(h->toolkit_h);
}
-EXPORT_API int screen_connector_toolkit_evas_is_visible(Evas_Object *obj, bool *is_visible)
+EXPORT_API visibility_type screen_connector_toolkit_evas_auto_visibility(
+ screen_connector_toolkit_evas_h h)
{
- screen_connector_toolkit_evas_h toolkit_evas_h;
-
- if (obj == NULL || is_visible == NULL) {
- LOGE("invalid argument");
+ if (!h) {
+ LOGE("invalid argument %p", h);
return -1;
}
- toolkit_evas_h = __find_toolkit_evas_h(obj);
- if (!toolkit_evas_h) {
- LOGE("obj not found");
+
+ 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)
+{
+ cur_buffer_info_h c_buf_info;
+ struct tizen_remote_surface *trs;
+ int ret;
+
+ ret = screen_connector_toolkit_set_changed_event_filter(
+ toolkit_evas_h->toolkit_h, type);
+
+ if (ret < 0) {
+ LOGE("failed to set changed event filter");
+ return ret;
+ }
+
+ if (type != SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_ALL &&
+ type != SCREEN_CONNECTOR_EVAS_CHANGED_EVENT_FILTER_TBM) {
+ LOGD("filter = %d", type);
+ toolkit_evas_h->blocked = false;
+ return ret;
+ }
+
+ trs = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h);
+ if (trs) {
+ tizen_remote_surface_transfer_touch_cancel(trs);
+ } else {
+ LOGE("failed to get tizen remote surface");
return -1;
}
- *is_visible = __obj_is_visible(toolkit_evas_h);
+ toolkit_evas_h->blocked = true;
+ if (toolkit_evas_h->cur_buffer) {
+ if (tizen_remote_surface_get_version(trs)
+ >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) {
+ c_buf_info = g_hash_table_lookup(
+ __cur_buffer_table,
+ toolkit_evas_h->cur_buffer);
+ if (c_buf_info != NULL)
+ __cur_buffer_info_unref(trs, c_buf_info);
+ }
+ }
return 0;
}
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 d5fa954..a9719a1 100644
--- a/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c
+++ b/screen_connector_watcher_evas/src/screen_connector_watcher_evas.c
@@ -76,6 +76,7 @@ static void __clear_img_file(img_info_h info)
static img_info_h __create_img_info(const char *appid, const char *instance_id, int pid)
{
img_info_h info = (img_info_h)calloc(1, sizeof(struct _img_info_h));
+
if (info == NULL) {
LOGE("Fail to calloc img info");
return NULL;