E_API int E_EVENT_PLANE_WIN_CHANGE = -1;
+static int _e_plane_hooks_delete = 0;
+static int _e_plane_hooks_walking = 0;
+
+static Eina_Inlist *_e_plane_hooks[] =
+{
+ [E_PLANE_HOOK_VIDEO_SET] = NULL,
+};
+
+static void
+_e_plane_hooks_clean(void)
+{
+ Eina_Inlist *l;
+ E_Plane_Hook *ch;
+ unsigned int x;
+ for (x = 0; x < E_PLANE_HOOK_LAST; x++)
+ EINA_INLIST_FOREACH_SAFE(_e_plane_hooks[x], l, ch)
+ {
+ if (!ch->delete_me) continue;
+ _e_plane_hooks[x] = eina_inlist_remove(_e_plane_hooks[x], EINA_INLIST_GET(ch));
+ free(ch);
+ }
+}
+
+static void
+_e_plane_hook_call(E_Plane_Hook_Point hookpoint, E_Plane *plane)
+{
+ E_Plane_Hook *ch;
+
+ _e_plane_hooks_walking++;
+ EINA_INLIST_FOREACH(_e_plane_hooks[hookpoint], ch)
+ {
+ if (ch->delete_me) continue;
+ ch->func(ch->data, plane);
+ }
+ _e_plane_hooks_walking--;
+ if ((_e_plane_hooks_walking == 0) && (_e_plane_hooks_delete > 0))
+ _e_plane_hooks_clean();
+}
+
static E_Comp_Wl_Buffer *
_get_comp_wl_buffer(E_Client *ec)
{
plane->unset_candidate = EINA_TRUE;
}
+E_API E_Plane_Hook *
+e_plane_hook_add(E_Plane_Hook_Point hookpoint, E_Plane_Hook_Cb func, const void *data)
+{
+ E_Plane_Hook *ch;
+
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_PLANE_HOOK_LAST, NULL);
+ ch = E_NEW(E_Plane_Hook, 1);
+ if (!ch) return NULL;
+ ch->hookpoint = hookpoint;
+ ch->func = func;
+ ch->data = (void*)data;
+ _e_plane_hooks[hookpoint] = eina_inlist_append(_e_plane_hooks[hookpoint], EINA_INLIST_GET(ch));
+ return ch;
+}
+
+E_API void
+e_plane_hook_del(E_Plane_Hook *ch)
+{
+ ch->delete_me = 1;
+ if (_e_plane_hooks_walking == 0)
+ {
+ _e_plane_hooks[ch->hookpoint] = eina_inlist_remove(_e_plane_hooks[ch->hookpoint], EINA_INLIST_GET(ch));
+ free(ch);
+ }
+ else
+ _e_plane_hooks_delete++;
+}
+
EINTERN Eina_Bool
e_plane_init(void)
{
typedef struct _E_Plane E_Plane;
typedef struct _E_Plane_Commit_Data E_Plane_Commit_Data;
typedef struct _E_Event_Plane_Win_Change E_Event_Plane_Win_Change;
+typedef struct _E_Plane_Hook E_Plane_Hook;
+typedef void (*E_Plane_Hook_Cb) (void *data, E_Plane *plane);
+
#else
#ifndef E_PLANE_H
#define E_PLANE_H
E_Comp_Wl_Buffer_Ref buffer_ref;
};
+typedef enum _E_Plane_Hook_Point
+{
+ E_PLANE_HOOK_VIDEO_SET,
+ E_PLANE_HOOK_LAST
+} E_Plane_Hook_Point;
+
+struct _E_Plane_Hook
+{
+ EINA_INLIST;
+ E_Plane_Hook_Point hookpoint;
+ E_Plane_Hook_Cb func;
+ void *data;
+ unsigned char delete_me : 1;
+};
+
struct _E_Event_Plane_Win_Change
{
E_Plane *ep;
E_API E_Plane_Color e_plane_color_val_get(E_Plane *plane);
E_API Eina_Bool e_plane_is_fb_target(E_Plane *plane);
+E_API E_Plane_Hook *e_plane_hook_add(E_Plane_Hook_Point hookpoint, E_Plane_Hook_Cb func, const void *data);
+E_API void e_plane_hook_del(E_Plane_Hook *ch);
+
#endif
#endif