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

View File

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

View File

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