Rename 'ctx' back to 'context' in external API
Still keep things as 'ctx' internally so we don't have to worry about
typing it too often, but rename the user-visible API back as it was
kinda ugly.
This partially reverts e7bb1e5f
.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
parent
f95b41131d
commit
7b00485a6b
|
@ -118,9 +118,9 @@ struct xkb_rule_names {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opaque context object; may only be created, accessed, manipulated and
|
* Opaque context object; may only be created, accessed, manipulated and
|
||||||
* destroyed through the xkb_ctx_*() API.
|
* destroyed through the xkb_context_*() API.
|
||||||
*/
|
*/
|
||||||
struct xkb_ctx;
|
struct xkb_context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opaque keymap object; may only be created, accessed, manipulated and
|
* Opaque keymap object; may only be created, accessed, manipulated and
|
||||||
|
@ -153,14 +153,14 @@ xkb_keysym_t
|
||||||
xkb_keysym_from_name(const char *s);
|
xkb_keysym_from_name(const char *s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup ctx XKB contexts
|
* @defgroup context XKB contexts
|
||||||
* Every keymap compilation request must have an XKB context associated with
|
* Every keymap compilation request must have an XKB context associated with
|
||||||
* it. The context keeps around state such as the include path.
|
* it. The context keeps around state such as the include path.
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum xkb_ctx_flags {
|
enum xkb_context_flags {
|
||||||
/** Create this context with an empty include path. */
|
/** Create this context with an empty include path. */
|
||||||
XKB_CONTEXT_NO_DEFAULT_INCLUDES = 1,
|
XKB_CONTEXT_NO_DEFAULT_INCLUDES = 1,
|
||||||
};
|
};
|
||||||
|
@ -168,10 +168,10 @@ enum xkb_ctx_flags {
|
||||||
/**
|
/**
|
||||||
* Returns a new XKB context, or NULL on failure. If successful, the caller
|
* 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
|
* holds a reference on the context, and must free it when finished with
|
||||||
* xkb_ctx_unref().
|
* xkb_context_unref().
|
||||||
*/
|
*/
|
||||||
struct xkb_ctx *
|
struct xkb_context *
|
||||||
xkb_ctx_new(enum xkb_ctx_flags flags);
|
xkb_context_new(enum xkb_context_flags flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends a new entry to the include path used for keymap compilation.
|
* Appends a new entry to the include path used for keymap compilation.
|
||||||
|
@ -179,7 +179,7 @@ xkb_ctx_new(enum xkb_ctx_flags flags);
|
||||||
* inaccessible.
|
* inaccessible.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path);
|
xkb_context_include_path_append(struct xkb_context *context, const char *path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends the default include paths to the context's current include path.
|
* Appends the default include paths to the context's current include path.
|
||||||
|
@ -187,7 +187,7 @@ xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path);
|
||||||
* added.
|
* added.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xkb_ctx_include_path_append_default(struct xkb_ctx *ctx);
|
xkb_context_include_path_append_default(struct xkb_context *context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all entries from the context's include path, and inserts the
|
* Removes all entries from the context's include path, and inserts the
|
||||||
|
@ -195,37 +195,37 @@ xkb_ctx_include_path_append_default(struct xkb_ctx *ctx);
|
||||||
* could not be added.
|
* could not be added.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xkb_ctx_include_path_reset_defaults(struct xkb_ctx *ctx);
|
xkb_context_include_path_reset_defaults(struct xkb_context *context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all entries from the context's include path.
|
* Removes all entries from the context's include path.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xkb_ctx_include_path_clear(struct xkb_ctx *ctx);
|
xkb_context_include_path_clear(struct xkb_context *context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of include paths currently active in the context.
|
* Returns the number of include paths currently active in the context.
|
||||||
*/
|
*/
|
||||||
unsigned int
|
unsigned int
|
||||||
xkb_ctx_num_include_paths(struct xkb_ctx *ctx);
|
xkb_context_num_include_paths(struct xkb_context *context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the include path at the specified index within the context.
|
* Returns the include path at the specified index within the context.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
xkb_ctx_include_path_get(struct xkb_ctx *ctx, unsigned int index);
|
xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a new reference on an XKB context.
|
* Takes a new reference on an XKB context.
|
||||||
*/
|
*/
|
||||||
struct xkb_ctx *
|
struct xkb_context *
|
||||||
xkb_ctx_ref(struct xkb_ctx *ctx);
|
xkb_context_ref(struct xkb_context *context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases a reference on an XKB context, and possibly frees it.
|
* Releases a reference on an XKB context, and possibly frees it.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xkb_ctx_unref(struct xkb_ctx *ctx);
|
xkb_context_unref(struct xkb_context *context);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ enum xkb_map_compile_flags {
|
||||||
* keymaps.
|
* keymaps.
|
||||||
*/
|
*/
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
xkb_map_new_from_names(struct xkb_ctx *ctx,
|
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);
|
enum xkb_map_compile_flags flags);
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ enum xkb_keymap_format {
|
||||||
* file descriptor.
|
* file descriptor.
|
||||||
*/
|
*/
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
xkb_map_new_from_fd(struct xkb_ctx *ctx,
|
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);
|
enum xkb_map_compile_flags flags);
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ xkb_map_new_from_fd(struct xkb_ctx *ctx,
|
||||||
* enormous string.
|
* enormous string.
|
||||||
*/
|
*/
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
xkb_map_new_from_string(struct xkb_ctx *ctx,
|
xkb_map_new_from_string(struct xkb_context *context,
|
||||||
const char *string,
|
const char *string,
|
||||||
enum xkb_keymap_format format,
|
enum xkb_keymap_format format,
|
||||||
enum xkb_map_compile_flags flags);
|
enum xkb_map_compile_flags flags);
|
||||||
|
|
|
@ -582,7 +582,7 @@ XkbcFreeIndicatorMaps(struct xkb_keymap *keymap)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
XkbcAllocKeyboard(struct xkb_ctx *ctx)
|
XkbcAllocKeyboard(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ XkbcAllocKeyboard(struct xkb_ctx *ctx)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
keymap->refcnt = 1;
|
keymap->refcnt = 1;
|
||||||
keymap->ctx = xkb_ctx_ref(ctx);
|
keymap->ctx = xkb_context_ref(ctx);
|
||||||
|
|
||||||
return keymap;
|
return keymap;
|
||||||
}
|
}
|
||||||
|
@ -608,6 +608,6 @@ XkbcFreeKeyboard(struct xkb_keymap *keymap)
|
||||||
XkbcFreeIndicatorMaps(keymap);
|
XkbcFreeIndicatorMaps(keymap);
|
||||||
XkbcFreeNames(keymap);
|
XkbcFreeNames(keymap);
|
||||||
XkbcFreeControls(keymap);
|
XkbcFreeControls(keymap);
|
||||||
xkb_ctx_unref(keymap->ctx);
|
xkb_context_unref(keymap->ctx);
|
||||||
free(keymap);
|
free(keymap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern int
|
||||||
XkbcAllocIndicatorMaps(struct xkb_keymap *keymap);
|
XkbcAllocIndicatorMaps(struct xkb_keymap *keymap);
|
||||||
|
|
||||||
extern struct xkb_keymap *
|
extern struct xkb_keymap *
|
||||||
XkbcAllocKeyboard(struct xkb_ctx *ctx);
|
XkbcAllocKeyboard(struct xkb_context *ctx);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
XkbcFreeKeyboard(struct xkb_keymap *keymap);
|
XkbcFreeKeyboard(struct xkb_keymap *keymap);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "xkb-priv.h"
|
#include "xkb-priv.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
|
||||||
struct xkb_ctx {
|
struct xkb_context {
|
||||||
int refcnt;
|
int refcnt;
|
||||||
|
|
||||||
char **include_paths;
|
char **include_paths;
|
||||||
|
@ -48,7 +48,7 @@ struct xkb_ctx {
|
||||||
* Append one directory to the context's include path.
|
* Append one directory to the context's include path.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path)
|
xkb_context_include_path_append(struct xkb_context *ctx, const char *path)
|
||||||
{
|
{
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
int err;
|
int err;
|
||||||
|
@ -87,13 +87,13 @@ xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path)
|
||||||
* Append the default include directories to the context.
|
* Append the default include directories to the context.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
xkb_ctx_include_path_append_default(struct xkb_ctx *ctx)
|
xkb_context_include_path_append_default(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
char *user_path;
|
char *user_path;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
(void) xkb_ctx_include_path_append(ctx, DFLT_XKB_CONFIG_ROOT);
|
(void) xkb_context_include_path_append(ctx, DFLT_XKB_CONFIG_ROOT);
|
||||||
|
|
||||||
home = getenv("HOME");
|
home = getenv("HOME");
|
||||||
if (!home)
|
if (!home)
|
||||||
|
@ -101,7 +101,7 @@ xkb_ctx_include_path_append_default(struct xkb_ctx *ctx)
|
||||||
err = asprintf(&user_path, "%s/.xkb", home);
|
err = asprintf(&user_path, "%s/.xkb", home);
|
||||||
if (err <= 0)
|
if (err <= 0)
|
||||||
return 1;
|
return 1;
|
||||||
(void) xkb_ctx_include_path_append(ctx, user_path);
|
(void) xkb_context_include_path_append(ctx, user_path);
|
||||||
free(user_path);
|
free(user_path);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -111,7 +111,7 @@ xkb_ctx_include_path_append_default(struct xkb_ctx *ctx)
|
||||||
* Remove all entries in the context's include path.
|
* Remove all entries in the context's include path.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
xkb_ctx_include_path_clear(struct xkb_ctx *ctx)
|
xkb_context_include_path_clear(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -125,20 +125,20 @@ xkb_ctx_include_path_clear(struct xkb_ctx *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xkb_ctx_include_path_clear() + xkb_ctx_include_path_append_default()
|
* xkb_context_include_path_clear() + xkb_context_include_path_append_default()
|
||||||
*/
|
*/
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
xkb_ctx_include_path_reset_defaults(struct xkb_ctx *ctx)
|
xkb_context_include_path_reset_defaults(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
xkb_ctx_include_path_clear(ctx);
|
xkb_context_include_path_clear(ctx);
|
||||||
return xkb_ctx_include_path_append_default(ctx);
|
return xkb_context_include_path_append_default(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of entries in the context's include path.
|
* Returns the number of entries in the context's include path.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT unsigned int
|
_X_EXPORT unsigned int
|
||||||
xkb_ctx_num_include_paths(struct xkb_ctx *ctx)
|
xkb_context_num_include_paths(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
return ctx->num_include_paths;
|
return ctx->num_include_paths;
|
||||||
}
|
}
|
||||||
|
@ -148,16 +148,16 @@ xkb_ctx_num_include_paths(struct xkb_ctx *ctx)
|
||||||
* invalid index is passed.
|
* invalid index is passed.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT const char *
|
_X_EXPORT const char *
|
||||||
xkb_ctx_include_path_get(struct xkb_ctx *ctx, unsigned int idx)
|
xkb_context_include_path_get(struct xkb_context *ctx, unsigned int idx)
|
||||||
{
|
{
|
||||||
if (idx >= xkb_ctx_num_include_paths(ctx))
|
if (idx >= xkb_context_num_include_paths(ctx))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ctx->include_paths[idx];
|
return ctx->include_paths[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xkb_ctx_take_file_id(struct xkb_ctx *ctx)
|
xkb_context_take_file_id(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
return ctx->file_id++;
|
return ctx->file_id++;
|
||||||
}
|
}
|
||||||
|
@ -165,8 +165,8 @@ xkb_ctx_take_file_id(struct xkb_ctx *ctx)
|
||||||
/**
|
/**
|
||||||
* Take a new reference on the context.
|
* Take a new reference on the context.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT struct xkb_ctx *
|
_X_EXPORT struct xkb_context *
|
||||||
xkb_ctx_ref(struct xkb_ctx *ctx)
|
xkb_context_ref(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
ctx->refcnt++;
|
ctx->refcnt++;
|
||||||
return ctx;
|
return ctx;
|
||||||
|
@ -177,12 +177,12 @@ xkb_ctx_ref(struct xkb_ctx *ctx)
|
||||||
* now 0.
|
* now 0.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
xkb_ctx_unref(struct xkb_ctx *ctx)
|
xkb_context_unref(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
if (--ctx->refcnt > 0)
|
if (--ctx->refcnt > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xkb_ctx_include_path_clear(ctx);
|
xkb_context_include_path_clear(ctx);
|
||||||
atom_table_free(ctx->atom_table);
|
atom_table_free(ctx->atom_table);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
@ -190,10 +190,10 @@ xkb_ctx_unref(struct xkb_ctx *ctx)
|
||||||
/**
|
/**
|
||||||
* Create a new context.
|
* Create a new context.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT struct xkb_ctx *
|
_X_EXPORT struct xkb_context *
|
||||||
xkb_ctx_new(enum xkb_ctx_flags flags)
|
xkb_context_new(enum xkb_context_flags flags)
|
||||||
{
|
{
|
||||||
struct xkb_ctx *ctx = calloc(1, sizeof(*ctx));
|
struct xkb_context *ctx = calloc(1, sizeof(*ctx));
|
||||||
|
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -201,14 +201,14 @@ xkb_ctx_new(enum xkb_ctx_flags flags)
|
||||||
ctx->refcnt = 1;
|
ctx->refcnt = 1;
|
||||||
|
|
||||||
if (!(flags & XKB_CONTEXT_NO_DEFAULT_INCLUDES) &&
|
if (!(flags & XKB_CONTEXT_NO_DEFAULT_INCLUDES) &&
|
||||||
!xkb_ctx_include_path_append_default(ctx)) {
|
!xkb_context_include_path_append_default(ctx)) {
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(ctx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->atom_table = atom_table_new();
|
ctx->atom_table = atom_table_new();
|
||||||
if (!ctx->atom_table) {
|
if (!ctx->atom_table) {
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(ctx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,19 +216,19 @@ xkb_ctx_new(enum xkb_ctx_flags flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
xkb_atom_t
|
xkb_atom_t
|
||||||
xkb_atom_intern(struct xkb_ctx *ctx, const char *string)
|
xkb_atom_intern(struct xkb_context *ctx, const char *string)
|
||||||
{
|
{
|
||||||
return atom_intern(ctx->atom_table, string);
|
return atom_intern(ctx->atom_table, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xkb_atom_strdup(struct xkb_ctx *ctx, xkb_atom_t atom)
|
xkb_atom_strdup(struct xkb_context *ctx, xkb_atom_t atom)
|
||||||
{
|
{
|
||||||
return atom_strdup(ctx->atom_table, atom);
|
return atom_strdup(ctx->atom_table, atom);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
xkb_atom_text(struct xkb_ctx *ctx, xkb_atom_t atom)
|
xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom)
|
||||||
{
|
{
|
||||||
return atom_text(ctx->atom_table, atom);
|
return atom_text(ctx->atom_table, atom);
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ struct xkb_controls {
|
||||||
|
|
||||||
/* Common keyboard description structure */
|
/* Common keyboard description structure */
|
||||||
struct xkb_keymap {
|
struct xkb_keymap {
|
||||||
struct xkb_ctx *ctx;
|
struct xkb_context *ctx;
|
||||||
|
|
||||||
unsigned int refcnt;
|
unsigned int refcnt;
|
||||||
unsigned short flags;
|
unsigned short flags;
|
||||||
|
@ -434,13 +434,13 @@ typedef uint32_t xkb_atom_t;
|
||||||
#define XKB_ATOM_NONE 0
|
#define XKB_ATOM_NONE 0
|
||||||
|
|
||||||
xkb_atom_t
|
xkb_atom_t
|
||||||
xkb_atom_intern(struct xkb_ctx *ctx, const char *string);
|
xkb_atom_intern(struct xkb_context *ctx, const char *string);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xkb_atom_strdup(struct xkb_ctx *ctx, xkb_atom_t atom);
|
xkb_atom_strdup(struct xkb_context *ctx, xkb_atom_t atom);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
xkb_atom_text(struct xkb_ctx *ctx, xkb_atom_t atom);
|
xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom);
|
||||||
|
|
||||||
extern unsigned int
|
extern unsigned int
|
||||||
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key);
|
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key);
|
||||||
|
@ -483,12 +483,12 @@ xkb_canonicalise_components(struct xkb_component_names *names,
|
||||||
* Geometry will be ignored since xkbcommon does not support it in any way.
|
* Geometry will be ignored since xkbcommon does not support it in any way.
|
||||||
*/
|
*/
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
xkb_map_new_from_kccgst(struct xkb_ctx *ctx,
|
xkb_map_new_from_kccgst(struct xkb_context *ctx,
|
||||||
const struct xkb_component_names *kccgst,
|
const struct xkb_component_names *kccgst,
|
||||||
enum xkb_map_compile_flags flags);
|
enum xkb_map_compile_flags flags);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
xkb_ctx_take_file_id(struct xkb_ctx *ctx);
|
xkb_context_take_file_id(struct xkb_context *ctx);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
XkbcComputeEffectiveMap(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
XkbcComputeEffectiveMap(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
||||||
|
|
|
@ -1085,7 +1085,7 @@ ApplyActionFactoryDefaults(union xkb_action * action)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ActionsInit(struct xkb_ctx *ctx);
|
ActionsInit(struct xkb_context *ctx);
|
||||||
|
|
||||||
int
|
int
|
||||||
HandleActionDef(ExprDef * def,
|
HandleActionDef(ExprDef * def,
|
||||||
|
@ -1249,7 +1249,7 @@ SetActionField(struct xkb_keymap *keymap,
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ActionsInit(struct xkb_ctx *ctx)
|
ActionsInit(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
if (!actionsInitialized)
|
if (!actionsInitialized)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
typedef bool (*IdentLookupFunc) (struct xkb_ctx *ctx, const void *priv,
|
typedef bool (*IdentLookupFunc) (struct xkb_context *ctx, const void *priv,
|
||||||
xkb_atom_t field, unsigned type,
|
xkb_atom_t field, unsigned type,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
SimpleLookup(struct xkb_ctx *ctx, const void *priv,
|
SimpleLookup(struct xkb_context *ctx, const void *priv,
|
||||||
xkb_atom_t field, unsigned type, ExprResult *val_rtrn)
|
xkb_atom_t field, unsigned type, ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
const LookupEntry *entry;
|
const LookupEntry *entry;
|
||||||
|
@ -197,14 +197,14 @@ static const LookupEntry modIndexNames[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LookupModIndex(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn)
|
unsigned type, ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
return SimpleLookup(ctx, modIndexNames, field, type, val_rtrn);
|
return SimpleLookup(ctx, modIndexNames, field, type, val_rtrn);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LookupModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn)
|
unsigned type, ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
@ -227,7 +227,7 @@ LookupModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveBoolean(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
|
@ -309,7 +309,7 @@ ExprResolveBoolean(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveFloat(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
|
@ -404,7 +404,7 @@ ExprResolveFloat(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveKeyCode(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
ExprResult leftRtrn, rightRtrn;
|
ExprResult leftRtrn, rightRtrn;
|
||||||
|
@ -482,7 +482,7 @@ ExprResolveKeyCode(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
* Cool.
|
* Cool.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ExprResolveIntegerLookup(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn, IdentLookupFunc lookup,
|
ExprResult *val_rtrn, IdentLookupFunc lookup,
|
||||||
const void *lookupPriv)
|
const void *lookupPriv)
|
||||||
{
|
{
|
||||||
|
@ -590,14 +590,14 @@ ExprResolveIntegerLookup(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveInteger(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveInteger(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
return ExprResolveIntegerLookup(ctx, expr, val_rtrn, NULL, NULL);
|
return ExprResolveIntegerLookup(ctx, expr, val_rtrn, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveGroup(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -628,7 +628,7 @@ ExprResolveGroup(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveLevel(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -659,7 +659,7 @@ ExprResolveLevel(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveButton(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
static const LookupEntry button_names[] = {
|
static const LookupEntry button_names[] = {
|
||||||
|
@ -677,7 +677,7 @@ ExprResolveButton(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveString(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
ExprResult leftRtrn, rightRtrn;
|
ExprResult leftRtrn, rightRtrn;
|
||||||
|
@ -762,7 +762,7 @@ ExprResolveString(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveKeyName(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
const char *bogus = NULL;
|
const char *bogus = NULL;
|
||||||
|
@ -826,7 +826,7 @@ ExprResolveKeyName(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveEnum(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn, const LookupEntry *values)
|
ExprResult *val_rtrn, const LookupEntry *values)
|
||||||
{
|
{
|
||||||
if (expr->op != ExprIdent)
|
if (expr->op != ExprIdent)
|
||||||
|
@ -856,7 +856,7 @@ ExprResolveEnum(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ExprResolveMaskLookup(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn, IdentLookupFunc lookup,
|
ExprResult *val_rtrn, IdentLookupFunc lookup,
|
||||||
const void *lookupPriv)
|
const void *lookupPriv)
|
||||||
{
|
{
|
||||||
|
@ -954,14 +954,14 @@ ExprResolveMaskLookup(struct xkb_ctx *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveMask(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn, const LookupEntry *values)
|
ExprResult *val_rtrn, const LookupEntry *values)
|
||||||
{
|
{
|
||||||
return ExprResolveMaskLookup(ctx, expr, val_rtrn, SimpleLookup, values);
|
return ExprResolveMaskLookup(ctx, expr, val_rtrn, SimpleLookup, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveModMask(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
return ExprResolveMaskLookup(ctx, expr, val_rtrn, LookupModMask, NULL);
|
return ExprResolveMaskLookup(ctx, expr, val_rtrn, LookupModMask, NULL);
|
||||||
|
@ -976,7 +976,7 @@ ExprResolveVModMask(ExprDef *expr, ExprResult *val_rtrn,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ExprResolveKeySym(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn)
|
ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
|
|
|
@ -53,19 +53,19 @@ extern const char *
|
||||||
exprOpText(unsigned type);
|
exprOpText(unsigned type);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
LookupModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn);
|
unsigned type, ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
LookupVModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn);
|
unsigned type, ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
LookupModIndex(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn);
|
unsigned type, ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveModMask(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
|
@ -73,51 +73,51 @@ ExprResolveVModMask(ExprDef *expr, ExprResult *val_rtrn,
|
||||||
struct xkb_keymap *keymap);
|
struct xkb_keymap *keymap);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveBoolean(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveKeyCode(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveInteger(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveInteger(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveLevel(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveGroup(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveButton(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveFloat(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveString(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveKeyName(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveEnum(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn, const LookupEntry *values);
|
ExprResult *val_rtrn, const LookupEntry *values);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveMask(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn, const LookupEntry *values);
|
ExprResult *val_rtrn, const LookupEntry *values);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveKeySym(struct xkb_ctx *ctx, ExprDef *expr,
|
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
#endif /* EXPR_H */
|
#endif /* EXPR_H */
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
void
|
void
|
||||||
ClearIndicatorMapInfo(struct xkb_ctx *ctx, LEDInfo * info)
|
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo * info)
|
||||||
{
|
{
|
||||||
info->name = xkb_atom_intern(ctx, "default");
|
info->name = xkb_atom_intern(ctx, "default");
|
||||||
info->indicator = _LED_NotBound;
|
info->indicator = _LED_NotBound;
|
||||||
|
|
|
@ -54,7 +54,7 @@ typedef struct _LEDInfo
|
||||||
} LEDInfo;
|
} LEDInfo;
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
ClearIndicatorMapInfo(struct xkb_ctx *ctx, LEDInfo *info);
|
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo *info);
|
||||||
|
|
||||||
|
|
||||||
extern LEDInfo *
|
extern LEDInfo *
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
* XkmKeyNamesIdx, etc.)
|
* XkmKeyNamesIdx, etc.)
|
||||||
*/
|
*/
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
CompileKeymap(struct xkb_ctx *ctx, XkbFile *file)
|
CompileKeymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
{
|
{
|
||||||
unsigned have;
|
unsigned have;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
* @return true on success or false otherwise.
|
* @return true on success or false otherwise.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ProcessIncludeFile(struct xkb_ctx *ctx,
|
ProcessIncludeFile(struct xkb_context *ctx,
|
||||||
IncludeStmt * stmt,
|
IncludeStmt * stmt,
|
||||||
unsigned file_type,
|
unsigned file_type,
|
||||||
XkbFile ** file_rtrn, unsigned *merge_rtrn)
|
XkbFile ** file_rtrn, unsigned *merge_rtrn)
|
||||||
|
|
|
@ -682,7 +682,7 @@ EnsureSafeMapName(char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
XkbFile *
|
XkbFile *
|
||||||
CreateXKBFile(struct xkb_ctx *ctx, int type, char *name,
|
CreateXKBFile(struct xkb_context *ctx, int type, char *name,
|
||||||
ParseCommon *defs, unsigned flags)
|
ParseCommon *defs, unsigned flags)
|
||||||
{
|
{
|
||||||
XkbFile *file;
|
XkbFile *file;
|
||||||
|
@ -696,7 +696,7 @@ CreateXKBFile(struct xkb_ctx *ctx, int type, char *name,
|
||||||
file->topName = uDupString(name);
|
file->topName = uDupString(name);
|
||||||
file->name = name;
|
file->name = name;
|
||||||
file->defs = defs;
|
file->defs = defs;
|
||||||
file->id = xkb_ctx_take_file_id(ctx);
|
file->id = xkb_context_take_file_id(ctx);
|
||||||
file->flags = flags;
|
file->flags = flags;
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
struct parser_param {
|
struct parser_param {
|
||||||
struct xkb_ctx *ctx;
|
struct xkb_context *ctx;
|
||||||
void *scanner;
|
void *scanner;
|
||||||
XkbFile *rtrn;
|
XkbFile *rtrn;
|
||||||
};
|
};
|
||||||
|
@ -120,15 +120,15 @@ extern void
|
||||||
CheckDefaultMap(XkbFile *maps, const char *fileName);
|
CheckDefaultMap(XkbFile *maps, const char *fileName);
|
||||||
|
|
||||||
extern XkbFile *
|
extern XkbFile *
|
||||||
CreateXKBFile(struct xkb_ctx *ctx, int type, char *name,
|
CreateXKBFile(struct xkb_context *ctx, int type, char *name,
|
||||||
ParseCommon *defs, unsigned flags);
|
ParseCommon *defs, unsigned flags);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
XKBParseFile(struct xkb_ctx *ctx, FILE *file,
|
XKBParseFile(struct xkb_context *ctx, FILE *file,
|
||||||
const char *file_name, XkbFile **out);
|
const char *file_name, XkbFile **out);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
XKBParseString(struct xkb_ctx *context, const char *string,
|
XKBParseString(struct xkb_context *context, const char *string,
|
||||||
const char *file_name, XkbFile **out);
|
const char *file_name, XkbFile **out);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
|
|
|
@ -179,7 +179,7 @@ XkbDirectoryForInclude(unsigned type)
|
||||||
* pathRtrn is undefined.
|
* pathRtrn is undefined.
|
||||||
*/
|
*/
|
||||||
FILE *
|
FILE *
|
||||||
XkbFindFileInPath(struct xkb_ctx *ctx,
|
XkbFindFileInPath(struct xkb_context *ctx,
|
||||||
const char *name, unsigned type, char **pathRtrn)
|
const char *name, unsigned type, char **pathRtrn)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -189,21 +189,21 @@ XkbFindFileInPath(struct xkb_ctx *ctx,
|
||||||
const char *typeDir;
|
const char *typeDir;
|
||||||
|
|
||||||
typeDir = XkbDirectoryForInclude(type);
|
typeDir = XkbDirectoryForInclude(type);
|
||||||
for (i = 0; i < xkb_ctx_num_include_paths(ctx); i++)
|
for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
|
||||||
{
|
{
|
||||||
ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
|
ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
|
||||||
xkb_ctx_include_path_get(ctx, i), typeDir, name);
|
xkb_context_include_path_get(ctx, i), typeDir, name);
|
||||||
if (ret >= (ssize_t)sizeof(buf))
|
if (ret >= (ssize_t)sizeof(buf))
|
||||||
{
|
{
|
||||||
ERROR("File name (%s/%s/%s) too long\n",
|
ERROR("File name (%s/%s/%s) too long\n",
|
||||||
xkb_ctx_include_path_get(ctx, i), typeDir, name);
|
xkb_context_include_path_get(ctx, i), typeDir, name);
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
file = fopen(buf, "r");
|
file = fopen(buf, "r");
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
ERROR("Couldn't open file (%s/%s/%s): %s\n",
|
ERROR("Couldn't open file (%s/%s/%s): %s\n",
|
||||||
xkb_ctx_include_path_get(ctx, i), typeDir, name,
|
xkb_context_include_path_get(ctx, i), typeDir, name,
|
||||||
strerror(-errno));
|
strerror(-errno));
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -205,7 +205,7 @@ yyerror(struct YYLTYPE *loc, void *scanner, const char *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XKBParseString(struct xkb_ctx *ctx, const char *string,
|
XKBParseString(struct xkb_context *ctx, const char *string,
|
||||||
const char *file_name, XkbFile **out)
|
const char *file_name, XkbFile **out)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -241,7 +241,7 @@ XKBParseString(struct xkb_ctx *ctx, const char *string,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XKBParseFile(struct xkb_ctx *ctx, FILE *file,
|
XKBParseFile(struct xkb_context *ctx, FILE *file,
|
||||||
const char *file_name, XkbFile **out)
|
const char *file_name, XkbFile **out)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -190,7 +190,7 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
|
||||||
* undefined.
|
* undefined.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
LookupVModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn)
|
unsigned type, ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
if (LookupModMask(ctx, NULL, field, type, val_rtrn))
|
if (LookupModMask(ctx, NULL, field, type, val_rtrn))
|
||||||
|
|
|
@ -64,7 +64,7 @@ extern int
|
||||||
ReportBadField(const char *type, const char *field, const char *name);
|
ReportBadField(const char *type, const char *field, const char *name);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
ProcessIncludeFile(struct xkb_ctx *ctx,
|
ProcessIncludeFile(struct xkb_context *ctx,
|
||||||
IncludeStmt *stmt, unsigned file_type, XkbFile **file_rtrn,
|
IncludeStmt *stmt, unsigned file_type, XkbFile **file_rtrn,
|
||||||
unsigned *merge_rtrn);
|
unsigned *merge_rtrn);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ extern const char *
|
||||||
XkbDirectoryForInclude(unsigned type);
|
XkbDirectoryForInclude(unsigned type);
|
||||||
|
|
||||||
extern FILE *
|
extern FILE *
|
||||||
XkbFindFileInPath(struct xkb_ctx *ctx, const char *name,
|
XkbFindFileInPath(struct xkb_context *ctx, const char *name,
|
||||||
unsigned type, char **pathRtrn);
|
unsigned type, char **pathRtrn);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
|
|
|
@ -34,7 +34,7 @@ unsigned int warningLevel = 0;
|
||||||
#define ISEMPTY(str) (!(str) || (strlen(str) == 0))
|
#define ISEMPTY(str) (!(str) || (strlen(str) == 0))
|
||||||
|
|
||||||
static XkbFile *
|
static XkbFile *
|
||||||
XkbKeymapFileFromComponents(struct xkb_ctx *ctx,
|
XkbKeymapFileFromComponents(struct xkb_context *ctx,
|
||||||
const struct xkb_component_names *ktcsg)
|
const struct xkb_component_names *ktcsg)
|
||||||
{
|
{
|
||||||
XkbFile *keycodes, *types, *compat, *symbols;
|
XkbFile *keycodes, *types, *compat, *symbols;
|
||||||
|
@ -65,7 +65,7 @@ XkbKeymapFileFromComponents(struct xkb_ctx *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xkb_component_names *
|
static struct xkb_component_names *
|
||||||
XkbComponentsFromRules(struct xkb_ctx *ctx,
|
XkbComponentsFromRules(struct xkb_context *ctx,
|
||||||
const char *rules,
|
const char *rules,
|
||||||
const XkbRF_VarDefsPtr defs)
|
const XkbRF_VarDefsPtr defs)
|
||||||
{
|
{
|
||||||
|
@ -79,9 +79,9 @@ XkbComponentsFromRules(struct xkb_ctx *ctx,
|
||||||
if (!rulesFile) {
|
if (!rulesFile) {
|
||||||
ERROR("could not find \"%s\" rules in XKB path\n", rules);
|
ERROR("could not find \"%s\" rules in XKB path\n", rules);
|
||||||
ERROR("%d include paths searched:\n",
|
ERROR("%d include paths searched:\n",
|
||||||
xkb_ctx_num_include_paths(ctx));
|
xkb_context_num_include_paths(ctx));
|
||||||
for (i = 0; i < xkb_ctx_num_include_paths(ctx); i++)
|
for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
|
||||||
ERROR("\t%s\n", xkb_ctx_include_path_get(ctx, i));
|
ERROR("\t%s\n", xkb_context_include_path_get(ctx, i));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ unwind_file:
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT struct xkb_keymap *
|
_X_EXPORT struct xkb_keymap *
|
||||||
xkb_map_new_from_names(struct xkb_ctx *ctx,
|
xkb_map_new_from_names(struct xkb_context *ctx,
|
||||||
const struct xkb_rule_names *rmlvo,
|
const struct xkb_rule_names *rmlvo,
|
||||||
enum xkb_map_compile_flags flags)
|
enum xkb_map_compile_flags flags)
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,7 @@ XkbChooseMap(XkbFile *file, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xkb_keymap *
|
static struct xkb_keymap *
|
||||||
compile_keymap(struct xkb_ctx *ctx, XkbFile *file)
|
compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
{
|
{
|
||||||
XkbFile *mapToUse;
|
XkbFile *mapToUse;
|
||||||
struct xkb_keymap *keymap = NULL;
|
struct xkb_keymap *keymap = NULL;
|
||||||
|
@ -214,7 +214,7 @@ err:
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT struct xkb_keymap *
|
_X_EXPORT struct xkb_keymap *
|
||||||
xkb_map_new_from_kccgst(struct xkb_ctx *ctx,
|
xkb_map_new_from_kccgst(struct xkb_context *ctx,
|
||||||
const struct xkb_component_names *kccgst,
|
const struct xkb_component_names *kccgst,
|
||||||
enum xkb_map_compile_flags flags)
|
enum xkb_map_compile_flags flags)
|
||||||
{
|
{
|
||||||
|
@ -254,7 +254,7 @@ xkb_map_new_from_kccgst(struct xkb_ctx *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT struct xkb_keymap *
|
_X_EXPORT struct xkb_keymap *
|
||||||
xkb_map_new_from_string(struct xkb_ctx *ctx,
|
xkb_map_new_from_string(struct xkb_context *ctx,
|
||||||
const char *string,
|
const char *string,
|
||||||
enum xkb_keymap_format format,
|
enum xkb_keymap_format format,
|
||||||
enum xkb_map_compile_flags flags)
|
enum xkb_map_compile_flags flags)
|
||||||
|
@ -280,7 +280,7 @@ xkb_map_new_from_string(struct xkb_ctx *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT struct xkb_keymap *
|
_X_EXPORT struct xkb_keymap *
|
||||||
xkb_map_new_from_fd(struct xkb_ctx *ctx,
|
xkb_map_new_from_fd(struct xkb_context *ctx,
|
||||||
int fd,
|
int fd,
|
||||||
enum xkb_keymap_format format,
|
enum xkb_keymap_format format,
|
||||||
enum xkb_map_compile_flags flags)
|
enum xkb_map_compile_flags flags)
|
||||||
|
|
|
@ -250,7 +250,7 @@ typedef struct _XkbFile
|
||||||
} XkbFile;
|
} XkbFile;
|
||||||
|
|
||||||
extern struct xkb_keymap *
|
extern struct xkb_keymap *
|
||||||
CompileKeymap(struct xkb_ctx *ctx, XkbFile *file);
|
CompileKeymap(struct xkb_context *ctx, XkbFile *file);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
|
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
|
||||||
|
|
|
@ -30,13 +30,13 @@
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
struct xkb_ctx *ctx = xkb_ctx_new(0);
|
struct xkb_context *context = xkb_context_new(0);
|
||||||
|
|
||||||
assert(ctx);
|
assert(context);
|
||||||
|
|
||||||
/* FIXME: Test include path stuff. */
|
/* FIXME: Test include path stuff. */
|
||||||
|
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,28 +40,28 @@ static int
|
||||||
test_file(const char *path)
|
test_file(const char *path)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct xkb_ctx *ctx;
|
struct xkb_context *context;
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
|
|
||||||
ctx = xkb_ctx_new(0);
|
context = xkb_context_new(0);
|
||||||
assert(ctx);
|
assert(context);
|
||||||
|
|
||||||
fprintf(stderr, "\nCompiling path: %s\n", path);
|
fprintf(stderr, "\nCompiling path: %s\n", path);
|
||||||
|
|
||||||
keymap = xkb_map_new_from_fd(ctx, fd, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
keymap = xkb_map_new_from_fd(context, fd, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (!keymap) {
|
if (!keymap) {
|
||||||
fprintf(stderr, "Failed to compile keymap\n");
|
fprintf(stderr, "Failed to compile keymap\n");
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xkb_map_unref(keymap);
|
xkb_map_unref(keymap);
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,22 +78,22 @@ test_file_name(const char *file_name)
|
||||||
static int
|
static int
|
||||||
test_string(const char *string)
|
test_string(const char *string)
|
||||||
{
|
{
|
||||||
struct xkb_ctx *ctx;
|
struct xkb_context *context;
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
|
||||||
ctx = xkb_ctx_new(0);
|
context = xkb_context_new(0);
|
||||||
assert(ctx);
|
assert(context);
|
||||||
|
|
||||||
fprintf(stderr, "\nCompiling string\n");
|
fprintf(stderr, "\nCompiling string\n");
|
||||||
|
|
||||||
keymap = xkb_map_new_from_string(ctx, string, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
keymap = xkb_map_new_from_string(context, string, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||||
if (!keymap) {
|
if (!keymap) {
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xkb_map_unref(keymap);
|
xkb_map_unref(keymap);
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ test_names(const char *keycodes, const char *types,
|
||||||
const char *compat, const char *symbols)
|
const char *compat, const char *symbols)
|
||||||
{
|
{
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
struct xkb_ctx *ctx;
|
struct xkb_context *context;
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
struct xkb_component_names kccgst = {
|
struct xkb_component_names kccgst = {
|
||||||
.keymap = NULL,
|
.keymap = NULL,
|
||||||
|
@ -47,21 +47,21 @@ test_names(const char *keycodes, const char *types,
|
||||||
.symbols = strdup(symbols),
|
.symbols = strdup(symbols),
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx = xkb_ctx_new(0);
|
context = xkb_context_new(0);
|
||||||
assert(ctx);
|
assert(context);
|
||||||
|
|
||||||
fprintf(stderr, "\nCompiling %s %s %s %s\n", kccgst.keycodes, kccgst.types,
|
fprintf(stderr, "\nCompiling %s %s %s %s\n", kccgst.keycodes, kccgst.types,
|
||||||
kccgst.compat, kccgst.symbols);
|
kccgst.compat, kccgst.symbols);
|
||||||
|
|
||||||
keymap = xkb_map_new_from_kccgst(ctx, &kccgst, 0);
|
keymap = xkb_map_new_from_kccgst(context, &kccgst, 0);
|
||||||
if (!keymap) {
|
if (!keymap) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto err_ctx;
|
goto err_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
xkb_map_unref(keymap);
|
xkb_map_unref(keymap);
|
||||||
err_ctx:
|
err_context:
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
free(kccgst.keycodes);
|
free(kccgst.keycodes);
|
||||||
free(kccgst.types);
|
free(kccgst.types);
|
||||||
free(kccgst.compat);
|
free(kccgst.compat);
|
||||||
|
|
|
@ -33,7 +33,7 @@ static int
|
||||||
test_rmlvo(const char *rules, const char *model, const char *layout,
|
test_rmlvo(const char *rules, const char *model, const char *layout,
|
||||||
const char *variant, const char *options)
|
const char *variant, const char *options)
|
||||||
{
|
{
|
||||||
struct xkb_ctx *ctx;
|
struct xkb_context *context;
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
struct xkb_rule_names rmlvo = {
|
struct xkb_rule_names rmlvo = {
|
||||||
.rules = rules,
|
.rules = rules,
|
||||||
|
@ -43,20 +43,20 @@ test_rmlvo(const char *rules, const char *model, const char *layout,
|
||||||
.options = options
|
.options = options
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx = xkb_ctx_new(0);
|
context = xkb_context_new(0);
|
||||||
assert(ctx);
|
assert(context);
|
||||||
|
|
||||||
fprintf(stderr, "\nCompiling %s %s %s %s %s\n", rmlvo.rules, rmlvo.model,
|
fprintf(stderr, "\nCompiling %s %s %s %s %s\n", rmlvo.rules, rmlvo.model,
|
||||||
rmlvo.layout, rmlvo.variant, rmlvo.options);
|
rmlvo.layout, rmlvo.variant, rmlvo.options);
|
||||||
|
|
||||||
keymap = xkb_map_new_from_names(ctx, &rmlvo, 0);
|
keymap = xkb_map_new_from_names(context, &rmlvo, 0);
|
||||||
if (!keymap) {
|
if (!keymap) {
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xkb_map_unref(keymap);
|
xkb_map_unref(keymap);
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
test/state.c
10
test/state.c
|
@ -224,7 +224,7 @@ test_serialisation(struct xkb_keymap *keymap)
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
struct xkb_ctx *ctx;
|
struct xkb_context *context;
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
struct xkb_rule_names rmlvo = {
|
struct xkb_rule_names rmlvo = {
|
||||||
.rules = "evdev",
|
.rules = "evdev",
|
||||||
|
@ -234,15 +234,15 @@ main(void)
|
||||||
.options = NULL,
|
.options = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx = xkb_ctx_new(0);
|
context = xkb_context_new(0);
|
||||||
assert(ctx);
|
assert(context);
|
||||||
|
|
||||||
keymap = xkb_map_new_from_names(ctx, &rmlvo, 0);
|
keymap = xkb_map_new_from_names(context, &rmlvo, 0);
|
||||||
assert(keymap);
|
assert(keymap);
|
||||||
|
|
||||||
test_update_key(keymap);
|
test_update_key(keymap);
|
||||||
test_serialisation(keymap);
|
test_serialisation(keymap);
|
||||||
|
|
||||||
xkb_map_unref(keymap);
|
xkb_map_unref(keymap);
|
||||||
xkb_ctx_unref(ctx);
|
xkb_context_unref(context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue