include: properly use the default map if none is found
authorRan Benita <ran234@gmail.com>
Tue, 28 Aug 2012 12:05:01 +0000 (15:05 +0300)
committerRan Benita <ran234@gmail.com>
Mon, 3 Sep 2012 07:31:12 +0000 (10:31 +0300)
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>
src/xkbcomp/include.c

index 692da56..b4e9d9e 100644 (file)
@@ -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;