struct wl_resource *surface;
E_Client *ec;
Ecore_Window window;
+ Ecore_Event_Handler *vis_eh;
- Eina_Bool follow_topmost_visibility;
Eina_Bool allowed_attribute;
-
};
static Eina_List *video_list = NULL;
wl_resource_set_destructor(video->video_object, NULL);
+ E_FREE_FUNC(video->vis_eh, ecore_event_handler_del);
+
e_client_video_unset(video->ec);
free(video);
e_client_video_property_set(video->ec, id, v);
}
+static Eina_Bool
+_e_comp_wl_video_cb_visibility_change(void *data, int type, void *event)
+{
+ E_Video *video;
+ E_Client *ec;
+ E_Event_Client *ev;
+
+ ev = event;
+ video = data;
+ if (video->ec != ev->ec)
+ return ECORE_CALLBACK_PASS_ON;
+
+ ec = ev->ec;
+ switch (ec->visibility.obscured)
+ {
+ case E_VISIBILITY_FULLY_OBSCURED:
+ evas_object_hide(ec->frame);
+ break;
+ default:
+ case E_VISIBILITY_UNOBSCURED:
+ evas_object_show(ec->frame);
+ break;
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
static void
_e_comp_wl_video_object_cb_follow_topmost_visibility(struct wl_client *client,
struct wl_resource *resource)
video = wl_resource_get_user_data(resource);
EINA_SAFETY_ON_NULL_RETURN(video);
- if(!video->ec || video->follow_topmost_visibility)
+ if(!video->ec)
return;
VIN("set follow_topmost_visibility");
- video->follow_topmost_visibility= EINA_TRUE;
e_client_video_topmost_visibility_follow(video->ec);
+
+ if (!video->vis_eh)
+ {
+ video->vis_eh =
+ ecore_event_handler_add(E_EVENT_CLIENT_VISIBILITY_CHANGE,
+ (Ecore_Event_Handler_Cb)_e_comp_wl_video_cb_visibility_change,
+ video);
+ }
}
static void
video = wl_resource_get_user_data(resource);
EINA_SAFETY_ON_NULL_RETURN(video);
- if(!video->ec || !video->follow_topmost_visibility)
+ if(!video->ec)
return;
VIN("set unfollow_topmost_visibility");
- video->follow_topmost_visibility= EINA_FALSE;
e_client_video_topmost_visibility_unfollow(video->ec);
+ E_FREE_FUNC(video->vis_eh, ecore_event_handler_del);
}
static void
return ECORE_CALLBACK_PASS_ON;
}
+static void
+_e_video_ec_visibility_event_free(void *d EINA_UNUSED, E_Event_Client *ev)
+{
+ e_object_unref(E_OBJECT(ev->ec));
+ free(ev);
+}
+
+static void
+_e_video_ec_visibility_event_send(E_Client *ec)
+{
+ E_Event_Client *ev;
+ int obscured;
+
+ obscured = ec->visibility.obscured;
+ ELOGF("VIDEO <INF>", "Signal visibility change event of video, type %d",
+ ec, obscured);
+
+ ev = E_NEW(E_Event_Client, 1);
+ if (!ev) return;
+ ev->ec = ec;
+ e_object_ref(E_OBJECT(ec));
+ ecore_event_add(E_EVENT_CLIENT_VISIBILITY_CHANGE, ev,
+ (Ecore_End_Cb)_e_video_ec_visibility_event_free, NULL);
+}
+
static Eina_Bool
_e_video_cb_topmost_ec_visibility_change(void *data, int type, void *event)
{
- E_Event_Client *ev = event;
- E_Client *ec = ev->ec;
E_Video_Hwc_Windows *evhw;
- Eina_List *l = NULL;
+ E_Event_Client *ev;
+ E_Client *topmost;
- EINA_LIST_FOREACH(video_list, l, evhw)
- {
- E_Client *topmost = e_comp_wl_topmost_parent_get(evhw->ec);
- if (!topmost) continue;
- if (topmost == evhw->ec) continue;
- if (topmost != ec) continue;
- if (evhw->follow_topmost_visibility)
- {
- switch (ec->visibility.obscured)
- {
- case E_VISIBILITY_FULLY_OBSCURED:
- VIN("follow_topmost_visibility: fully_obscured");
- _e_video_cb_evas_hide(evhw, NULL, NULL, NULL);
- break;
- case E_VISIBILITY_UNOBSCURED:
- VIN("follow_topmost_visibility: UNOBSCURED");
- _e_video_cb_evas_show(evhw, NULL, NULL, NULL);
- break;
- default:
- return ECORE_CALLBACK_PASS_ON;
- }
- }
- }
+ ev = event;
+ evhw = data;
+ if (!evhw->follow_topmost_visibility)
+ goto end;
+
+ topmost = e_comp_wl_topmost_parent_get(evhw->ec);
+ if (!topmost) goto end;
+ if (topmost != ev->ec) goto end;
+ if (topmost == evhw->ec) goto end;
+ if (evhw->ec->visibility.obscured == topmost->visibility.obscured) goto end;
+
+ /* Update visibility of video client by changing visibility of topmost client */
+ evhw->ec->visibility.obscured = topmost->visibility.obscured;
+ _e_video_ec_visibility_event_send(evhw->ec);
+end:
return ECORE_CALLBACK_PASS_ON;
}