From c3584280092e251d572ada8d988cf0e46ae8e88f Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 8 May 2012 17:51:16 +0100 Subject: [PATCH] Add flags to context creation None defined as yet, but why not. Signed-off-by: Daniel Stone --- include/xkbcommon/xkbcommon.h | 7 ++++++- src/context.c | 2 +- test/context.c | 2 +- test/filecomp.c | 4 ++-- test/namescomp.c | 2 +- test/rulescomp.c | 2 +- test/state.c | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h index ebb9aa4..31570f2 100644 --- a/include/xkbcommon/xkbcommon.h +++ b/include/xkbcommon/xkbcommon.h @@ -193,13 +193,18 @@ xkb_string_to_keysym(const char *s); * @{ */ +enum xkb_context_flags { + /** Apparently you can't have empty enums. What a drag. */ + XKB_CONTEXT_PLACEHOLDER = 0, +}; + /** * Returns a new XKB context, or NULL on failure. If successful, the caller * holds a reference on the context, and must free it when finished with * xkb_context_unref(). */ struct xkb_context * -xkb_context_new(void); +xkb_context_new(enum xkb_context_flags flags); /** * Appends a new entry to the include path used for keymap compilation. diff --git a/src/context.c b/src/context.c index 1c080d3..39c1326 100644 --- a/src/context.c +++ b/src/context.c @@ -177,7 +177,7 @@ xkb_context_unref(struct xkb_context *context) * Create a new context. */ _X_EXPORT struct xkb_context * -xkb_context_new(void) +xkb_context_new(enum xkb_context_flags flags) { struct xkb_context *context = calloc(1, sizeof(*context)); diff --git a/test/context.c b/test/context.c index 4009eff..016c5ea 100644 --- a/test/context.c +++ b/test/context.c @@ -30,7 +30,7 @@ int main(void) { - struct xkb_context *context = xkb_context_new(); + struct xkb_context *context = xkb_context_new(0); assert(context); diff --git a/test/filecomp.c b/test/filecomp.c index 70dbdc2..d387044 100644 --- a/test/filecomp.c +++ b/test/filecomp.c @@ -46,7 +46,7 @@ test_file(const char *path) fd = open(path, O_RDONLY); assert(fd >= 0); - context = xkb_context_new(); + context = xkb_context_new(0); assert(context); fprintf(stderr, "\nCompiling path: %s\n", path); @@ -81,7 +81,7 @@ test_string(const char *string) struct xkb_context *context; struct xkb_keymap *xkb; - context = xkb_context_new(); + context = xkb_context_new(0); assert(context); fprintf(stderr, "\nCompiling string\n"); diff --git a/test/namescomp.c b/test/namescomp.c index e8652a2..36c89f3 100644 --- a/test/namescomp.c +++ b/test/namescomp.c @@ -46,7 +46,7 @@ test_names(const char *keycodes, const char *types, .symbols = strdup(symbols), }; - context = xkb_context_new(); + context = xkb_context_new(0); assert(context); fprintf(stderr, "\nCompiling %s %s %s %s\n", kccgst.keycodes, kccgst.types, diff --git a/test/rulescomp.c b/test/rulescomp.c index 5ab8112..91b91b4 100644 --- a/test/rulescomp.c +++ b/test/rulescomp.c @@ -43,7 +43,7 @@ test_rmlvo(const char *rules, const char *model, const char *layout, .options = options }; - context = xkb_context_new(); + context = xkb_context_new(0); assert(context); fprintf(stderr, "\nCompiling %s %s %s %s %s\n", rmlvo.rules, rmlvo.model, diff --git a/test/state.c b/test/state.c index d405b3e..1d8d138 100644 --- a/test/state.c +++ b/test/state.c @@ -215,7 +215,7 @@ main(void) .options = NULL, }; - context = xkb_context_new(); + context = xkb_context_new(0); assert(context); xkb = xkb_map_new_from_names(context, &rmlvo, 0);