}
static Eina_Bool
-_e_mod_effect_cb_client_add(void *data, int type, void *event)
+_e_mod_effect_cb_hook_client_new(void *d EINA_UNUSED, E_Client *ec)
{
- E_Client *ec;
E_Effect_Client *efc;
- E_Event_Client *ev = event;
- if (!_effect) return ECORE_CALLBACK_PASS_ON;
+ if (!_effect) return;
- ec = ev->ec;
efc = _e_mod_effect_client_get(ec);
if (!efc)
{
if (efc)
eina_hash_add(_effect->clients, &ec, efc);
}
-
- return ECORE_CALLBACK_PASS_ON;
}
-static Eina_Bool
-_e_mod_effect_cb_client_remove(void *data, int type, void *event)
+static void
+_e_mod_effect_cb_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
{
- E_Client *ec;
E_Effect_Client *efc = NULL;
- E_Event_Client *ev = event;
if (!_effect) return ECORE_CALLBACK_PASS_ON;
- ec = ev->ec;
-
_effect->stack.old = eina_list_remove(_effect->stack.old, ec);
_effect->stack.cur = eina_list_remove(_effect->stack.cur, ec);
if (!efc->animating)
eina_hash_del_by_key(_effect->clients, &ec);
}
-
- return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
free(efc);
}
+#undef E_CLIENT_HOOK_APPEND
+#define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
+ do \
+ { \
+ E_Client_Hook *_h; \
+ _h = e_client_hook_add(t, cb, d); \
+ assert(_h); \
+ l = eina_list_append(l, _h); \
+ } \
+ while (0)
+
EAPI Eina_Bool
e_mod_effect_init(void)
{
E_LIST_HANDLER_APPEND(effect->event_hdlrs, E_EVENT_CLIENT_BUFFER_CHANGE,
_e_mod_effect_cb_client_buffer_change, effect);
-
- E_LIST_HANDLER_APPEND(effect->event_hdlrs, E_EVENT_CLIENT_ADD,
- _e_mod_effect_cb_client_add, effect);
-
- E_LIST_HANDLER_APPEND(effect->event_hdlrs, E_EVENT_CLIENT_REMOVE,
- _e_mod_effect_cb_client_remove, effect);
-
E_LIST_HANDLER_APPEND(effect->event_hdlrs, E_EVENT_CLIENT_STACK,
_e_mod_effect_cb_client_restack, effect);
+ E_CLIENT_HOOK_APPEND(effect->hooks_ec,
+ E_CLIENT_HOOK_NEW_CLIENT,
+ _e_mod_effect_cb_hook_client_new, effect);
+ E_CLIENT_HOOK_APPEND(effect->hooks_ec,
+ E_CLIENT_HOOK_DEL,
+ _e_mod_effect_cb_hook_client_del, effect);
+
effect->providers =
eina_list_append(effect->providers,
e_comp_object_effect_mover_add(100,
E_FREE_FUNC(_effect->stack.old, eina_list_free);
E_FREE_FUNC(_effect->stack.cur, eina_list_free);
- E_FREE_LIST(_effect->providers, e_comp_object_effect_mover_del);
+ E_FREE_LIST(_effect->providers, e_comp_object_effect_mover_del);
E_FREE_LIST(_effect->event_hdlrs, ecore_event_handler_del);
+ E_FREE_LIST(_effect->hooks_ec, e_client_hook_del);
if (_effect->global)
wl_global_destroy(_effect->global);