summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-07-21 15:27:09 +0300
committerRan Benita <ran234@gmail.com>2012-07-23 00:45:35 +0300
commit544a83e6d7d555406dbb33a5bbe3d266078bc7f2 (patch)
treec3a915c79cfa87b87f4532ad2a91257748a6060e /src
parent3bb3e9c3a9d76149fb8908fa40ea13d96951fc3c (diff)
vmod: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/xkbcomp/vmod.c84
-rw-r--r--src/xkbcomp/vmod.h1
2 files changed, 46 insertions, 39 deletions
diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c
index 4d200ec..c2e0710 100644
--- a/src/xkbcomp/vmod.c
+++ b/src/xkbcomp/vmod.c
@@ -43,7 +43,6 @@ ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap)
for (i = 0; i < XkbNumVirtualMods; i++)
keymap->vmods[i] = XkbNoModifierMask;
- info->keymap = keymap;
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1)
if (keymap->vmod_names[i])
info->defined |= bit;
@@ -69,45 +68,53 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap,
for (i = 0, bit = 1, nextFree = -1; i < XkbNumVirtualMods; i++, bit <<=
1) {
- if (info->defined & bit) {
- if (keymap->vmod_names[i] &&
- strcmp(keymap->vmod_names[i],
- xkb_atom_text(keymap->ctx, stmt->name)) == 0) { /* already defined */
- info->available |= bit;
- if (stmt->value == NULL)
- return true;
- else {
- const char *str1;
- const char *str2 = "";
- if (!ExprResolveModMask(keymap->ctx, stmt->value,
- &mod)) {
- str1 = xkb_atom_text(keymap->ctx, stmt->name);
- ACTION("Declaration of %s ignored\n", str1);
- return false;
- }
- if (mod.uval == keymap->vmods[i])
- return true;
-
- str1 = xkb_atom_text(keymap->ctx, stmt->name);
- WARN("Virtual modifier %s multiply defined\n", str1);
- str1 = XkbcModMaskText(keymap->vmods[i], true);
- if (mergeMode == MERGE_OVERRIDE) {
- str2 = str1;
- str1 = XkbcModMaskText(mod.uval, true);
- }
- ACTION("Using %s, ignoring %s\n", str1, str2);
- if (mergeMode == MERGE_OVERRIDE)
- keymap->vmods[i] = mod.uval;
+ if (!(info->defined & bit)) {
+ if (nextFree < 0)
+ nextFree = i;
+ continue;
+ }
+
+ if (keymap->vmod_names[i] &&
+ strcmp(keymap->vmod_names[i],
+ xkb_atom_text(keymap->ctx, stmt->name)) == 0) { /* already defined */
+ info->available |= bit;
+ if (stmt->value == NULL)
+ return true;
+ else {
+ const char *str1;
+ const char *str2 = "";
+
+ if (!ExprResolveModMask(keymap->ctx, stmt->value,
+ &mod)) {
+ log_err(keymap->ctx, "Declaration of %s ignored\n",
+ xkb_atom_text(keymap->ctx, stmt->name));
+ return false;
+ }
+
+ if (mod.uval == keymap->vmods[i])
return true;
+
+ str1 = XkbcModMaskText(keymap->vmods[i], true);
+ if (mergeMode == MERGE_OVERRIDE) {
+ str2 = str1;
+ str1 = XkbcModMaskText(mod.uval, true);
}
+ log_warn(keymap->ctx,
+ "Virtual modifier %s multiply defined; "
+ "Using %s, ignoring %s\n",
+ xkb_atom_text(keymap->ctx, stmt->name), str1, str2);
+
+ if (mergeMode == MERGE_OVERRIDE)
+ keymap->vmods[i] = mod.uval;
+ return true;
}
}
- else if (nextFree < 0)
- nextFree = i;
}
+
if (nextFree < 0) {
- ERROR("Too many virtual modifiers defined (maximum %d)\n",
- XkbNumVirtualMods);
+ log_err(keymap->ctx,
+ "Too many virtual modifiers defined (maximum %d)\n",
+ XkbNumVirtualMods);
return false;
}
info->defined |= (1 << nextFree);
@@ -120,8 +127,8 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap,
keymap->vmods[nextFree] = mod.uval;
return true;
}
- ACTION("Declaration of %s ignored\n",
- xkb_atom_text(keymap->ctx, stmt->name));
+ log_err(keymap->ctx, "Declaration of %s ignored\n",
+ xkb_atom_text(keymap->ctx, stmt->name));
return false;
}
@@ -217,8 +224,9 @@ ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
if (ExprResolveInteger(keymap->ctx, def, val_rtrn)) {
if (val_rtrn->uval < XkbNumVirtualMods)
return true;
- ERROR("Illegal virtual modifier %d (must be 0..%d inclusive)\n",
- val_rtrn->uval, XkbNumVirtualMods - 1);
+ log_err(keymap->ctx,
+ "Illegal virtual modifier %d (must be 0..%d inclusive)\n",
+ val_rtrn->uval, XkbNumVirtualMods - 1);
}
return false;
}
diff --git a/src/xkbcomp/vmod.h b/src/xkbcomp/vmod.h
index ad3e819..f08e037 100644
--- a/src/xkbcomp/vmod.h
+++ b/src/xkbcomp/vmod.h
@@ -31,7 +31,6 @@
#include "expr.h"
typedef struct _VModInfo {
- struct xkb_keymap *keymap;
unsigned defined;
unsigned available;
unsigned newlyDefined;