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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 634f027..2ae5e05 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -134,7 +134,6 @@ typedef struct _IndicatorNameInfo {
xkb_led_index_t ndx;
xkb_atom_t name;
- bool virtual;
} IndicatorNameInfo;
typedef struct _KeyNamesInfo {
@@ -183,7 +182,6 @@ InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
ii->file_id = info->file_id;
ii->ndx = 0;
ii->name = XKB_ATOM_NONE;
- ii->virtual = false;
}
static IndicatorNameInfo *
@@ -230,86 +228,66 @@ AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge,
IndicatorNameInfo *new)
{
IndicatorNameInfo *old;
- bool replace;
+ bool replace, report;
int verbosity = xkb_get_log_verbosity(info->ctx);
replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
old = FindIndicatorByName(info, new->name);
if (old) {
- if ((old->file_id == new->file_id && verbosity > 0) ||
- verbosity > 9) {
- if (old->ndx == new->ndx) {
- if (old->virtual != new->virtual) {
- 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; "
- "Identical definitions ignored\n",
- xkb_atom_text(info->ctx, new->name));
- }
- return true;
- }
- else {
+ report = ((old->file_id == new->file_id && verbosity > 0) ||
+ verbosity > 9);
+
+ if (old->ndx == new->ndx) {
+ if (report)
log_warn(info->ctx, "Multiple indicators named %s; "
- "Using %d, ignoring %d\n",
- xkb_atom_text(info->ctx, new->name),
- (replace ? old->ndx : new->ndx),
- (replace ? new->ndx : old->ndx));
- }
-
- if (replace) {
- list_del(&old->entry);
- free(old);
- }
+ "Identical definitions ignored\n",
+ xkb_atom_text(info->ctx, new->name));
+ return true;
+ }
+
+ if (report)
+ log_warn(info->ctx, "Multiple indicators named %s; "
+ "Using %d, ignoring %d\n",
+ xkb_atom_text(info->ctx, new->name),
+ (replace ? old->ndx : new->ndx),
+ (replace ? new->ndx : old->ndx));
+
+ if (replace) {
+ list_del(&old->entry);
+ free(old);
}
}
old = FindIndicatorByIndex(info, new->ndx);
if (old) {
- if ((old->file_id == new->file_id && verbosity > 0) ||
- verbosity > 9) {
- if (old->name == new->name && old->virtual == new->virtual) {
+ report = ((old->file_id == new->file_id && verbosity > 0) ||
+ verbosity > 9);
+
+ if (old->name == new->name) {
+ if (report)
log_warn(info->ctx, "Multiple names for indicator %d; "
"Identical definitions ignored\n", new->ndx);
- } else {
- const char *oldType, *newType;
- xkb_atom_t using, ignoring;
- if (old->virtual)
- oldType = "virtual indicator";
- else
- oldType = "real indicator";
- if (new->virtual)
- newType = "virtual indicator";
- else
- newType = "real indicator";
- if (replace) {
- using = new->name;
- ignoring = old->name;
- }
- else {
- using = old->name;
- ignoring = new->name;
- }
- log_warn(info->ctx, "Multiple names for indicator %d; "
- "Using %s %s, ignoring %s %s\n",
- new->ndx,
- oldType, xkb_atom_text(info->ctx, using),
- newType, xkb_atom_text(info->ctx, ignoring));
- }
}
- if (replace) {
+ else if (replace) {
+ if (report)
+ log_warn(info->ctx, "Multiple names for indicator %d; "
+ "Using %s, ignoring %s\n", new->ndx,
+ xkb_atom_text(info->ctx, new->name),
+ xkb_atom_text(info->ctx, old->name));
old->name = new->name;
- old->virtual = new->virtual;
}
+ else {
+ if (report)
+ log_warn(info->ctx, "Multiple names for indicator %d; "
+ "Using %s, ignoring %s\n", new->ndx,
+ xkb_atom_text(info->ctx, old->name),
+ xkb_atom_text(info->ctx, new->name));
+ }
+
return true;
}
+
old = new;
new = NextIndicatorName(info);
if (!new) {
@@ -320,7 +298,6 @@ AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge,
}
new->name = old->name;
new->ndx = old->ndx;
- new->virtual = old->virtual;
return true;
}
@@ -796,7 +773,6 @@ HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def,
ii.ndx = (xkb_led_index_t) def->ndx;
ii.name = xkb_atom_intern(info->ctx, str);
- ii.virtual = def->virtual;
return AddIndicatorName(info, merge, &ii);
}