Hash :
da5caabb
Author :
Date :
2025-06-16T15:45:42
Add RMLVO builder API Before this commit, the API to work with RMLVO was quite minimal: it only uses raw strings from the `xkb_rule_names` struct. However: - it forces the users to deal with error-prone string formatting; - it does not enforce tying together layouts and variants; - it limits adding new features by requiring defining delimiter characters and the corresponding parsing. Added the following API: - `xkb_rmlvo_builder_new()` - `xkb_rmlvo_builder_append_layout()` - `xkb_rmlvo_builder_append_option()` - `xkb_rmlvo_builder_unref()` There is no intermediate `layout` nor `option` object, in order to to keep the API simple. The only foreseen extension is enabling configuring layout-specific options.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/*
* Copyright © 2025 Pierre Le Marre <dev@wismill.eu>
* SPDX-License-Identifier: MIT
*/
#pragma once
#include "config.h"
#include <stdbool.h>
#include "xkbcommon/xkbcommon.h"
#include "darray.h"
enum RMLVO {
RMLVO_RULES = (1 << 0),
RMLVO_MODEL = (1 << 1),
RMLVO_LAYOUT = (1 << 2),
RMLVO_VARIANT = (1 << 3),
RMLVO_OPTIONS = (1 << 4)
};
struct xkb_rmlvo_builder_layout {
char *layout;
char *variant;
};
typedef darray(struct xkb_rmlvo_builder_layout) xkb_rmlvo_builder_layouts;
struct xkb_rmlvo_builder {
char *rules;
char *model;
xkb_rmlvo_builder_layouts layouts;
darray(char *) options;
int refcnt;
struct xkb_context *ctx;
};