Commit 8995ac58 authored by Ran Benita's avatar Ran Benita Committed by Peter Hutterer

When a file contains several maps, look for a default map

Rather than always taking the first one in the file. This is exactly the
intended use of the 'default' flag.

Note that pretty much the same code is duplicated in xkbcomp.c when
compiling a single file from the command line, but there it is
implemented correctly (look for XkbLC_Default). default avatarRan Benita <>
Tested-by: default avatarBenno Schulenberg <>
Acked-by: Sergey Udaltsov's avatarSergey Udaltsov <>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <>
parent bf4d7d05
......@@ -88,6 +88,15 @@ ProcessIncludeFile(IncludeStmt * stmt,
XkbAddFileToCache(stmt->file, file_type, stmt->path, rtrn);
* A single file may contain several maps. Here's how we choose the map:
* - If a specific map was requested, look for it exclusively.
* - Otherwise, if the file only contains a single map, return it.
* - Otherwise, if the file has maps tagged as default, return the
* first one.
* - If all fails, return the first map in the file.
mapToUse = rtrn;
if (stmt->map != NULL)
......@@ -105,12 +114,24 @@ ProcessIncludeFile(IncludeStmt * stmt,
return False;
else if ((rtrn-> != NULL) && (warningLevel > 5))
else if (rtrn-> != NULL)
while ((mapToUse) && !(mapToUse->flags & XkbLC_Default))
mapToUse = (XkbFile *) mapToUse->;
if (!mapToUse)
if (warningLevel > 5)
WARN1("No map in include statement, but \"%s\" contains several\n",
WARN1("No map in include statement, but \"%s\" contains several without a default map\n",
ACTION1("Using first defined map, \"%s\"\n", rtrn->name);
mapToUse = rtrn;
setScanState(oldFile, oldLine);
if (mapToUse->type != file_type)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment