};
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;
struct wl_buffer *cur_buffer;
struct _screen_connector_type_evas_h *type_h;
guint resuming_timer;
+ GList *viewer_visibility_list;
void *data;
};
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 gint __comp_win_id(gconstpointer a, gconstpointer b)
+{
+ viewer_visibility_h win = (viewer_visibility_h)a;
+
+ return !(win->win_id == GPOINTER_TO_INT(b));
+}
+
static void __destroy_type_h(gpointer data)
{
screen_connector_type_evas_h type_h = (screen_connector_type_evas_h)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 __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 *tmp_list = NULL;
+ GList *iter;
+ viewer_visibility_h visibility_h;
if (toolkit_evas_h->freeze)
return;
if (!__obj_is_visible(toolkit_evas_h))
return;
- if (event)
+ if (ev->fully_obscured)
type = VISIBILITY_TYPE_FULLY_OBSCURED;
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;
+ }
+
+ 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);
if (ret == -1)
LOGE("failed to set object visibility set %p to %d", toolkit_evas_h->img_tbm, type);
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;
{
struct wl_surface *surface;
Ecore_Wl_Window *wl_win;
+ viewer_visibility_h visibility_h;
if (!h)
return -1;
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");
+ return -1;
+ }
+ visibility_h->win_id = ecore_wl_window_id_get(wl_win);
+ visibility_h->visibility = VISIBILITY_TYPE_UNKNOWN;
+
+ h->viewer_visibility_list =
+ g_list_append(h->viewer_visibility_list, visibility_h);
+
return screen_connector_toolkit_bind(h->toolkit_h, surface);
}