Пример #1
0
/*!
 * Executes the action function from the service.
 *
 * \param task - A pointer to the task.
 *
 * \return TASK_SUCCESS if it was possible to execute the initialization
 *         function or if it didn't exist. It returns a negative value if there
 *         was an error detected during the execution of the initialization
 *         function.
 */
int task_run_action(void *task)
{
    task_t *this_ptr = (task_t*) task;
    int status = TASK_SUCCESS;

    printf("%s\n",this_ptr->service->name);

    if (this_ptr->service->action != NULL) {
        if (this_ptr->service->action() < 0) {
            status = TASK_FAIL;
        }
    }
    subject_notify((subject_t*) this_ptr, (void*) &status);

    return status;
}
Пример #2
0
/*! \brief Notify observers of the shape at specified
 *	position for mouse event.
 *
 * Observers of parent shapes may be called if the subject is not
 * with SUBF_STOP_PROPAGATE flag.  The subject of mouse event
 * for a shape is returned by sh_get_mouse_event_subject().
 */
static void notify_coord_or_shape(redraw_man_t *rdman,
				  mb_obj_t *obj,
				  co_aix x, co_aix y, int etype,
				  unsigned int state,
				  unsigned int button) {
    mouse_event_t mouse_event;
    subject_t *subject;

    mouse_event.event.type = etype;
    mouse_event.x = x;
    mouse_event.y = y;
    mouse_event.but_state = state;
    mouse_event.button = button;

    if(IS_MBO_SHAPES(obj))
	subject = sh_get_mouse_event_subject((shape_t *)obj);
    else
	subject = coord_get_mouse_event((coord_t *)obj);

    subject_notify(subject, (event_t *)&mouse_event);
}