include: properly use the default map if none is found For some reason this piece of code wasn't copied from xkbcomp, which causes all of the warnings like these: Warning: No map in include statement, but "pc" contains several; Using first defined map, "pc105" Signed-off-by: Ran Benita <ran234@gmail.com>
diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c
index 692da56..b4e9d9e 100644
--- a/src/xkbcomp/include.c
+++ b/src/xkbcomp/include.c
@@ -250,11 +250,19 @@ ProcessIncludeFile(struct xkb_context *ctx,
}
}
else if (rtrn->common.next) {
- log_vrb(ctx, 5,
- "No map in include statement, but \"%s\" contains several; "
- "Using first defined map, \"%s\"\n",
- stmt->file, rtrn->name);
+ for (; mapToUse; mapToUse = (XkbFile *) mapToUse->common.next)
+ if (mapToUse->flags & XkbLC_Default)
+ break;
+
+ if (!mapToUse) {
+ mapToUse = rtrn;
+ log_vrb(ctx, 5,
+ "No map in include statement, but \"%s\" contains several; "
+ "Using first defined map, \"%s\"\n",
+ stmt->file, rtrn->name);
+ }
}
+
if (mapToUse->file_type != file_type) {
log_err(ctx,
"Include file wrong type (expected %s, got %s); "
@@ -263,6 +271,7 @@ ProcessIncludeFile(struct xkb_context *ctx,
xkb_file_type_to_string(mapToUse->file_type), stmt->file);
return false;
}
+
/* FIXME: we have to check recursive includes here (or somewhere) */
*file_rtrn = mapToUse;