Get rid of xkb_compat_map Same as xkb_{client,server}_map which were already removed. 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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
diff --git a/src/alloc.c b/src/alloc.c
index 8b8fb2b..09e2d41 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -146,39 +146,6 @@ free_sym_maps(struct xkb_keymap *keymap)
}
int
-XkbcAllocCompatMap(struct xkb_keymap *keymap, unsigned nSI)
-{
- if (!keymap)
- return BadMatch;
-
- if (!keymap->compat) {
- keymap->compat = calloc(1, sizeof(*keymap->compat));
- if (!keymap->compat)
- return BadAlloc;
- darray_init(keymap->compat->sym_interpret);
- }
-
- darray_growalloc(keymap->compat->sym_interpret, nSI);
- darray_resize(keymap->compat->sym_interpret, 0);
-
- memset(keymap->compat->groups, 0,
- XkbNumKbdGroups * sizeof(*keymap->compat->groups));
-
- return Success;
-}
-
-static void
-XkbcFreeCompatMap(struct xkb_keymap *keymap)
-{
- if (!keymap || !keymap->compat)
- return;
-
- darray_free(keymap->compat->sym_interpret);
- free(keymap->compat);
- keymap->compat = NULL;
-}
-
-int
XkbcAllocNames(struct xkb_keymap *keymap, unsigned which,
size_t nTotalAliases)
{
@@ -337,7 +304,7 @@ XkbcFreeKeyboard(struct xkb_keymap *keymap)
darray_free(keymap->acts);
free(keymap->behaviors);
free(keymap->vmodmap);
- XkbcFreeCompatMap(keymap);
+ darray_free(keymap->sym_interpret);
XkbcFreeIndicatorMaps(keymap);
XkbcFreeNames(keymap);
XkbcFreeControls(keymap);
diff --git a/src/alloc.h b/src/alloc.h
index a933929..df9844a 100644
--- a/src/alloc.h
+++ b/src/alloc.h
@@ -30,9 +30,6 @@
#include "xkb-priv.h"
extern int
-XkbcAllocCompatMap(struct xkb_keymap *keymap, unsigned nSI);
-
-extern int
XkbcAllocNames(struct xkb_keymap *keymap, unsigned which,
size_t nTotalAliases);
diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index 8443e7d..735c6ef 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -679,7 +679,7 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
write_buf(keymap, buf, size, offset, "\t\tinterpret.repeat= False;\n");
write_buf(keymap, buf, size, offset, "\t\tinterpret.locking= False;\n");
- darray_foreach(interp, keymap->compat->sym_interpret) {
+ darray_foreach(interp, keymap->sym_interpret) {
char keysym_name[64];
if (interp->sym == XKB_KEY_NoSymbol)
@@ -714,7 +714,7 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
for (i = 0; i < XkbNumKbdGroups; i++) {
struct xkb_mods *gc;
- gc = &keymap->compat->groups[i];
+ gc = &keymap->groups[i];
if (gc->real_mods == 0 && gc->vmods == 0)
continue;
write_buf(keymap, buf, size, offset,
diff --git a/src/map.c b/src/map.c
index a3dc648..cb36c72 100644
--- a/src/map.c
+++ b/src/map.c
@@ -146,7 +146,7 @@ xkb_map_num_groups(struct xkb_keymap *keymap)
xkb_group_index_t i;
for (i = 0; i < XkbNumKbdGroups; i++)
- if (keymap->compat->groups[i].mask)
+ if (keymap->groups[i].mask)
ret++;
return ret;
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 2072010..bd6ed34 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -261,11 +261,6 @@ struct xkb_sym_interpret {
union xkb_action act;
};
-struct xkb_compat_map {
- darray(struct xkb_sym_interpret) sym_interpret;
- struct xkb_mods groups[XkbNumKbdGroups];
-};
-
struct xkb_sym_map {
unsigned char kt_index[XkbNumKbdGroups];
unsigned char group_info;
@@ -346,15 +341,17 @@ struct xkb_keymap {
struct xkb_controls * ctrls;
struct xkb_indicator * indicators;
struct xkb_names * names;
- struct xkb_compat_map * compat;
/* key -> explicit flags mapping */
unsigned char *explicit;
darray(struct xkb_key_type) types;
+ /* key -> symbols mapping */
darray(struct xkb_sym_map) key_sym_map;
+ darray(struct xkb_sym_interpret) sym_interpret;
+
/* key -> mod mapping */
unsigned char *modmap;
/* vmod -> mod mapping */
@@ -362,10 +359,13 @@ struct xkb_keymap {
/* key -> vmod mapping */
uint32_t *vmodmap;
- /* acts[key_acts[keycode]] */
+ struct xkb_mods groups[XkbNumKbdGroups];
+
+ /* key -> actions mapping: acts[key_acts[keycode]] */
darray(union xkb_action) acts;
- darray(size_t ) key_acts;
+ darray(size_t) key_acts;
+ /* key -> behavior mapping */
struct xkb_behavior *behaviors;
};
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index c9cf637..9b820bf 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -705,8 +705,8 @@ HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap,
}
static void
-CopyInterps(CompatInfo * info,
- struct xkb_compat_map * compat, bool needSymbol, unsigned pred)
+CopyInterps(CompatInfo *info, struct xkb_keymap *keymap,
+ bool needSymbol, unsigned pred)
{
SymInterpInfo *si;
@@ -715,7 +715,7 @@ CopyInterps(CompatInfo * info,
(needSymbol && (si->interp.sym == XKB_KEY_NoSymbol)) ||
((!needSymbol) && (si->interp.sym != XKB_KEY_NoSymbol)))
continue;
- darray_append(compat->sym_interpret, si->interp);
+ darray_append(keymap->sym_interpret, si->interp);
}
}
@@ -736,10 +736,8 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap,
if (info.errorCount != 0)
goto err_info;
- if (XkbcAllocCompatMap(keymap, info.nInterps) != Success) {
- WSGO("Couldn't allocate compatibility map\n");
- goto err_info;
- }
+ darray_init(keymap->sym_interpret);
+ darray_growalloc(keymap->sym_interpret, info.nInterps);
if (info.name) {
if (XkbcAllocNames(keymap, 0, 0) != Success)
@@ -748,23 +746,22 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap,
}
if (info.nInterps > 0) {
- CopyInterps(&info, keymap->compat, true, XkbSI_Exactly);
- CopyInterps(&info, keymap->compat, true, XkbSI_AllOf | XkbSI_NoneOf);
- CopyInterps(&info, keymap->compat, true, XkbSI_AnyOf);
- CopyInterps(&info, keymap->compat, true, XkbSI_AnyOfOrNone);
- CopyInterps(&info, keymap->compat, false, XkbSI_Exactly);
- CopyInterps(&info, keymap->compat, false, XkbSI_AllOf | XkbSI_NoneOf);
- CopyInterps(&info, keymap->compat, false, XkbSI_AnyOf);
- CopyInterps(&info, keymap->compat, false, XkbSI_AnyOfOrNone);
+ CopyInterps(&info, keymap, true, XkbSI_Exactly);
+ CopyInterps(&info, keymap, true, XkbSI_AllOf | XkbSI_NoneOf);
+ CopyInterps(&info, keymap, true, XkbSI_AnyOf);
+ CopyInterps(&info, keymap, true, XkbSI_AnyOfOrNone);
+ CopyInterps(&info, keymap, false, XkbSI_Exactly);
+ CopyInterps(&info, keymap, false, XkbSI_AllOf | XkbSI_NoneOf);
+ CopyInterps(&info, keymap, false, XkbSI_AnyOf);
+ CopyInterps(&info, keymap, false, XkbSI_AnyOfOrNone);
}
- for (i = 0, gcm = &info.groupCompat[0]; i < XkbNumKbdGroups; i++,
- gcm++) {
- if ((gcm->file_id != 0) || (gcm->real_mods != 0) ||
- (gcm->vmods != 0)) {
- keymap->compat->groups[i].mask = gcm->real_mods;
- keymap->compat->groups[i].real_mods = gcm->real_mods;
- keymap->compat->groups[i].vmods = gcm->vmods;
+ for (i = 0, gcm = &info.groupCompat[0]; i < XkbNumKbdGroups;
+ i++, gcm++) {
+ if (gcm->file_id != 0 || gcm->real_mods != 0 || gcm->vmods != 0) {
+ keymap->groups[i].mask = gcm->real_mods;
+ keymap->groups[i].real_mods = gcm->real_mods;
+ keymap->groups[i].vmods = gcm->vmods;
}
}
@@ -844,7 +841,7 @@ FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
if (num_syms == 0)
return NULL;
- darray_foreach(interp, keymap->compat->sym_interpret) {
+ darray_foreach(interp, keymap->sym_interpret) {
uint32_t mods;
bool found;
@@ -1026,7 +1023,7 @@ UpdateModifiersFromCompat(struct xkb_keymap *keymap)
/* Update group modifiers. */
for (i = 0; i < XkbNumKbdGroups; i++) {
- struct xkb_mods *group = &keymap->compat->groups[i];
+ struct xkb_mods *group = &keymap->groups[i];
group->mask = group->real_mods | VModsToReal(keymap, group->vmods);
}