All pastes #81120 Raw Edit

Stuff

public text v1 · immutable
·published 2006-07-07 04:28 UTC
rendered paste body
/**
 * @param type: The Ewl_Engine_Hook type to find the best matching function
 * @return Returns a pointer to the appropriate engine callback on success.
 * @brief Retrieves the correct engine callback for the specified type.
 */
void *
ewl_engine_hook_get(Ewl_Window *win, Ewl_Engine_Hook type)
{
        Ewl_Engine *caller;
        void *match = NULL;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("win", win);
        DCHECK_PARAM_PTR("valid type", (type >= 0 && type < EWL_ENGINE_MAX));
        DCHECK_TYPE("win", win, EWL_WINDOW_TYPE);

        caller = EWL_ENGINE(win->engine);
        if (!caller->functions->engine_hooks[type] && caller->dependancies)
        {
                Ecore_List *deps;

                deps = caller->dependancies;
                ecore_list_goto_last(deps);
                while ((caller = ecore_dlist_previous(deps)))
                {
                        if (caller->functions->engine_hooks[type])
                                break;
                }
        }

        if (caller && caller->functions->engine_hooks[type])
                match = caller->functions->engine_hooks[type];

        DRETURN_PTR(match, DLEVEL_STABLE);
}