keycodes: ignore "virtual" in indicators
The distinction between real/virtual indicators is useless for us, we can just ignore it. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
4c56d4d9c0
commit
be78b8264d
|
@ -134,7 +134,6 @@ typedef struct _IndicatorNameInfo {
|
||||||
|
|
||||||
xkb_led_index_t ndx;
|
xkb_led_index_t ndx;
|
||||||
xkb_atom_t name;
|
xkb_atom_t name;
|
||||||
bool virtual;
|
|
||||||
} IndicatorNameInfo;
|
} IndicatorNameInfo;
|
||||||
|
|
||||||
typedef struct _KeyNamesInfo {
|
typedef struct _KeyNamesInfo {
|
||||||
|
@ -183,7 +182,6 @@ InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
|
||||||
ii->file_id = info->file_id;
|
ii->file_id = info->file_id;
|
||||||
ii->ndx = 0;
|
ii->ndx = 0;
|
||||||
ii->name = XKB_ATOM_NONE;
|
ii->name = XKB_ATOM_NONE;
|
||||||
ii->virtual = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static IndicatorNameInfo *
|
static IndicatorNameInfo *
|
||||||
|
@ -230,86 +228,66 @@ AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge,
|
||||||
IndicatorNameInfo *new)
|
IndicatorNameInfo *new)
|
||||||
{
|
{
|
||||||
IndicatorNameInfo *old;
|
IndicatorNameInfo *old;
|
||||||
bool replace;
|
bool replace, report;
|
||||||
int verbosity = xkb_get_log_verbosity(info->ctx);
|
int verbosity = xkb_get_log_verbosity(info->ctx);
|
||||||
|
|
||||||
replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
|
replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
|
||||||
|
|
||||||
old = FindIndicatorByName(info, new->name);
|
old = FindIndicatorByName(info, new->name);
|
||||||
if (old) {
|
if (old) {
|
||||||
if ((old->file_id == new->file_id && verbosity > 0) ||
|
report = ((old->file_id == new->file_id && verbosity > 0) ||
|
||||||
verbosity > 9) {
|
verbosity > 9);
|
||||||
|
|
||||||
if (old->ndx == new->ndx) {
|
if (old->ndx == new->ndx) {
|
||||||
if (old->virtual != new->virtual) {
|
if (report)
|
||||||
if (replace)
|
|
||||||
old->virtual = new->virtual;
|
|
||||||
log_warn(info->ctx, "Multiple indicators named %s; "
|
|
||||||
"Using %s instead of %s\n",
|
|
||||||
xkb_atom_text(info->ctx, new->name),
|
|
||||||
(old->virtual ? "virtual" : "real"),
|
|
||||||
(old->virtual ? "real" : "virtual"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
log_warn(info->ctx, "Multiple indicators named %s; "
|
log_warn(info->ctx, "Multiple indicators named %s; "
|
||||||
"Identical definitions ignored\n",
|
"Identical definitions ignored\n",
|
||||||
xkb_atom_text(info->ctx, new->name));
|
xkb_atom_text(info->ctx, new->name));
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if (report)
|
||||||
log_warn(info->ctx, "Multiple indicators named %s; "
|
log_warn(info->ctx, "Multiple indicators named %s; "
|
||||||
"Using %d, ignoring %d\n",
|
"Using %d, ignoring %d\n",
|
||||||
xkb_atom_text(info->ctx, new->name),
|
xkb_atom_text(info->ctx, new->name),
|
||||||
(replace ? old->ndx : new->ndx),
|
(replace ? old->ndx : new->ndx),
|
||||||
(replace ? new->ndx : old->ndx));
|
(replace ? new->ndx : old->ndx));
|
||||||
}
|
|
||||||
|
|
||||||
if (replace) {
|
if (replace) {
|
||||||
list_del(&old->entry);
|
list_del(&old->entry);
|
||||||
free(old);
|
free(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
old = FindIndicatorByIndex(info, new->ndx);
|
old = FindIndicatorByIndex(info, new->ndx);
|
||||||
if (old) {
|
if (old) {
|
||||||
if ((old->file_id == new->file_id && verbosity > 0) ||
|
report = ((old->file_id == new->file_id && verbosity > 0) ||
|
||||||
verbosity > 9) {
|
verbosity > 9);
|
||||||
if (old->name == new->name && old->virtual == new->virtual) {
|
|
||||||
|
if (old->name == new->name) {
|
||||||
|
if (report)
|
||||||
log_warn(info->ctx, "Multiple names for indicator %d; "
|
log_warn(info->ctx, "Multiple names for indicator %d; "
|
||||||
"Identical definitions ignored\n", new->ndx);
|
"Identical definitions ignored\n", new->ndx);
|
||||||
} else {
|
}
|
||||||
const char *oldType, *newType;
|
else if (replace) {
|
||||||
xkb_atom_t using, ignoring;
|
if (report)
|
||||||
if (old->virtual)
|
log_warn(info->ctx, "Multiple names for indicator %d; "
|
||||||
oldType = "virtual indicator";
|
"Using %s, ignoring %s\n", new->ndx,
|
||||||
else
|
xkb_atom_text(info->ctx, new->name),
|
||||||
oldType = "real indicator";
|
xkb_atom_text(info->ctx, old->name));
|
||||||
if (new->virtual)
|
old->name = new->name;
|
||||||
newType = "virtual indicator";
|
|
||||||
else
|
|
||||||
newType = "real indicator";
|
|
||||||
if (replace) {
|
|
||||||
using = new->name;
|
|
||||||
ignoring = old->name;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
using = old->name;
|
if (report)
|
||||||
ignoring = new->name;
|
|
||||||
}
|
|
||||||
log_warn(info->ctx, "Multiple names for indicator %d; "
|
log_warn(info->ctx, "Multiple names for indicator %d; "
|
||||||
"Using %s %s, ignoring %s %s\n",
|
"Using %s, ignoring %s\n", new->ndx,
|
||||||
new->ndx,
|
xkb_atom_text(info->ctx, old->name),
|
||||||
oldType, xkb_atom_text(info->ctx, using),
|
xkb_atom_text(info->ctx, new->name));
|
||||||
newType, xkb_atom_text(info->ctx, ignoring));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (replace) {
|
|
||||||
old->name = new->name;
|
|
||||||
old->virtual = new->virtual;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
old = new;
|
old = new;
|
||||||
new = NextIndicatorName(info);
|
new = NextIndicatorName(info);
|
||||||
if (!new) {
|
if (!new) {
|
||||||
|
@ -320,7 +298,6 @@ AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge,
|
||||||
}
|
}
|
||||||
new->name = old->name;
|
new->name = old->name;
|
||||||
new->ndx = old->ndx;
|
new->ndx = old->ndx;
|
||||||
new->virtual = old->virtual;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,7 +773,6 @@ HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def,
|
||||||
|
|
||||||
ii.ndx = (xkb_led_index_t) def->ndx;
|
ii.ndx = (xkb_led_index_t) def->ndx;
|
||||||
ii.name = xkb_atom_intern(info->ctx, str);
|
ii.name = xkb_atom_intern(info->ctx, str);
|
||||||
ii.virtual = def->virtual;
|
|
||||||
|
|
||||||
return AddIndicatorName(info, merge, &ii);
|
return AddIndicatorName(info, merge, &ii);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue