Add flags to keymap compilation entrypoints No use as yet, but might as well ... Signed-off-by: Daniel Stone <daniel@fooishbar.org>
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h
index 4ab9e03..ebb9aa4 100644
--- a/include/xkbcommon/xkbcommon.h
+++ b/include/xkbcommon/xkbcommon.h
@@ -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.
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index bbbc41e..e332697 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -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;
diff --git a/test/filecomp.c b/test/filecomp.c
index 52f54ae..70dbdc2 100644
--- a/test/filecomp.c
+++ b/test/filecomp.c
@@ -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;
diff --git a/test/namescomp.c b/test/namescomp.c
index 0bd4d87..e8652a2 100644
--- a/test/namescomp.c
+++ b/test/namescomp.c
@@ -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;
diff --git a/test/rulescomp.c b/test/rulescomp.c
index 8158852..5ab8112 100644
--- a/test/rulescomp.c
+++ b/test/rulescomp.c
@@ -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;
diff --git a/test/state.c b/test/state.c
index 0090d7c..d405b3e 100644
--- a/test/state.c
+++ b/test/state.c
@@ -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);