diff options
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/ddxLoad.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index 0361b9be5..76bf09ca7 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -444,6 +444,29 @@ XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need) return xkb; } +static XkbDescPtr +KeymapOrDefaults(DeviceIntPtr dev, XkbDescPtr xkb) +{ + XkbRMLVOSet dflts; + + if (xkb) + return xkb; + + /* we didn't get what we really needed. And that will likely leave + * us with a keyboard that doesn't work. Use the defaults instead */ + LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default " + "keymap instead.\n"); + + XkbGetRulesDflts(&dflts); + + xkb = XkbCompileKeymapForDevice(dev, &dflts, 0); + + XkbFreeRMLVOSet(&dflts, FALSE); + + return xkb; +} + + XkbDescPtr XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo) { @@ -461,20 +484,5 @@ XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo) xkb = XkbCompileKeymapForDevice(dev, rmlvo, need); - if (!xkb) { - XkbRMLVOSet dflts; - - /* we didn't get what we really needed. And that will likely leave - * us with a keyboard that doesn't work. Use the defaults instead */ - LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default " - "keymap instead.\n"); - - XkbGetRulesDflts(&dflts); - - xkb = XkbCompileKeymapForDevice(dev, &dflts, 0); - - XkbFreeRMLVOSet(&dflts, FALSE); - } - - return xkb; + return KeymapOrDefaults(dev, xkb); } |