Copy and duplicate XkbModsRec and XkbKTMapEntryRec Copy these types in so we can extend the vmod size. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
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 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
diff --git a/include/X11/extensions/XKBcommon.h b/include/X11/extensions/XKBcommon.h
index 5b6d02c..a508990 100644
--- a/include/X11/extensions/XKBcommon.h
+++ b/include/X11/extensions/XKBcommon.h
@@ -149,12 +149,24 @@ typedef union _XkbcAction {
unsigned char type;
} XkbcAction;
+typedef struct _XkbcMods {
+ uint32_t mask; /* effective mods */
+ uint32_t vmods;
+ uint8_t real_mods;
+} XkbcModsRec, *XkbcModsPtr;
+
+typedef struct _XkbcKTMapEntry {
+ Bool active;
+ uint16_t level;
+ XkbcModsRec mods;
+} XkbcKTMapEntryRec, *XkbcKTMapEntryPtr;
+
typedef struct _XkbcKeyType {
- XkbModsRec mods;
- unsigned char num_levels;
+ XkbcModsRec mods;
+ uint16_t num_levels;
unsigned char map_count;
- XkbKTMapEntryPtr map;
- XkbModsPtr preserve;
+ XkbcKTMapEntryPtr map;
+ XkbcModsPtr preserve;
CARD32 name;
CARD32 *level_names;
} XkbcKeyTypeRec, *XkbcKeyTypePtr;
@@ -170,7 +182,7 @@ typedef struct _XkbcSymInterpretRec {
typedef struct _XkbcCompatMapRec {
XkbcSymInterpretPtr sym_interpret;
- XkbModsRec groups[XkbNumKbdGroups];
+ XkbcModsRec groups[XkbNumKbdGroups];
unsigned short num_si;
unsigned short size_si;
} XkbcCompatMapRec, *XkbcCompatMapPtr;
diff --git a/src/alloc.c b/src/alloc.c
index b0393b9..7c81271 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -79,7 +79,7 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI)
}
compat->size_si = nSI;
compat->num_si = 0;
- bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(XkbModsRec));
+ bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(XkbcModsRec));
xkb->compat = compat;
return Success;
@@ -99,7 +99,7 @@ XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap)
which = XkbAllCompatMask;
if (which & XkbGroupCompatMask)
- bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(XkbModsRec));
+ bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(XkbcModsRec));
if (which & XkbSymInterpMask) {
if (compat->sym_interpret && (compat->size_si > 0))
diff --git a/src/malloc.c b/src/malloc.c
index 7bcea7c..708407a 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -252,19 +252,19 @@ XkbcCopyKeyType(XkbcKeyTypePtr from, XkbcKeyTypePtr into)
*into = *from;
if (from->map && (into->map_count > 0)) {
- into->map = _XkbTypedCalloc(into->map_count, XkbKTMapEntryRec);
+ into->map = _XkbTypedCalloc(into->map_count, XkbcKTMapEntryRec);
if (!into->map)
return BadAlloc;
memcpy(into->map, from->map,
- into->map_count * sizeof(XkbKTMapEntryRec));
+ into->map_count * sizeof(XkbcKTMapEntryRec));
}
if (from->preserve && (into->map_count > 0)) {
- into->preserve = _XkbTypedCalloc(into->map_count, XkbModsRec);
+ into->preserve = _XkbTypedCalloc(into->map_count, XkbcModsRec);
if (!into->preserve)
return BadAlloc;
memcpy(into->preserve, from->preserve,
- into->map_count * sizeof(XkbModsRec));
+ into->map_count * sizeof(XkbcModsRec));
}
if (from->level_names && (into->num_levels > 0)) {
@@ -330,11 +330,11 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
type->map_count = 0;
}
else {
- XkbKTMapEntryRec *prev_map = type->map;
+ XkbcKTMapEntryRec *prev_map = type->map;
if ((map_count > type->map_count) || !type->map)
type->map = _XkbTypedRealloc(type->map, map_count,
- XkbKTMapEntryRec);
+ XkbcKTMapEntryRec);
if (!type->map) {
if (prev_map)
_XkbFree(prev_map);
@@ -342,11 +342,11 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
}
if (want_preserve) {
- XkbModsRec *prev_preserve = type->preserve;
+ XkbcModsRec *prev_preserve = type->preserve;
if ((map_count > type->map_count) || !type->preserve)
type->preserve = _XkbTypedRealloc(type->preserve, map_count,
- XkbModsRec);
+ XkbcModsRec);
if (!type->preserve) {
if (prev_preserve)
_XkbFree(prev_preserve);
diff --git a/src/misc.c b/src/misc.c
index 2a1f9cd..e1896a2 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -35,23 +35,23 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/keysym.h>
#include <X11/extensions/XKBfilecommon.h>
-#define mapSize(m) (sizeof(m) / sizeof(XkbKTMapEntryRec))
-static XkbKTMapEntryRec map2Level[]= {
+#define mapSize(m) (sizeof(m) / sizeof(XkbcKTMapEntryRec))
+static XkbcKTMapEntryRec map2Level[]= {
{ True, ShiftMask, {1, ShiftMask, 0} }
};
-static XkbKTMapEntryRec mapAlpha[]= {
+static XkbcKTMapEntryRec mapAlpha[]= {
{ True, ShiftMask, { 1, ShiftMask, 0 } },
{ True, LockMask, { 0, LockMask, 0 } }
};
-static XkbModsRec preAlpha[]= {
+static XkbcModsRec preAlpha[]= {
{ 0, 0, 0 },
{ LockMask, LockMask, 0 }
};
#define NL_VMOD_MASK 0
-static XkbKTMapEntryRec mapKeypad[]= {
+static XkbcKTMapEntryRec mapKeypad[]= {
{ True, ShiftMask, { 1, ShiftMask, 0 } },
{ False, 0, { 1, 0, NL_VMOD_MASK } }
};
diff --git a/src/xkb.c b/src/xkb.c
index f5a1a0f..28b5cf4 100644
--- a/src/xkb.c
+++ b/src/xkb.c
@@ -103,7 +103,7 @@ XkbcComputeEffectiveMap(XkbcDescPtr xkb, XkbcKeyTypePtr type,
{
int i;
unsigned tmp;
- XkbKTMapEntryPtr entry = NULL;
+ XkbcKTMapEntryPtr entry = NULL;
if (!xkb || !type || !xkb->server)
return False;
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 6058c5a..5c8d7df 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -54,7 +54,7 @@ typedef struct _GroupCompatInfo
unsigned char fileID;
unsigned char merge;
unsigned char real_mods;
- unsigned short vmods;
+ uint32_t vmods;
} GroupCompatInfo;
typedef struct _CompatInfo
diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c
index 786052c..cf5d96f 100644
--- a/src/xkbcomp/keytypes.c
+++ b/src/xkbcomp/keytypes.c
@@ -60,7 +60,7 @@ typedef struct _KeyTypeInfo
int numLevels;
int nEntries;
int szEntries;
- XkbKTMapEntryPtr entries;
+ XkbcKTMapEntryPtr entries;
PreserveInfo *preserve;
int szNames;
CARD32 *lvlNames;
@@ -94,7 +94,7 @@ CARD32 tok_KEYPAD;
extern Bool AddMapEntry(XkbcDescPtr /* xkb */ ,
KeyTypeInfo * /* type */ ,
- XkbKTMapEntryPtr /* new */ ,
+ XkbcKTMapEntryPtr /* new */ ,
Bool /* clobber */ ,
Bool /* report */
);
@@ -159,10 +159,10 @@ InitKeyTypesInfo(KeyTypesInfo * info, XkbcDescPtr xkb, KeyTypesInfo * from)
if (from->dflt.entries)
{
info->dflt.entries = uTypedCalloc(from->dflt.szEntries,
- XkbKTMapEntryRec);
+ XkbcKTMapEntryRec);
if (info->dflt.entries)
{
- unsigned sz = from->dflt.nEntries * sizeof(XkbKTMapEntryRec);
+ unsigned sz = from->dflt.nEntries * sizeof(XkbcKTMapEntryRec);
memcpy(info->dflt.entries, from->dflt.entries, sz);
}
}
@@ -472,11 +472,11 @@ HandleIncludeKeyTypes(IncludeStmt * stmt,
/***====================================================================***/
-static XkbKTMapEntryPtr
+static XkbcKTMapEntryPtr
FindMatchingMapEntry(KeyTypeInfo * type, unsigned mask, unsigned vmask)
{
register int i;
- XkbKTMapEntryPtr entry;
+ XkbcKTMapEntryPtr entry;
for (i = 0, entry = type->entries; i < type->nEntries; i++, entry++)
{
@@ -506,15 +506,15 @@ DeleteLevel1MapEntries(KeyTypeInfo * type)
}
/**
- * Return a pointer to the next free XkbKTMapEntry, reallocating space if
+ * Return a pointer to the next free XkbcKTMapEntry, reallocating space if
* necessary.
*/
-static XkbKTMapEntryPtr
+static XkbcKTMapEntryPtr
NextMapEntry(KeyTypeInfo * type)
{
if (type->entries == NULL)
{
- type->entries = uTypedCalloc(2, XkbKTMapEntryRec);
+ type->entries = uTypedCalloc(2, XkbcKTMapEntryRec);
if (type->entries == NULL)
{
ERROR("Couldn't allocate map entries for %s\n", TypeTxt(type));
@@ -529,7 +529,7 @@ NextMapEntry(KeyTypeInfo * type)
type->szEntries *= 2;
type->entries = uTypedRecalloc(type->entries,
type->nEntries, type->szEntries,
- XkbKTMapEntryRec);
+ XkbcKTMapEntryRec);
if (type->entries == NULL)
{
ERROR("Couldn't reallocate map entries for %s\n", TypeTxt(type));
@@ -615,9 +615,9 @@ AddPreserve(XkbcDescPtr xkb,
Bool
AddMapEntry(XkbcDescPtr xkb,
KeyTypeInfo * type,
- XkbKTMapEntryPtr new, Bool clobber, Bool report)
+ XkbcKTMapEntryPtr new, Bool clobber, Bool report)
{
- XkbKTMapEntryPtr old;
+ XkbcKTMapEntryPtr old;
if ((old =
FindMatchingMapEntry(type, new->mods.real_mods, new->mods.vmods)))
@@ -682,7 +682,7 @@ SetMapEntry(KeyTypeInfo * type,
XkbcDescPtr xkb, ExprDef * arrayNdx, ExprDef * value)
{
ExprResult rtrn;
- XkbKTMapEntryRec entry;
+ XkbcKTMapEntryRec entry;
if (arrayNdx == NULL)
return ReportTypeShouldBeArray(type, "map entry");
@@ -1019,7 +1019,7 @@ HandleKeyTypeDef(KeyTypeDef * def,
/* default type */
for (i = 0; i < info->dflt.nEntries; i++)
{
- XkbKTMapEntryPtr dflt;
+ XkbcKTMapEntryPtr dflt;
dflt = &info->dflt.entries[i];
if (((dflt->mods.real_mods & type.mask) == dflt->mods.real_mods) &&
((dflt->mods.vmods & type.vmask) == dflt->mods.vmods))
@@ -1134,8 +1134,8 @@ CopyDefToKeyType(XkbcDescPtr xkb, XkbcKeyTypePtr type, KeyTypeInfo * def)
for (pre = def->preserve; pre != NULL;
pre = (PreserveInfo *) pre->defs.next)
{
- XkbKTMapEntryPtr match;
- XkbKTMapEntryRec tmp;
+ XkbcKTMapEntryPtr match;
+ XkbcKTMapEntryRec tmp;
tmp.mods.real_mods = pre->indexMods;
tmp.mods.vmods = pre->indexVMods;
tmp.level = 0;
@@ -1156,7 +1156,7 @@ CopyDefToKeyType(XkbcDescPtr xkb, XkbcKeyTypePtr type, KeyTypeInfo * def)
type->map = def->entries;
if (def->preserve)
{
- type->preserve = uTypedCalloc(type->map_count, XkbModsRec);
+ type->preserve = uTypedCalloc(type->map_count, XkbcModsRec);
if (!type->preserve)
{
WARN("Couldn't allocate preserve array in CopyDefToKeyType\n");