expr: drop ExprResult from ResolveKeysym

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-07-23 23:56:28 +03:00
parent 0d262fa105
commit 7026229210
3 changed files with 18 additions and 18 deletions

View File

@ -820,26 +820,24 @@ ExprResolveVModMask(struct xkb_keymap *keymap, ExprDef *expr,
keymap);
}
int
bool
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
xkb_keysym_t *sym_rtrn)
{
int ok = 0;
xkb_keysym_t sym;
bool ok = false;
ExprResult result;
if (expr->op == EXPR_IDENT) {
const char *str;
str = xkb_atom_text(ctx, expr->value.str);
if (str) {
sym = xkb_keysym_from_name(str);
if (sym != XKB_KEY_NoSymbol) {
val_rtrn->uval = sym;
return true;
}
}
*sym_rtrn = xkb_keysym_from_name(str);
if (*sym_rtrn != XKB_KEY_NoSymbol)
return true;
}
ok = ExprResolveInteger(ctx, expr, val_rtrn);
if ((ok) && (val_rtrn->uval < 10))
val_rtrn->uval += '0';
ok = ExprResolveInteger(ctx, expr, &result);
if (ok && result.uval < 10)
*sym_rtrn = result.uval + '0';
return ok;
}

View File

@ -103,8 +103,8 @@ extern int
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn,
const LookupEntry *values);
extern int
bool
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
xkb_keysym_t *sym_rtrn);
#endif /* EXPR_H */

View File

@ -1370,13 +1370,15 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def)
ok = true;
tmp.modifier = rtrn.uval;
for (key = def->keys; key != NULL; key = (ExprDef *) key->common.next) {
xkb_keysym_t sym;
if (key->op == EXPR_VALUE && key->value_type == EXPR_TYPE_KEYNAME) {
tmp.haveSymbol = false;
tmp.u.keyName = KeyNameToLong(key->value.keyName);
}
else if (ExprResolveKeySym(ctx, key, &rtrn)) {
else if (ExprResolveKeySym(ctx, key, &sym)) {
tmp.haveSymbol = true;
tmp.u.keySym = rtrn.uval;
tmp.u.keySym = sym;
}
else {
log_err(info->keymap->ctx,