Exemplo n.º 1
0
static bool
HandleSetLatchGroup(struct xkb_keymap *keymap, union xkb_action *action,
                    enum action_field field, const ExprDef *array_ndx,
                    const ExprDef *value)
{
    struct xkb_group_action *act = &action->group;
    enum xkb_action_flags rtrn, t1;
    xkb_layout_index_t t2;

    if (array_ndx != NULL) {
        switch (field) {
        case ACTION_FIELD_CLEAR_LOCKS:
        case ACTION_FIELD_LATCH_TO_LOCK:
        case ACTION_FIELD_GROUP:
            return ReportActionNotArray(keymap, action->type, field);

        default:
            break;
        }
    }

    switch (field) {
    case ACTION_FIELD_CLEAR_LOCKS:
    case ACTION_FIELD_LATCH_TO_LOCK:
        rtrn = act->flags;
        if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn)) {
            act->flags = rtrn;
            return true;
        }
        return false;

    case ACTION_FIELD_GROUP:
        t1 = act->flags;
        if (CheckGroupField(keymap, action->type, value, &t1, &t2)) {
            act->flags = t1;
            act->group = t2;
            return true;
        }
        return false;

    default:
        break;
    }

    return ReportIllegal(keymap, action->type, field);
}
Exemplo n.º 2
0
static bool
HandleLockGroup(struct xkb_keymap *keymap, union xkb_action *action,
                enum action_field field, const ExprDef *array_ndx,
                const ExprDef *value)
{
    struct xkb_group_action *act = &action->group;
    enum xkb_action_flags t1;
    xkb_layout_index_t t2;

    if ((array_ndx != NULL) && (field == ACTION_FIELD_GROUP))
        return ReportActionNotArray(keymap, action->type, field);
    if (field == ACTION_FIELD_GROUP) {
        t1 = act->flags;
        if (CheckGroupField(keymap, action->type, value, &t1, &t2)) {
            act->flags = t1;
            act->group = t2;
            return true;
        }
        return false;
    }
    return ReportIllegal(keymap, action->type, field);
}
Exemplo n.º 3
0
static bool
HandleSetLatchLockGroup(struct xkb_context *ctx, const struct xkb_mod_set *mods,
                        union xkb_action *action, enum action_field field,
                        const ExprDef *array_ndx, const ExprDef *value)
{
    struct xkb_group_action *act = &action->group;
    const enum xkb_action_type type = action->type;

    if (field == ACTION_FIELD_GROUP)
        return CheckGroupField(ctx, action->type, array_ndx, value,
                               &act->flags, &act->group);
    if ((type == ACTION_TYPE_GROUP_SET || type == ACTION_TYPE_GROUP_LATCH) &&
        field == ACTION_FIELD_CLEAR_LOCKS)
        return CheckBooleanFlag(ctx, action->type, field,
                                ACTION_LOCK_CLEAR, array_ndx, value,
                                &act->flags);
    if (type == ACTION_TYPE_GROUP_LATCH &&
        field == ACTION_FIELD_LATCH_TO_LOCK)
        return CheckBooleanFlag(ctx, action->type, field,
                                ACTION_LATCH_TO_LOCK, array_ndx, value,
                                &act->flags);

    return ReportIllegal(ctx, action->type, field);
}