unsigned fileID;
unsigned merge;
unsigned explicit_group;
- unsigned groupInfo;
darray(KeyInfo) keys;
KeyInfo dflt;
VModInfo vmods;
info->errorCount = 0;
info->fileID = 0;
info->merge = MergeOverride;
- info->groupInfo = 0;
darray_init(info->keys);
darray_growalloc(info->keys, SYMBOLS_INIT_SIZE);
info->modMap = NULL;
return true;
}
+enum key_group_selector {
+ NONE = 0,
+ FROM = (1 << 0),
+ TO = (1 << 1),
+};
+
static bool
MergeKeyGroups(SymbolsInfo * info,
KeyInfo * into, KeyInfo * from, unsigned group)
{
xkb_keysym_t *resultSyms = NULL;
+ enum key_group_selector using = NONE;
union xkb_action *resultActs;
unsigned int resultWidth;
unsigned int resultSize = 0;
if (fromSize == 0)
{
resultSize += toSize;
+ using |= TO;
}
else if (toSize == 0 || clobber)
{
resultSize += fromSize;
+ using |= FROM;
}
else
{
resultSize += toSize;
+ using |= TO;
}
}
if (resultSize == 0)
goto out;
+ if (using == FROM)
+ {
+ resultSyms = from->syms[group];
+ goto out;
+ }
+ else if (using == TO)
+ {
+ resultSyms = into->syms[group];
+ goto out;
+ }
+
resultSyms = uTypedCalloc(resultSize, xkb_keysym_t);
if (!resultSyms)
{
for (i = 0; i < resultWidth; i++)
{
- enum { NONE, FROM, TO } use;
+ enum key_group_selector use = NONE;
unsigned int fromSize = 0;
unsigned int toSize = 0;
if (resultActs != from->acts[group])
free(from->acts[group]);
into->numLevels[group] = resultWidth;
- free(into->syms[group]);
+ if (resultSyms != into->syms[group])
+ free(into->syms[group]);
into->syms[group] = resultSyms;
- free(from->syms[group]);
+ if (resultSyms != from->syms[group])
+ free(from->syms[group]);
from->syms[group] = NULL;
from->sizeSyms[group] = 0;
into->sizeSyms[group] = resultSize;
from->symsMapNumEntries[group] = NULL;
into->acts[group] = resultActs;
from->acts[group] = NULL;
- into->symsDefined |= (1 << group);
+ if (into->syms[group])
+ into->symsDefined |= (1 << group);
from->symsDefined &= ~(1 << group);
into->actsDefined |= (1 << group);
from->actsDefined &= ~(1 << group);
static int
HandleSymbolsVar(VarDef *stmt, struct xkb_keymap *keymap, SymbolsInfo *info)
{
- ExprResult elem, field, tmp;
+ ExprResult elem, field;
ExprDef *arrayNdx;
bool ret;
&& ((strcasecmp(field.str, "groupswrap") == 0) ||
(strcasecmp(field.str, "wrapgroups") == 0)))
{
- if (!ExprResolveBoolean(keymap->ctx, stmt->value, &tmp))
- {
- ERROR("Illegal setting for global groupsWrap\n");
- ACTION("Non-boolean value ignored\n");
- ret = false;
- }
- else {
- if (tmp.uval)
- info->groupInfo = XkbWrapIntoRange;
- else
- info->groupInfo = XkbClampIntoRange;
- ret = true;
- }
+ ERROR("Global \"groupswrap\" not supported\n");
+ ACTION("Ignored\n");
+ ret = true;
}
else if ((elem.str == NULL)
&& ((strcasecmp(field.str, "groupsclamp") == 0) ||
(strcasecmp(field.str, "clampgroups") == 0)))
{
- if (!ExprResolveBoolean(keymap->ctx, stmt->value, &tmp))
- {
- ERROR("Illegal setting for global groupsClamp\n");
- ACTION("Non-boolean value ignored\n");
- return false;
- }
- else {
- if (tmp.uval)
- info->groupInfo = XkbClampIntoRange;
- else
- info->groupInfo = XkbWrapIntoRange;
- ret = true;
- }
+ ERROR("Global \"groupsclamp\" not supported\n");
+ ACTION("Ignored\n");
+ ret = true;
}
else if ((elem.str == NULL)
&& ((strcasecmp(field.str, "groupsredirect") == 0) ||
(strcasecmp(field.str, "redirectgroups") == 0)))
{
- if (!ExprResolveGroup(keymap->ctx, stmt->value, &tmp))
- {
- ERROR("Illegal group index for global groupsRedirect\n");
- ACTION("Definition with non-integer group ignored\n");
- ret = false;
- }
- else {
- info->groupInfo = XkbSetGroupInfo(0, XkbRedirectIntoRange,
- tmp.uval);
- ret = true;
- }
+ ERROR("Global \"groupsredirect\" not supported\n");
+ ACTION("Ignored\n");
+ ret = true;
}
else if ((elem.str == NULL) && (strcasecmp(field.str, "allownone") == 0))
{
ERROR("Radio groups not supported\n");
- ACTION("Ignoring \"allow none\" specification\n");
- ret = false;
+ ACTION("Ignoring \"allownone\" specification\n");
+ ret = true;
}
else {
ret = SetActionField(keymap, elem.str, field.str, arrayNdx,
for (i = 0; i < XkbNumKbdGroups; i++) {
if (info.groupNames[i] != XKB_ATOM_NONE) {
- free(UNCONSTIFY(keymap->names->groups[i]));
+ free(keymap->names->groups[i]);
keymap->names->groups[i] = xkb_atom_strdup(keymap->ctx,
info.groupNames[i]);
}