Beispiel #1
0
static void
objects_selection_event_cb(rig_objects_selection_t *selection,
                           rig_objects_selection_event_t event,
                           rut_object_t *object,
                           void *user_data)
{
    rig_selection_tool_t *tool = user_data;
    entity_state_t *entity_state;
    c_llist_t *l;

    if (!tool->active && event == RIG_OBJECTS_SELECTION_ADD_EVENT)
        return;

    if (rut_object_get_type(object) != &rig_entity_type)
        return;

    for (l = tool->selected_entities; l; l = l->next) {
        entity_state = l->data;
        if (entity_state->entity == object)
            break;
    }
    if (l == NULL)
        entity_state = NULL;

    switch (event) {
    case RIG_OBJECTS_SELECTION_ADD_EVENT: {
        c_return_if_fail(entity_state == NULL);

        entity_state = c_slice_new0(entity_state_t);
        entity_state->tool = tool;
        entity_state->entity = rut_object_ref(object);
        entity_state->control_points = NULL;

        tool->selected_entities =
            c_llist_prepend(tool->selected_entities, entity_state);

        entity_state->sizeable = find_sizeable_component(entity_state->entity);
        if (entity_state->sizeable)
            create_sizeable_control_points(entity_state);
        else
            create_dummy_control_points(entity_state);

        break;
    }

    case RIG_OBJECTS_SELECTION_REMOVE_EVENT:
        c_return_if_fail(entity_state != NULL);

        tool->selected_entities =
            c_llist_remove(tool->selected_entities, entity_state);
        entity_state_destroy(entity_state);
        break;
    }
}
Beispiel #2
0
static void
unregister_xlib_renderer(cg_renderer_t *renderer)
{
    _cg_xlib_renderers = c_llist_remove(_cg_xlib_renderers, renderer);
}