diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-04-11 14:36:55 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-04-11 14:36:55 +0200 |
commit | 98d3e40fb7c88b670a93e73dace2d0f05a5f903c (patch) | |
tree | b1292124a86c219fb434db4ec28e8f805ff52287 /src/3rdparty/xkbcommon/src/context-priv.c | |
parent | a74e4b85be83e2da47f4a1d8fcf0e78079335b80 (diff) | |
parent | bab494e4d046f5617d19f5fec35eeff94377c51f (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
mkspecs/qnx-armv7le-qcc/qplatformdefs.h
src/printsupport/kernel/qcups.cpp
src/widgets/styles/qstyle.h
tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
Change-Id: Ia41e13051169a6d4a8a1267548e7d47b859bb267
Diffstat (limited to 'src/3rdparty/xkbcommon/src/context-priv.c')
-rw-r--r-- | src/3rdparty/xkbcommon/src/context-priv.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/3rdparty/xkbcommon/src/context-priv.c b/src/3rdparty/xkbcommon/src/context-priv.c index 4d7b2ed110..c934201685 100644 --- a/src/3rdparty/xkbcommon/src/context-priv.c +++ b/src/3rdparty/xkbcommon/src/context-priv.c @@ -112,60 +112,79 @@ xkb_context_get_buffer(struct xkb_context *ctx, size_t size) #define DEFAULT_XKB_OPTIONS NULL #endif -const char * +static const char * xkb_context_get_default_rules(struct xkb_context *ctx) { const char *env = NULL; if (ctx->use_environment_names) - env = getenv("XKB_DEFAULT_RULES"); + env = secure_getenv("XKB_DEFAULT_RULES"); return env ? env : DEFAULT_XKB_RULES; } -const char * +static const char * xkb_context_get_default_model(struct xkb_context *ctx) { const char *env = NULL; if (ctx->use_environment_names) - env = getenv("XKB_DEFAULT_MODEL"); + env = secure_getenv("XKB_DEFAULT_MODEL"); return env ? env : DEFAULT_XKB_MODEL; } -const char * +static const char * xkb_context_get_default_layout(struct xkb_context *ctx) { const char *env = NULL; if (ctx->use_environment_names) - env = getenv("XKB_DEFAULT_LAYOUT"); + env = secure_getenv("XKB_DEFAULT_LAYOUT"); return env ? env : DEFAULT_XKB_LAYOUT; } -const char * +static const char * xkb_context_get_default_variant(struct xkb_context *ctx) { const char *env = NULL; - const char *layout = getenv("XKB_DEFAULT_VARIANT"); + const char *layout = secure_getenv("XKB_DEFAULT_LAYOUT"); /* We don't want to inherit the variant if they haven't also set a * layout, since they're so closely paired. */ if (layout && ctx->use_environment_names) - env = getenv("XKB_DEFAULT_VARIANT"); + env = secure_getenv("XKB_DEFAULT_VARIANT"); return env ? env : DEFAULT_XKB_VARIANT; } -const char * +static const char * xkb_context_get_default_options(struct xkb_context *ctx) { const char *env = NULL; if (ctx->use_environment_names) - env = getenv("XKB_DEFAULT_OPTIONS"); + env = secure_getenv("XKB_DEFAULT_OPTIONS"); return env ? env : DEFAULT_XKB_OPTIONS; } + +void +xkb_context_sanitize_rule_names(struct xkb_context *ctx, + struct xkb_rule_names *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); +} |