+
+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);
+}