diff options
author | Daniel Stone <daniel@fooishbar.org> | 2013-02-28 10:48:40 -0800 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2013-03-19 10:53:37 +0000 |
commit | fbe5e6751e7ac806f8d55689e02966a1b995f3af (patch) | |
tree | e193e79801672c42d2264c187b5eaad9c753af50 /src/keymap.c | |
parent | d4c22ecc8a272da5d21f2b7991edf200b8873dea (diff) | |
download | xorg-lib-libxkbcommon-fbe5e6751e7ac806f8d55689e02966a1b995f3af.tar.gz |
Add environment overrides for default RMLVO
You can now set default values in the environment, as well as a context
option to ignore the environment, e.g. for tests.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'src/keymap.c')
-rw-r--r-- | src/keymap.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/keymap.c b/src/keymap.c index 8404c03..b468f94 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -153,13 +153,24 @@ xkb_keymap_new_from_names(struct xkb_context *ctx, return NULL; } - rmlvo = *rmlvo_in; + if (rmlvo_in) + rmlvo = *rmlvo_in; + else + memset(&rmlvo, 0, sizeof(rmlvo)); + if (isempty(rmlvo.rules)) - rmlvo.rules = DEFAULT_XKB_RULES; + rmlvo.rules = xkb_context_get_default_rules(ctx); if (isempty(rmlvo.model)) - rmlvo.model = DEFAULT_XKB_MODEL; - if (isempty(rmlvo.layout)) - rmlvo.layout = DEFAULT_XKB_LAYOUT; + 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) |