summaryrefslogtreecommitdiff
path: root/src/keymap.c
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-02-10 13:06:22 +0200
committerRan Benita <ran234@gmail.com>2014-02-10 13:15:58 +0200
commit2ecc0f8316bdbc41f81845fc9a5f0809c38a6229 (patch)
tree7b83605a5bf0d927b122286ac04561e60f1b6ab4 /src/keymap.c
parentc11f05e064ea2676cfc8c644bd95c878db3a9130 (diff)
downloadxorg-lib-libxkbcommon-2ecc0f8316bdbc41f81845fc9a5f0809c38a6229.tar.gz
context: add xkb_context_sanitize_rule_names()
We want all the default logic in a test, so encapsulate it in this function, and make all the get_default_* functions static. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/keymap.c b/src/keymap.c
index abf1387..892b7cf 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -137,28 +137,15 @@ xkb_keymap_new_from_names(struct xkb_context *ctx,
return NULL;
}
+ keymap = xkb_keymap_new(ctx, format, flags);
+ if (!keymap)
+ return NULL;
+
if (rmlvo_in)
rmlvo = *rmlvo_in;
else
memset(&rmlvo, 0, sizeof(rmlvo));
-
- if (isempty(rmlvo.rules))
- rmlvo.rules = xkb_context_get_default_rules(ctx);
- if (isempty(rmlvo.model))
- rmlvo.model = xkb_context_get_default_model(ctx);
- /* Layout and variant are tied together, so don't try to use one from
- * the caller and one from the environment. */
- if (isempty(rmlvo.layout)) {
- rmlvo.layout = xkb_context_get_default_layout(ctx);
- rmlvo.variant = xkb_context_get_default_variant(ctx);
- }
- /* Options can be empty, so respect that if passed in. */
- if (rmlvo.options == NULL)
- rmlvo.options = xkb_context_get_default_options(ctx);
-
- keymap = xkb_keymap_new(ctx, format, flags);
- if (!keymap)
- return NULL;
+ xkb_context_sanitize_rule_names(ctx, &rmlvo);
if (!ops->keymap_new_from_names(keymap, &rmlvo)) {
xkb_keymap_unref(keymap);