Add flags to keymap compilation entrypoints
No use as yet, but might as well ... Signed-off-by: Daniel Stone <daniel@fooishbar.org>master
parent
1928397a21
commit
b537b5524a
|
@ -264,6 +264,11 @@ xkb_context_unref(struct xkb_context *context);
|
|||
* @{
|
||||
*/
|
||||
|
||||
enum xkb_map_compile_flags {
|
||||
/** Apparently you can't have empty enums. What a drag. */
|
||||
XKB_MAP_COMPILE_PLACEHOLDER = 0,
|
||||
};
|
||||
|
||||
/**
|
||||
* The primary keymap entry point: creates a new XKB keymap from a set of
|
||||
* RMLVO (Rules + Model + Layout + Variant + Option) names.
|
||||
|
@ -273,7 +278,8 @@ xkb_context_unref(struct xkb_context *context);
|
|||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_names(struct xkb_context *context,
|
||||
const struct xkb_rule_names *names);
|
||||
const struct xkb_rule_names *names,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
/**
|
||||
* Deprecated entrypoint for legacy users who need to be able to compile
|
||||
|
@ -287,7 +293,8 @@ xkb_map_new_from_names(struct xkb_context *context,
|
|||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_kccgst(struct xkb_context *context,
|
||||
const struct xkb_component_names *kccgst);
|
||||
const struct xkb_component_names *kccgst,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
enum xkb_keymap_format {
|
||||
/** The current/classic XKB text format, as generated by xkbcomp -xkb. */
|
||||
|
@ -300,7 +307,8 @@ enum xkb_keymap_format {
|
|||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_fd(struct xkb_context *context,
|
||||
int fd, enum xkb_keymap_format format);
|
||||
int fd, enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
/**
|
||||
* Creates an XKB keymap from a full text XKB keymap serialised into one
|
||||
|
@ -309,7 +317,8 @@ xkb_map_new_from_fd(struct xkb_context *context,
|
|||
struct xkb_keymap *
|
||||
xkb_map_new_from_string(struct xkb_context *context,
|
||||
const char *string,
|
||||
enum xkb_keymap_format format);
|
||||
enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
/**
|
||||
* Takes a new reference on a keymap.
|
||||
|
|
|
@ -116,7 +116,8 @@ unwind_file:
|
|||
|
||||
_X_EXPORT struct xkb_keymap *
|
||||
xkb_map_new_from_names(struct xkb_context *context,
|
||||
const struct xkb_rule_names *rmlvo)
|
||||
const struct xkb_rule_names *rmlvo,
|
||||
enum xkb_map_compile_flags flags)
|
||||
{
|
||||
XkbRF_VarDefsRec defs;
|
||||
struct xkb_component_names *names;
|
||||
|
@ -139,7 +140,7 @@ xkb_map_new_from_names(struct xkb_context *context,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
xkb = xkb_map_new_from_kccgst(context, names);
|
||||
xkb = xkb_map_new_from_kccgst(context, names, 0);
|
||||
|
||||
free(names->keymap);
|
||||
free(names->keycodes);
|
||||
|
@ -218,7 +219,8 @@ err:
|
|||
|
||||
_X_EXPORT struct xkb_keymap *
|
||||
xkb_map_new_from_kccgst(struct xkb_context *context,
|
||||
const struct xkb_component_names *kccgst)
|
||||
const struct xkb_component_names *kccgst,
|
||||
enum xkb_map_compile_flags flags)
|
||||
{
|
||||
XkbFile *file;
|
||||
|
||||
|
@ -258,7 +260,8 @@ xkb_map_new_from_kccgst(struct xkb_context *context,
|
|||
_X_EXPORT struct xkb_keymap *
|
||||
xkb_map_new_from_string(struct xkb_context *context,
|
||||
const char *string,
|
||||
enum xkb_keymap_format format)
|
||||
enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags)
|
||||
{
|
||||
XkbFile *file;
|
||||
|
||||
|
@ -283,7 +286,8 @@ xkb_map_new_from_string(struct xkb_context *context,
|
|||
_X_EXPORT struct xkb_keymap *
|
||||
xkb_map_new_from_fd(struct xkb_context *context,
|
||||
int fd,
|
||||
enum xkb_keymap_format format)
|
||||
enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags)
|
||||
{
|
||||
XkbFile *file;
|
||||
FILE *fptr;
|
||||
|
|
|
@ -51,7 +51,7 @@ test_file(const char *path)
|
|||
|
||||
fprintf(stderr, "\nCompiling path: %s\n", path);
|
||||
|
||||
xkb = xkb_map_new_from_fd(context, fd, XKB_KEYMAP_FORMAT_TEXT_V1);
|
||||
xkb = xkb_map_new_from_fd(context, fd, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
close(fd);
|
||||
|
||||
if (!xkb) {
|
||||
|
@ -86,7 +86,7 @@ test_string(const char *string)
|
|||
|
||||
fprintf(stderr, "\nCompiling string\n");
|
||||
|
||||
xkb = xkb_map_new_from_string(context, string, XKB_KEYMAP_FORMAT_TEXT_V1);
|
||||
xkb = xkb_map_new_from_string(context, string, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
if (!xkb) {
|
||||
xkb_context_unref(context);
|
||||
return 0;
|
||||
|
|
|
@ -52,7 +52,7 @@ test_names(const char *keycodes, const char *types,
|
|||
fprintf(stderr, "\nCompiling %s %s %s %s\n", kccgst.keycodes, kccgst.types,
|
||||
kccgst.compat, kccgst.symbols);
|
||||
|
||||
xkb = xkb_map_new_from_kccgst(context, &kccgst);
|
||||
xkb = xkb_map_new_from_kccgst(context, &kccgst, 0);
|
||||
if (!xkb) {
|
||||
ret = 0;
|
||||
goto err_ctx;
|
||||
|
|
|
@ -49,7 +49,7 @@ test_rmlvo(const char *rules, const char *model, const char *layout,
|
|||
fprintf(stderr, "\nCompiling %s %s %s %s %s\n", rmlvo.rules, rmlvo.model,
|
||||
rmlvo.layout, rmlvo.variant, rmlvo.options);
|
||||
|
||||
xkb = xkb_map_new_from_names(context, &rmlvo);
|
||||
xkb = xkb_map_new_from_names(context, &rmlvo, 0);
|
||||
if (!xkb) {
|
||||
xkb_context_unref(context);
|
||||
return 0;
|
||||
|
|
|
@ -218,7 +218,7 @@ main(void)
|
|||
context = xkb_context_new();
|
||||
assert(context);
|
||||
|
||||
xkb = xkb_map_new_from_names(context, &rmlvo);
|
||||
xkb = xkb_map_new_from_names(context, &rmlvo, 0);
|
||||
assert(xkb);
|
||||
|
||||
test_update_key(xkb);
|
||||
|
|
Loading…
Reference in New Issue