Shorten context to ctx
(This breaks the API.) "context" is really annoying to type all the time (and we're going to type it a lot more :). "ctx" is clear, concise and common in many other libraries. Use it! Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Fix for xkb -> keymap change.]master
parent
699a0b841c
commit
e7bb1e5fd9
|
@ -133,9 +133,9 @@ struct xkb_component_names {
|
|||
|
||||
/**
|
||||
* Opaque context object; may only be created, accessed, manipulated and
|
||||
* destroyed through the xkb_context_*() API.
|
||||
* destroyed through the xkb_ctx_*() API.
|
||||
*/
|
||||
struct xkb_context;
|
||||
struct xkb_ctx;
|
||||
|
||||
/**
|
||||
* Opaque keymap object; may only be created, accessed, manipulated and
|
||||
|
@ -193,7 +193,7 @@ xkb_keysym_from_name(const char *s);
|
|||
* @{
|
||||
*/
|
||||
|
||||
enum xkb_context_flags {
|
||||
enum xkb_ctx_flags {
|
||||
/** Create this context with an empty include path. */
|
||||
XKB_CONTEXT_NO_DEFAULT_INCLUDES = 1,
|
||||
};
|
||||
|
@ -201,10 +201,10 @@ enum xkb_context_flags {
|
|||
/**
|
||||
* 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().
|
||||
* xkb_ctx_unref().
|
||||
*/
|
||||
struct xkb_context *
|
||||
xkb_context_new(enum xkb_context_flags flags);
|
||||
struct xkb_ctx *
|
||||
xkb_ctx_new(enum xkb_ctx_flags flags);
|
||||
|
||||
/**
|
||||
* Appends a new entry to the include path used for keymap compilation.
|
||||
|
@ -212,7 +212,7 @@ xkb_context_new(enum xkb_context_flags flags);
|
|||
* inaccessible.
|
||||
*/
|
||||
int
|
||||
xkb_context_include_path_append(struct xkb_context *context, const char *path);
|
||||
xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path);
|
||||
|
||||
/**
|
||||
* Appends the default include paths to the context's current include path.
|
||||
|
@ -220,7 +220,7 @@ xkb_context_include_path_append(struct xkb_context *context, const char *path);
|
|||
* added.
|
||||
*/
|
||||
int
|
||||
xkb_context_include_path_append_default(struct xkb_context *context);
|
||||
xkb_ctx_include_path_append_default(struct xkb_ctx *ctx);
|
||||
|
||||
/**
|
||||
* Removes all entries from the context's include path, and inserts the
|
||||
|
@ -228,37 +228,37 @@ xkb_context_include_path_append_default(struct xkb_context *context);
|
|||
* could not be added.
|
||||
*/
|
||||
int
|
||||
xkb_context_include_path_reset_defaults(struct xkb_context *context);
|
||||
xkb_ctx_include_path_reset_defaults(struct xkb_ctx *ctx);
|
||||
|
||||
/**
|
||||
* Removes all entries from the context's include path.
|
||||
*/
|
||||
void
|
||||
xkb_context_include_path_clear(struct xkb_context *context);
|
||||
xkb_ctx_include_path_clear(struct xkb_ctx *ctx);
|
||||
|
||||
/**
|
||||
* Returns the number of include paths currently active in the context.
|
||||
*/
|
||||
unsigned int
|
||||
xkb_context_num_include_paths(struct xkb_context *context);
|
||||
xkb_ctx_num_include_paths(struct xkb_ctx *ctx);
|
||||
|
||||
/**
|
||||
* Returns the include path at the specified index within the context.
|
||||
*/
|
||||
const char *
|
||||
xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
|
||||
xkb_ctx_include_path_get(struct xkb_ctx *ctx, unsigned int index);
|
||||
|
||||
/**
|
||||
* Takes a new reference on an XKB context.
|
||||
*/
|
||||
struct xkb_context *
|
||||
xkb_context_ref(struct xkb_context *context);
|
||||
struct xkb_ctx *
|
||||
xkb_ctx_ref(struct xkb_ctx *ctx);
|
||||
|
||||
/**
|
||||
* Releases a reference on an XKB context, and possibly frees it.
|
||||
*/
|
||||
void
|
||||
xkb_context_unref(struct xkb_context *context);
|
||||
xkb_ctx_unref(struct xkb_ctx *ctx);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -282,7 +282,7 @@ enum xkb_map_compile_flags {
|
|||
* keymaps.
|
||||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_names(struct xkb_context *context,
|
||||
xkb_map_new_from_names(struct xkb_ctx *ctx,
|
||||
const struct xkb_rule_names *names,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
|
@ -297,7 +297,7 @@ xkb_map_new_from_names(struct xkb_context *context,
|
|||
* Geometry will be ignored since xkbcommon does not support it in any way.
|
||||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_kccgst(struct xkb_context *context,
|
||||
xkb_map_new_from_kccgst(struct xkb_ctx *ctx,
|
||||
const struct xkb_component_names *kccgst,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
|
@ -311,7 +311,7 @@ enum xkb_keymap_format {
|
|||
* file descriptor.
|
||||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_fd(struct xkb_context *context,
|
||||
xkb_map_new_from_fd(struct xkb_ctx *ctx,
|
||||
int fd, enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
|
@ -320,7 +320,7 @@ xkb_map_new_from_fd(struct xkb_context *context,
|
|||
* enormous string.
|
||||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_string(struct xkb_context *context,
|
||||
xkb_map_new_from_string(struct xkb_ctx *ctx,
|
||||
const char *string,
|
||||
enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
|
|
@ -597,7 +597,7 @@ XkbcFreeIndicatorMaps(struct xkb_keymap *keymap)
|
|||
}
|
||||
|
||||
struct xkb_keymap *
|
||||
XkbcAllocKeyboard(struct xkb_context *context)
|
||||
XkbcAllocKeyboard(struct xkb_ctx *ctx)
|
||||
{
|
||||
struct xkb_keymap *keymap;
|
||||
|
||||
|
@ -606,7 +606,7 @@ XkbcAllocKeyboard(struct xkb_context *context)
|
|||
return NULL;
|
||||
|
||||
keymap->refcnt = 1;
|
||||
keymap->context = xkb_context_ref(context);
|
||||
keymap->ctx = xkb_ctx_ref(ctx);
|
||||
|
||||
return keymap;
|
||||
}
|
||||
|
@ -623,6 +623,6 @@ XkbcFreeKeyboard(struct xkb_keymap *keymap)
|
|||
XkbcFreeIndicatorMaps(keymap);
|
||||
XkbcFreeNames(keymap);
|
||||
XkbcFreeControls(keymap);
|
||||
xkb_context_unref(keymap->context);
|
||||
xkb_ctx_unref(keymap->ctx);
|
||||
free(keymap);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ extern int
|
|||
XkbcAllocIndicatorMaps(struct xkb_keymap *keymap);
|
||||
|
||||
extern struct xkb_keymap *
|
||||
XkbcAllocKeyboard(struct xkb_context *context);
|
||||
XkbcAllocKeyboard(struct xkb_ctx *ctx);
|
||||
|
||||
extern void
|
||||
XkbcFreeKeyboard(struct xkb_keymap *keymap);
|
||||
|
|
116
src/context.c
116
src/context.c
|
@ -31,7 +31,7 @@
|
|||
#include "xkb-priv.h"
|
||||
#include "atom.h"
|
||||
|
||||
struct xkb_context {
|
||||
struct xkb_ctx {
|
||||
int refcnt;
|
||||
|
||||
char **include_paths;
|
||||
|
@ -48,23 +48,23 @@ struct xkb_context {
|
|||
* Append one directory to the context's include path.
|
||||
*/
|
||||
_X_EXPORT int
|
||||
xkb_context_include_path_append(struct xkb_context *context, const char *path)
|
||||
xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
int err;
|
||||
|
||||
if (context->size_include_paths <= context->num_include_paths) {
|
||||
if (ctx->size_include_paths <= ctx->num_include_paths) {
|
||||
int new_size;
|
||||
char **new_paths;
|
||||
new_size = context->size_include_paths + 2;
|
||||
new_paths = uTypedRecalloc(context->include_paths,
|
||||
context->size_include_paths,
|
||||
new_size = ctx->size_include_paths + 2;
|
||||
new_paths = uTypedRecalloc(ctx->include_paths,
|
||||
ctx->size_include_paths,
|
||||
new_size,
|
||||
char *);
|
||||
if (!new_paths)
|
||||
return 0;
|
||||
context->include_paths = new_paths;
|
||||
context->size_include_paths = new_size;
|
||||
ctx->include_paths = new_paths;
|
||||
ctx->size_include_paths = new_size;
|
||||
}
|
||||
|
||||
err = stat(path, &stat_buf);
|
||||
|
@ -75,10 +75,10 @@ xkb_context_include_path_append(struct xkb_context *context, const char *path)
|
|||
if (eaccess(path, R_OK | X_OK) != 0)
|
||||
return 0;
|
||||
|
||||
context->include_paths[context->num_include_paths] = strdup(path);
|
||||
if (!context->include_paths[context->num_include_paths])
|
||||
ctx->include_paths[ctx->num_include_paths] = strdup(path);
|
||||
if (!ctx->include_paths[ctx->num_include_paths])
|
||||
return 0;
|
||||
context->num_include_paths++;
|
||||
ctx->num_include_paths++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -87,13 +87,13 @@ xkb_context_include_path_append(struct xkb_context *context, const char *path)
|
|||
* Append the default include directories to the context.
|
||||
*/
|
||||
_X_EXPORT int
|
||||
xkb_context_include_path_append_default(struct xkb_context *context)
|
||||
xkb_ctx_include_path_append_default(struct xkb_ctx *ctx)
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
char *user_path;
|
||||
int err;
|
||||
|
||||
(void) xkb_context_include_path_append(context, DFLT_XKB_CONFIG_ROOT);
|
||||
(void) xkb_ctx_include_path_append(ctx, DFLT_XKB_CONFIG_ROOT);
|
||||
|
||||
home = getenv("HOME");
|
||||
if (!home)
|
||||
|
@ -101,7 +101,7 @@ xkb_context_include_path_append_default(struct xkb_context *context)
|
|||
err = asprintf(&user_path, "%s/.xkb", home);
|
||||
if (err <= 0)
|
||||
return 1;
|
||||
(void) xkb_context_include_path_append(context, user_path);
|
||||
(void) xkb_ctx_include_path_append(ctx, user_path);
|
||||
free(user_path);
|
||||
|
||||
return 1;
|
||||
|
@ -111,36 +111,36 @@ xkb_context_include_path_append_default(struct xkb_context *context)
|
|||
* Remove all entries in the context's include path.
|
||||
*/
|
||||
_X_EXPORT void
|
||||
xkb_context_include_path_clear(struct xkb_context *context)
|
||||
xkb_ctx_include_path_clear(struct xkb_ctx *ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < context->num_include_paths; i++) {
|
||||
free(context->include_paths[i]);
|
||||
context->include_paths[i] = NULL;
|
||||
for (i = 0; i < ctx->num_include_paths; i++) {
|
||||
free(ctx->include_paths[i]);
|
||||
ctx->include_paths[i] = NULL;
|
||||
}
|
||||
free(context->include_paths);
|
||||
context->include_paths = NULL;
|
||||
context->num_include_paths = 0;
|
||||
free(ctx->include_paths);
|
||||
ctx->include_paths = NULL;
|
||||
ctx->num_include_paths = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* xkb_context_include_path_clear() + xkb_context_include_path_append_default()
|
||||
* xkb_ctx_include_path_clear() + xkb_ctx_include_path_append_default()
|
||||
*/
|
||||
_X_EXPORT int
|
||||
xkb_context_include_path_reset_defaults(struct xkb_context *context)
|
||||
xkb_ctx_include_path_reset_defaults(struct xkb_ctx *ctx)
|
||||
{
|
||||
xkb_context_include_path_clear(context);
|
||||
return xkb_context_include_path_append_default(context);
|
||||
xkb_ctx_include_path_clear(ctx);
|
||||
return xkb_ctx_include_path_append_default(ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of entries in the context's include path.
|
||||
*/
|
||||
_X_EXPORT unsigned int
|
||||
xkb_context_num_include_paths(struct xkb_context *context)
|
||||
xkb_ctx_num_include_paths(struct xkb_ctx *ctx)
|
||||
{
|
||||
return context->num_include_paths;
|
||||
return ctx->num_include_paths;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,28 +148,28 @@ xkb_context_num_include_paths(struct xkb_context *context)
|
|||
* invalid index is passed.
|
||||
*/
|
||||
_X_EXPORT const char *
|
||||
xkb_context_include_path_get(struct xkb_context *context, unsigned int idx)
|
||||
xkb_ctx_include_path_get(struct xkb_ctx *ctx, unsigned int idx)
|
||||
{
|
||||
if (idx >= xkb_context_num_include_paths(context))
|
||||
if (idx >= xkb_ctx_num_include_paths(ctx))
|
||||
return NULL;
|
||||
|
||||
return context->include_paths[idx];
|
||||
return ctx->include_paths[idx];
|
||||
}
|
||||
|
||||
int
|
||||
xkb_context_take_file_id(struct xkb_context *context)
|
||||
xkb_ctx_take_file_id(struct xkb_ctx *ctx)
|
||||
{
|
||||
return context->file_id++;
|
||||
return ctx->file_id++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a new reference on the context.
|
||||
*/
|
||||
_X_EXPORT struct xkb_context *
|
||||
xkb_context_ref(struct xkb_context *context)
|
||||
_X_EXPORT struct xkb_ctx *
|
||||
xkb_ctx_ref(struct xkb_ctx *ctx)
|
||||
{
|
||||
context->refcnt++;
|
||||
return context;
|
||||
ctx->refcnt++;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,58 +177,58 @@ xkb_context_ref(struct xkb_context *context)
|
|||
* now 0.
|
||||
*/
|
||||
_X_EXPORT void
|
||||
xkb_context_unref(struct xkb_context *context)
|
||||
xkb_ctx_unref(struct xkb_ctx *ctx)
|
||||
{
|
||||
if (--context->refcnt > 0)
|
||||
if (--ctx->refcnt > 0)
|
||||
return;
|
||||
|
||||
xkb_context_include_path_clear(context);
|
||||
atom_table_free(context->atom_table);
|
||||
free(context);
|
||||
xkb_ctx_include_path_clear(ctx);
|
||||
atom_table_free(ctx->atom_table);
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new context.
|
||||
*/
|
||||
_X_EXPORT struct xkb_context *
|
||||
xkb_context_new(enum xkb_context_flags flags)
|
||||
_X_EXPORT struct xkb_ctx *
|
||||
xkb_ctx_new(enum xkb_ctx_flags flags)
|
||||
{
|
||||
struct xkb_context *context = calloc(1, sizeof(*context));
|
||||
struct xkb_ctx *ctx = calloc(1, sizeof(*ctx));
|
||||
|
||||
if (!context)
|
||||
if (!ctx)
|
||||
return NULL;
|
||||
|
||||
context->refcnt = 1;
|
||||
ctx->refcnt = 1;
|
||||
|
||||
if (!(flags & XKB_CONTEXT_NO_DEFAULT_INCLUDES) &&
|
||||
!xkb_context_include_path_append_default(context)) {
|
||||
xkb_context_unref(context);
|
||||
!xkb_ctx_include_path_append_default(ctx)) {
|
||||
xkb_ctx_unref(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
context->atom_table = atom_table_new();
|
||||
if (!context->atom_table) {
|
||||
xkb_context_unref(context);
|
||||
ctx->atom_table = atom_table_new();
|
||||
if (!ctx->atom_table) {
|
||||
xkb_ctx_unref(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return context;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
xkb_atom_t
|
||||
xkb_atom_intern(struct xkb_context *context, const char *string)
|
||||
xkb_atom_intern(struct xkb_ctx *ctx, const char *string)
|
||||
{
|
||||
return atom_intern(context->atom_table, string);
|
||||
return atom_intern(ctx->atom_table, string);
|
||||
}
|
||||
|
||||
char *
|
||||
xkb_atom_strdup(struct xkb_context *context, xkb_atom_t atom)
|
||||
xkb_atom_strdup(struct xkb_ctx *ctx, xkb_atom_t atom)
|
||||
{
|
||||
return atom_strdup(context->atom_table, atom);
|
||||
return atom_strdup(ctx->atom_table, atom);
|
||||
}
|
||||
|
||||
const char *
|
||||
xkb_atom_text(struct xkb_context *context, xkb_atom_t atom)
|
||||
xkb_atom_text(struct xkb_ctx *ctx, xkb_atom_t atom)
|
||||
{
|
||||
return atom_text(context->atom_table, atom);
|
||||
return atom_text(ctx->atom_table, atom);
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ struct xkb_controls {
|
|||
|
||||
/* Common keyboard description structure */
|
||||
struct xkb_keymap {
|
||||
struct xkb_context *context;
|
||||
struct xkb_ctx *ctx;
|
||||
|
||||
unsigned int refcnt;
|
||||
unsigned short flags;
|
||||
|
@ -431,13 +431,13 @@ typedef uint32_t xkb_atom_t;
|
|||
#define XKB_ATOM_NONE 0
|
||||
|
||||
xkb_atom_t
|
||||
xkb_atom_intern(struct xkb_context *context, const char *string);
|
||||
xkb_atom_intern(struct xkb_ctx *ctx, const char *string);
|
||||
|
||||
char *
|
||||
xkb_atom_strdup(struct xkb_context *context, xkb_atom_t atom);
|
||||
xkb_atom_strdup(struct xkb_ctx *ctx, xkb_atom_t atom);
|
||||
|
||||
const char *
|
||||
xkb_atom_text(struct xkb_context *context, xkb_atom_t atom);
|
||||
xkb_atom_text(struct xkb_ctx *ctx, xkb_atom_t atom);
|
||||
|
||||
extern unsigned int
|
||||
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key);
|
||||
|
@ -452,7 +452,7 @@ xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t key,
|
|||
const xkb_keysym_t **syms_out);
|
||||
|
||||
extern int
|
||||
xkb_context_take_file_id(struct xkb_context *context);
|
||||
xkb_ctx_take_file_id(struct xkb_ctx *ctx);
|
||||
|
||||
extern bool
|
||||
XkbcComputeEffectiveMap(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
||||
|
|
|
@ -222,7 +222,7 @@ CheckLatchLockFlags(struct xkb_keymap *keymap, unsigned action,
|
|||
tmp = XkbSA_LatchToLock;
|
||||
else
|
||||
return false; /* WSGO! */
|
||||
if (!ExprResolveBoolean(keymap->context, value, &result))
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &result))
|
||||
return ReportMismatch(action, field, "boolean");
|
||||
if (result.uval)
|
||||
*flags_inout |= tmp;
|
||||
|
@ -240,7 +240,7 @@ CheckModifierField(struct xkb_keymap *keymap, unsigned action, ExprDef *value,
|
|||
if (value->op == ExprIdent)
|
||||
{
|
||||
const char *valStr;
|
||||
valStr = xkb_atom_text(keymap->context, value->value.str);
|
||||
valStr = xkb_atom_text(keymap->ctx, value->value.str);
|
||||
if (valStr && ((strcasecmp(valStr, "usemodmapmods") == 0) ||
|
||||
(strcasecmp(valStr, "modmapmods") == 0)))
|
||||
{
|
||||
|
@ -345,7 +345,7 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
|
|||
spec = value;
|
||||
}
|
||||
|
||||
if (!ExprResolveGroup(keymap->context, spec, &rtrn))
|
||||
if (!ExprResolveGroup(keymap->ctx, spec, &rtrn))
|
||||
return ReportMismatch(action, F_Group, "integer (range 1..8)");
|
||||
if (value->op == OpNegate)
|
||||
*grp_rtrn = -rtrn.ival;
|
||||
|
@ -443,7 +443,7 @@ HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
absolute = false;
|
||||
else
|
||||
absolute = true;
|
||||
if (!ExprResolveInteger(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if (field == F_X)
|
||||
{
|
||||
|
@ -461,7 +461,7 @@ HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
}
|
||||
else if (field == F_Accel)
|
||||
{
|
||||
if (!ExprResolveBoolean(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "boolean");
|
||||
if (rtrn.uval)
|
||||
act->flags &= ~XkbSA_NoAcceleration;
|
||||
|
@ -491,7 +491,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveButton(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field,
|
||||
"integer (range 1..5)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 5))
|
||||
|
@ -507,7 +507,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveEnum(keymap->context, value, &rtrn, lockWhich))
|
||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, lockWhich))
|
||||
return ReportMismatch(action->type, field, "lock or unlock");
|
||||
act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
|
||||
act->flags |= rtrn.ival;
|
||||
|
@ -517,7 +517,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveButton(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
|
@ -550,7 +550,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveEnum(keymap->context, value, &rtrn, ptrDflts))
|
||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, ptrDflts))
|
||||
return ReportMismatch(action->type, field, "pointer component");
|
||||
act->affect = rtrn.uval;
|
||||
return true;
|
||||
|
@ -571,7 +571,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
btn = value;
|
||||
}
|
||||
|
||||
if (!ExprResolveButton(keymap->context, btn, &rtrn))
|
||||
if (!ExprResolveButton(keymap->ctx, btn, &rtrn))
|
||||
return ReportMismatch(action->type, field,
|
||||
"integer (range 1..5)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 5))
|
||||
|
@ -647,7 +647,7 @@ HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
case F_Affect:
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveMask(keymap->context, value, &rtrn, isoNames))
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, isoNames))
|
||||
return ReportMismatch(action->type, field, "keyboard component");
|
||||
act->affect = (~rtrn.uval) & XkbSA_ISOAffectMask;
|
||||
return true;
|
||||
|
@ -679,7 +679,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
scrn = value;
|
||||
}
|
||||
|
||||
if (!ExprResolveInteger(keymap->context, scrn, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, scrn, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer (0..255)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
|
@ -697,7 +697,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveBoolean(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "boolean");
|
||||
if (rtrn.uval)
|
||||
act->flags &= ~XkbSA_SwitchApplication;
|
||||
|
@ -741,7 +741,7 @@ HandleSetLockControls(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveMask(keymap->context, value, &rtrn, ctrlNames))
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, ctrlNames))
|
||||
return ReportMismatch(action->type, field, "controls mask");
|
||||
act->ctrls = rtrn.uval;
|
||||
return true;
|
||||
|
@ -772,7 +772,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
case F_Report:
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveMask(keymap->context, value, &rtrn, evNames))
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, evNames))
|
||||
return ReportMismatch(action->type, field, "key event mask");
|
||||
act->flags &= ~(XkbSA_MessageOnPress | XkbSA_MessageOnRelease);
|
||||
act->flags =
|
||||
|
@ -781,7 +781,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
case F_GenKeyEvent:
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveBoolean(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "boolean");
|
||||
if (rtrn.uval)
|
||||
act->flags |= XkbSA_MessageGenKeyEvent;
|
||||
|
@ -791,7 +791,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
case F_Data:
|
||||
if (array_ndx == NULL)
|
||||
{
|
||||
if (!ExprResolveString(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "string");
|
||||
else
|
||||
{
|
||||
|
@ -808,7 +808,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
else
|
||||
{
|
||||
unsigned ndx;
|
||||
if (!ExprResolveInteger(keymap->context, array_ndx, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn))
|
||||
{
|
||||
ERROR("Array subscript must be integer\n");
|
||||
ACTION("Illegal subscript ignored\n");
|
||||
|
@ -821,7 +821,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
ACTION("Attempt to use data[%d] ignored\n", ndx);
|
||||
return false;
|
||||
}
|
||||
if (!ExprResolveInteger(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
|
@ -853,7 +853,7 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
switch (field)
|
||||
{
|
||||
case F_Keycode:
|
||||
if (!ExprResolveKeyName(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveKeyName(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "key name");
|
||||
tmp = KeyNameToLong(rtrn.keyName.name);
|
||||
if (!FindNamedKey(keymap, tmp, &kc, true, CreateKeyNames(keymap), 0))
|
||||
|
@ -899,7 +899,7 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveInteger(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field,
|
||||
"integer (range 1..255)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
|
@ -915,7 +915,7 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveEnum(keymap->context, value, &rtrn, lockWhich))
|
||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, lockWhich))
|
||||
return ReportMismatch(action->type, field, "lock or unlock");
|
||||
act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
|
||||
act->flags |= rtrn.ival;
|
||||
|
@ -925,7 +925,7 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveButton(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
|
@ -940,7 +940,7 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveInteger(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field,
|
||||
"integer (range 1..255)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
|
@ -978,7 +978,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
switch (field)
|
||||
{
|
||||
case F_Type:
|
||||
if (!ExprResolveInteger(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(PrivateAction, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
|
@ -991,7 +991,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
case F_Data:
|
||||
if (array_ndx == NULL)
|
||||
{
|
||||
if (!ExprResolveString(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "string");
|
||||
else
|
||||
{
|
||||
|
@ -1010,7 +1010,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
else
|
||||
{
|
||||
unsigned ndx;
|
||||
if (!ExprResolveInteger(keymap->context, array_ndx, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn))
|
||||
{
|
||||
ERROR("Array subscript must be integer\n");
|
||||
ACTION("Illegal subscript ignored\n");
|
||||
|
@ -1023,7 +1023,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
ACTION("Attempt to use data[%d] ignored\n", ndx);
|
||||
return false;
|
||||
}
|
||||
if (!ExprResolveInteger(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
|
@ -1085,7 +1085,7 @@ ApplyActionFactoryDefaults(union xkb_action * action)
|
|||
}
|
||||
|
||||
static void
|
||||
ActionsInit(struct xkb_context *context);
|
||||
ActionsInit(struct xkb_ctx *ctx);
|
||||
|
||||
int
|
||||
HandleActionDef(ExprDef * def,
|
||||
|
@ -1097,7 +1097,7 @@ HandleActionDef(ExprDef * def,
|
|||
unsigned tmp, hndlrType;
|
||||
|
||||
if (!actionsInitialized)
|
||||
ActionsInit(keymap->context);
|
||||
ActionsInit(keymap->ctx);
|
||||
|
||||
if (def->op != ExprActionDecl)
|
||||
{
|
||||
|
@ -1105,7 +1105,7 @@ HandleActionDef(ExprDef * def,
|
|||
exprOpText(def->op));
|
||||
return false;
|
||||
}
|
||||
str = xkb_atom_text(keymap->context, def->value.action.name);
|
||||
str = xkb_atom_text(keymap->ctx, def->value.action.name);
|
||||
if (!str)
|
||||
{
|
||||
WSGO("Missing name in action definition!!\n");
|
||||
|
@ -1153,13 +1153,13 @@ HandleActionDef(ExprDef * def,
|
|||
if ((arg->op == OpNot) || (arg->op == OpInvert))
|
||||
{
|
||||
field = arg->value.child;
|
||||
constFalse.value.str = xkb_atom_intern(keymap->context, "false");
|
||||
constFalse.value.str = xkb_atom_intern(keymap->ctx, "false");
|
||||
value = &constFalse;
|
||||
}
|
||||
else
|
||||
{
|
||||
field = arg;
|
||||
constTrue.value.str = xkb_atom_intern(keymap->context, "true");
|
||||
constTrue.value.str = xkb_atom_intern(keymap->ctx, "true");
|
||||
value = &constTrue;
|
||||
}
|
||||
}
|
||||
|
@ -1202,7 +1202,7 @@ SetActionField(struct xkb_keymap *keymap,
|
|||
ActionInfo *new, *old;
|
||||
|
||||
if (!actionsInitialized)
|
||||
ActionsInit(keymap->context);
|
||||
ActionsInit(keymap->ctx);
|
||||
|
||||
new = uTypedAlloc(ActionInfo);
|
||||
if (new == NULL)
|
||||
|
@ -1249,7 +1249,7 @@ SetActionField(struct xkb_keymap *keymap,
|
|||
/***====================================================================***/
|
||||
|
||||
static void
|
||||
ActionsInit(struct xkb_context *context)
|
||||
ActionsInit(struct xkb_ctx *ctx)
|
||||
{
|
||||
if (!actionsInitialized)
|
||||
{
|
||||
|
@ -1259,12 +1259,12 @@ ActionsInit(struct xkb_context *context)
|
|||
constTrue.common.next = NULL;
|
||||
constTrue.op = ExprIdent;
|
||||
constTrue.type = TypeBoolean;
|
||||
constTrue.value.str = xkb_atom_intern(context, "true");
|
||||
constTrue.value.str = xkb_atom_intern(ctx, "true");
|
||||
constFalse.common.stmtType = StmtExpr;
|
||||
constFalse.common.next = NULL;
|
||||
constFalse.op = ExprIdent;
|
||||
constFalse.type = TypeBoolean;
|
||||
constFalse.value.str = xkb_atom_intern(context, "false");
|
||||
constFalse.value.str = xkb_atom_intern(ctx, "false");
|
||||
actionsInitialized = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap)
|
|||
info->dflt.interp.act.type = XkbSA_NoAction;
|
||||
for (i = 0; i < sizeof(info->dflt.interp.act.any.data); i++)
|
||||
info->dflt.interp.act.any.data[i] = 0;
|
||||
ClearIndicatorMapInfo(keymap->context, &info->ledDflt);
|
||||
ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt);
|
||||
info->ledDflt.defs.fileID = info->fileID;
|
||||
info->ledDflt.defs.defined = 0;
|
||||
info->ledDflt.defs.merge = MergeOverride;
|
||||
|
@ -140,7 +140,7 @@ ClearCompatInfo(CompatInfo *info, struct xkb_keymap *keymap)
|
|||
info->dflt.interp.act.type = XkbSA_NoAction;
|
||||
for (i = 0; i < sizeof(info->dflt.interp.act.any.data); i++)
|
||||
info->dflt.interp.act.any.data[i] = 0;
|
||||
ClearIndicatorMapInfo(keymap->context, &info->ledDflt);
|
||||
ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt);
|
||||
info->nInterps = 0;
|
||||
info->interps = (SymInterpInfo *) ClearCommonInfo(&info->interps->defs);
|
||||
memset(&info->groupCompat[0], 0,
|
||||
|
@ -299,7 +299,7 @@ ResolveStateAndPredicate(ExprDef * expr,
|
|||
*pred_rtrn = XkbSI_Exactly;
|
||||
if (expr->op == ExprActionDecl)
|
||||
{
|
||||
const char *pred_txt = xkb_atom_text(info->keymap->context,
|
||||
const char *pred_txt = xkb_atom_text(info->keymap->ctx,
|
||||
expr->value.action.name);
|
||||
if (strcasecmp(pred_txt, "noneof") == 0)
|
||||
*pred_rtrn = XkbSI_NoneOf;
|
||||
|
@ -321,7 +321,7 @@ ResolveStateAndPredicate(ExprDef * expr,
|
|||
}
|
||||
else if (expr->op == ExprIdent)
|
||||
{
|
||||
const char *pred_txt = xkb_atom_text(info->keymap->context,
|
||||
const char *pred_txt = xkb_atom_text(info->keymap->ctx,
|
||||
expr->value.str);
|
||||
if ((pred_txt) && (strcasecmp(pred_txt, "any") == 0))
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ ResolveStateAndPredicate(ExprDef * expr,
|
|||
}
|
||||
}
|
||||
|
||||
if (ExprResolveModMask(info->keymap->context, expr, &result))
|
||||
if (ExprResolveModMask(info->keymap->ctx, expr, &result))
|
||||
{
|
||||
*mods_rtrn = result.uval;
|
||||
return true;
|
||||
|
@ -405,8 +405,8 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
included = *info;
|
||||
memset(info, 0, sizeof(CompatInfo));
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->context, stmt, XkmCompatMapIndex,
|
||||
&rtrn, &newMerge))
|
||||
else if (ProcessIncludeFile(keymap->ctx, stmt, XkmCompatMapIndex, &rtrn,
|
||||
&newMerge))
|
||||
{
|
||||
InitCompatInfo(&included, keymap);
|
||||
included.fileID = rtrn->id;
|
||||
|
@ -446,8 +446,8 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
MergeIncludedCompatMaps(&included, info, next->merge);
|
||||
ClearCompatInfo(info, keymap);
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->context, next,
|
||||
XkmCompatMapIndex, &rtrn, &op))
|
||||
else if (ProcessIncludeFile(keymap->ctx, next, XkmCompatMapIndex,
|
||||
&rtrn, &op))
|
||||
{
|
||||
InitCompatInfo(&next_incl, keymap);
|
||||
next_incl.fileID = rtrn->id;
|
||||
|
@ -522,7 +522,7 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportSINotArray(si, field, info);
|
||||
ok = ExprResolveBoolean(keymap->context, value, &tmp);
|
||||
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
||||
if (ok)
|
||||
{
|
||||
if (tmp.uval)
|
||||
|
@ -538,7 +538,7 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportSINotArray(si, field, info);
|
||||
ok = ExprResolveBoolean(keymap->context, value, &tmp);
|
||||
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
||||
if (ok)
|
||||
{
|
||||
if (tmp.uval)
|
||||
|
@ -555,7 +555,7 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportSINotArray(si, field, info);
|
||||
ok = ExprResolveEnum(keymap->context, value, &tmp, useModMapValues);
|
||||
ok = ExprResolveEnum(keymap->ctx, value, &tmp, useModMapValues);
|
||||
if (ok)
|
||||
{
|
||||
if (tmp.uval)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
/***====================================================================***/
|
||||
|
||||
typedef bool (*IdentLookupFunc) (struct xkb_context *context, const void *priv,
|
||||
typedef bool (*IdentLookupFunc) (struct xkb_ctx *ctx, const void *priv,
|
||||
xkb_atom_t field, unsigned type,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
|
@ -137,21 +137,21 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
|
|||
{
|
||||
case ExprIdent:
|
||||
elem_rtrn->str = NULL;
|
||||
field_rtrn->str = xkb_atom_strdup(keymap->context,
|
||||
field_rtrn->str = xkb_atom_strdup(keymap->ctx,
|
||||
expr->value.str);
|
||||
*index_rtrn = NULL;
|
||||
return true;
|
||||
case ExprFieldRef:
|
||||
elem_rtrn->str = xkb_atom_strdup(keymap->context,
|
||||
elem_rtrn->str = xkb_atom_strdup(keymap->ctx,
|
||||
expr->value.field.element);
|
||||
field_rtrn->str = xkb_atom_strdup(keymap->context,
|
||||
field_rtrn->str = xkb_atom_strdup(keymap->ctx,
|
||||
expr->value.field.field);
|
||||
*index_rtrn = NULL;
|
||||
return true;
|
||||
case ExprArrayRef:
|
||||
elem_rtrn->str = xkb_atom_strdup(keymap->context,
|
||||
elem_rtrn->str = xkb_atom_strdup(keymap->ctx,
|
||||
expr->value.array.element);
|
||||
field_rtrn->str = xkb_atom_strdup(keymap->context,
|
||||
field_rtrn->str = xkb_atom_strdup(keymap->ctx,
|
||||
expr->value.array.field);
|
||||
*index_rtrn = expr->value.array.entry;
|
||||
return true;
|
||||
|
@ -161,7 +161,7 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
|
|||
}
|
||||
|
||||
static bool
|
||||
SimpleLookup(struct xkb_context *context, const void *priv,
|
||||
SimpleLookup(struct xkb_ctx *ctx, const void *priv,
|
||||
xkb_atom_t field, unsigned type, ExprResult *val_rtrn)
|
||||
{
|
||||
const LookupEntry *entry;
|
||||
|
@ -171,7 +171,7 @@ SimpleLookup(struct xkb_context *context, const void *priv,
|
|||
{
|
||||
return false;
|
||||
}
|
||||
str = xkb_atom_text(context, field);
|
||||
str = xkb_atom_text(ctx, field);
|
||||
for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++)
|
||||
{
|
||||
if (strcasecmp(str, entry->name) == 0)
|
||||
|
@ -197,14 +197,14 @@ static const LookupEntry modIndexNames[] = {
|
|||
};
|
||||
|
||||
bool
|
||||
LookupModIndex(struct xkb_context *context, const void *priv, xkb_atom_t field,
|
||||
LookupModIndex(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn)
|
||||
{
|
||||
return SimpleLookup(context, modIndexNames, field, type, val_rtrn);
|
||||
return SimpleLookup(ctx, modIndexNames, field, type, val_rtrn);
|
||||
}
|
||||
|
||||
bool
|
||||
LookupModMask(struct xkb_context *context, const void *priv, xkb_atom_t field,
|
||||
LookupModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn)
|
||||
{
|
||||
const char *str;
|
||||
|
@ -212,14 +212,14 @@ LookupModMask(struct xkb_context *context, const void *priv, xkb_atom_t field,
|
|||
|
||||
if (type != TypeInt)
|
||||
return false;
|
||||
str = xkb_atom_text(context, field);
|
||||
str = xkb_atom_text(ctx, field);
|
||||
if (str == NULL)
|
||||
return false;
|
||||
if (strcasecmp(str, "all") == 0)
|
||||
val_rtrn->uval = 0xff;
|
||||
else if (strcasecmp(str, "none") == 0)
|
||||
val_rtrn->uval = 0;
|
||||
else if (LookupModIndex(context, priv, field, type, val_rtrn))
|
||||
else if (LookupModIndex(ctx, priv, field, type, val_rtrn))
|
||||
val_rtrn->uval = (1 << val_rtrn->uval);
|
||||
else
|
||||
ret = false;
|
||||
|
@ -227,7 +227,7 @@ LookupModMask(struct xkb_context *context, const void *priv, xkb_atom_t field,
|
|||
}
|
||||
|
||||
int
|
||||
ExprResolveBoolean(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveBoolean(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
int ok = 0;
|
||||
|
@ -246,7 +246,7 @@ ExprResolveBoolean(struct xkb_context *context, ExprDef *expr,
|
|||
val_rtrn->ival = expr->value.ival;
|
||||
return true;
|
||||
case ExprIdent:
|
||||
bogus = xkb_atom_text(context, expr->value.str);
|
||||
bogus = xkb_atom_text(ctx, expr->value.str);
|
||||
if (bogus)
|
||||
{
|
||||
if ((strcasecmp(bogus, "true") == 0) ||
|
||||
|
@ -265,16 +265,16 @@ ExprResolveBoolean(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
}
|
||||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||
xkb_atom_text(context, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return false;
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type boolean is unknown\n",
|
||||
xkb_atom_text(context, expr->value.field.element),
|
||||
xkb_atom_text(context, expr->value.field.field));
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
case OpInvert:
|
||||
case OpNot:
|
||||
ok = ExprResolveBoolean(context, expr, val_rtrn);
|
||||
ok = ExprResolveBoolean(ctx, expr, val_rtrn);
|
||||
if (ok)
|
||||
val_rtrn->uval = !val_rtrn->uval;
|
||||
return ok;
|
||||
|
@ -309,7 +309,7 @@ ExprResolveBoolean(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
|
||||
int
|
||||
ExprResolveFloat(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveFloat(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
int ok = 0;
|
||||
|
@ -322,7 +322,7 @@ ExprResolveFloat(struct xkb_context *context, ExprDef *expr,
|
|||
if (expr->type == TypeString)
|
||||
{
|
||||
const char *str;
|
||||
str = xkb_atom_text(context, expr->value.str);
|
||||
str = xkb_atom_text(ctx, expr->value.str);
|
||||
if ((str != NULL) && (strlen(str) == 1))
|
||||
{
|
||||
val_rtrn->uval = str[0] * XkbGeomPtsPerMM;
|
||||
|
@ -341,12 +341,12 @@ ExprResolveFloat(struct xkb_context *context, ExprDef *expr,
|
|||
return true;
|
||||
case ExprIdent:
|
||||
ERROR("Numeric identifier \"%s\" unknown\n",
|
||||
xkb_atom_text(context, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return ok;
|
||||
case ExprFieldRef:
|
||||
ERROR("Numeric default \"%s.%s\" unknown\n",
|
||||
xkb_atom_text(context, expr->value.field.element),
|
||||
xkb_atom_text(context, expr->value.field.field));
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
case OpAdd:
|
||||
case OpSubtract:
|
||||
|
@ -354,8 +354,8 @@ ExprResolveFloat(struct xkb_context *context, ExprDef *expr,
|
|||
case OpDivide:
|
||||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveFloat(context, left, &leftRtrn) &&
|
||||
ExprResolveFloat(context, right, &rightRtrn))
|
||||
if (ExprResolveFloat(ctx, left, &leftRtrn) &&
|
||||
ExprResolveFloat(ctx, right, &rightRtrn))
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
|
@ -384,7 +384,7 @@ ExprResolveFloat(struct xkb_context *context, ExprDef *expr,
|
|||
case OpInvert:
|
||||
case OpNegate:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveFloat(context, left, &leftRtrn))
|
||||
if (ExprResolveFloat(ctx, left, &leftRtrn))
|
||||
{
|
||||
if (expr->op == OpNegate)
|
||||
val_rtrn->ival = -leftRtrn.ival;
|
||||
|
@ -395,7 +395,7 @@ ExprResolveFloat(struct xkb_context *context, ExprDef *expr,
|
|||
return false;
|
||||
case OpUnaryPlus:
|
||||
left = expr->value.child;
|
||||
return ExprResolveFloat(context, left, val_rtrn);
|
||||
return ExprResolveFloat(ctx, left, val_rtrn);
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveFloat\n", expr->op);
|
||||
break;
|
||||
|
@ -404,7 +404,7 @@ ExprResolveFloat(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
|
||||
int
|
||||
ExprResolveKeyCode(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveKeyCode(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
ExprResult leftRtrn, rightRtrn;
|
||||
|
@ -428,8 +428,8 @@ ExprResolveKeyCode(struct xkb_context *context, ExprDef *expr,
|
|||
case OpDivide:
|
||||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveKeyCode(context, left, &leftRtrn) &&
|
||||
ExprResolveKeyCode(context, right, &rightRtrn))
|
||||
if (ExprResolveKeyCode(ctx, left, &leftRtrn) &&
|
||||
ExprResolveKeyCode(ctx, right, &rightRtrn))
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
|
@ -451,7 +451,7 @@ ExprResolveKeyCode(struct xkb_context *context, ExprDef *expr,
|
|||
return false;
|
||||
case OpNegate:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveKeyCode(context, left, &leftRtrn))
|
||||
if (ExprResolveKeyCode(ctx, left, &leftRtrn))
|
||||
{
|
||||
val_rtrn->uval = ~leftRtrn.uval;
|
||||
return true;
|
||||
|
@ -459,7 +459,7 @@ ExprResolveKeyCode(struct xkb_context *context, ExprDef *expr,
|
|||
return false;
|
||||
case OpUnaryPlus:
|
||||
left = expr->value.child;
|
||||
return ExprResolveKeyCode(context, left, val_rtrn);
|
||||
return ExprResolveKeyCode(ctx, left, val_rtrn);
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveKeyCode\n", expr->op);
|
||||
break;
|
||||
|
@ -470,9 +470,9 @@ ExprResolveKeyCode(struct xkb_context *context, ExprDef *expr,
|
|||
/**
|
||||
* This function returns ... something. It's a bit of a guess, really.
|
||||
*
|
||||
* If a string is given in value context, its first character will be
|
||||
* returned in uval. If an integer is given in value context, it will be
|
||||
* returned in ival. If a float is given in value context, it will be
|
||||
* If a string is given in value ctx, its first character will be
|
||||
* returned in uval. If an integer is given in value ctx, it will be
|
||||
* returned in ival. If a float is given in value ctx, it will be
|
||||
* returned as millimetres (rather than points) in ival.
|
||||
*
|
||||
* If an ident or field reference is given, the lookup function (if given)
|
||||
|
@ -482,7 +482,7 @@ ExprResolveKeyCode(struct xkb_context *context, ExprDef *expr,
|
|||
* Cool.
|
||||
*/
|
||||
static int
|
||||
ExprResolveIntegerLookup(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveIntegerLookup(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, IdentLookupFunc lookup,
|
||||
const void *lookupPriv)
|
||||
{
|
||||
|
@ -496,7 +496,7 @@ ExprResolveIntegerLookup(struct xkb_context *context, ExprDef *expr,
|
|||
if (expr->type == TypeString)
|
||||
{
|
||||
const char *str;
|
||||
str = xkb_atom_text(context, expr->value.str);
|
||||
str = xkb_atom_text(ctx, expr->value.str);
|
||||
if (str != NULL)
|
||||
switch (strlen(str))
|
||||
{
|
||||
|
@ -521,16 +521,16 @@ ExprResolveIntegerLookup(struct xkb_context *context, ExprDef *expr,
|
|||
return true;
|
||||
case ExprIdent:
|
||||
if (lookup)
|
||||
ok = lookup(context, lookupPriv, expr->value.str,
|
||||
ok = lookup(ctx, lookupPriv, expr->value.str,
|
||||
TypeInt, val_rtrn);
|
||||
if (!ok)
|
||||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||
xkb_atom_text(context, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return ok;
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type int is unknown\n",
|
||||
xkb_atom_text(context, expr->value.field.element),
|
||||
xkb_atom_text(context, expr->value.field.field));
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
case OpAdd:
|
||||
case OpSubtract:
|
||||
|
@ -538,8 +538,8 @@ ExprResolveIntegerLookup(struct xkb_context *context, ExprDef *expr,
|
|||
case OpDivide:
|
||||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveIntegerLookup(context, left, &leftRtrn, lookup, lookupPriv) &&
|
||||
ExprResolveIntegerLookup(context, right, &rightRtrn, lookup, lookupPriv))
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup, lookupPriv) &&
|
||||
ExprResolveIntegerLookup(ctx, right, &rightRtrn, lookup, lookupPriv))
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
|
@ -568,7 +568,7 @@ ExprResolveIntegerLookup(struct xkb_context *context, ExprDef *expr,
|
|||
case OpInvert:
|
||||
case OpNegate:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveIntegerLookup(context, left, &leftRtrn, lookup,
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||
lookupPriv))
|
||||
{
|
||||
if (expr->op == OpNegate)
|
||||
|
@ -580,7 +580,7 @@ ExprResolveIntegerLookup(struct xkb_context *context, ExprDef *expr,
|
|||
return false;
|
||||
case OpUnaryPlus:
|
||||
left = expr->value.child;
|
||||
return ExprResolveIntegerLookup(context, left, val_rtrn, lookup,
|
||||
return ExprResolveIntegerLookup(ctx, left, val_rtrn, lookup,
|
||||
lookupPriv);
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveInteger\n", expr->op);
|
||||
|
@ -590,14 +590,14 @@ ExprResolveIntegerLookup(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
|
||||
int
|
||||
ExprResolveInteger(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveInteger(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
return ExprResolveIntegerLookup(context, expr, val_rtrn, NULL, NULL);
|
||||
return ExprResolveIntegerLookup(ctx, expr, val_rtrn, NULL, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveGroup(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveGroup(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
int ret;
|
||||
|
@ -613,7 +613,7 @@ ExprResolveGroup(struct xkb_context *context, ExprDef *expr,
|
|||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
ret = ExprResolveIntegerLookup(context, expr, val_rtrn, SimpleLookup,
|
||||
ret = ExprResolveIntegerLookup(ctx, expr, val_rtrn, SimpleLookup,
|
||||
group_names);
|
||||
if (ret == false)
|
||||
return ret;
|
||||
|
@ -628,7 +628,7 @@ ExprResolveGroup(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
|
||||
int
|
||||
ExprResolveLevel(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveLevel(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
int ret;
|
||||
|
@ -644,7 +644,7 @@ ExprResolveLevel(struct xkb_context *context, ExprDef *expr,
|
|||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
ret = ExprResolveIntegerLookup(context, expr, val_rtrn, SimpleLookup,
|
||||
ret = ExprResolveIntegerLookup(ctx, expr, val_rtrn, SimpleLookup,
|
||||
level_names);
|
||||
if (ret == false)
|
||||
return ret;
|
||||
|
@ -659,7 +659,7 @@ ExprResolveLevel(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
|
||||
int
|
||||
ExprResolveButton(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveButton(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
static const LookupEntry button_names[] = {
|
||||
|
@ -672,12 +672,12 @@ ExprResolveButton(struct xkb_context *context, ExprDef *expr,
|
|||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
return ExprResolveIntegerLookup(context, expr, val_rtrn, SimpleLookup,
|
||||
return ExprResolveIntegerLookup(ctx, expr, val_rtrn, SimpleLookup,
|
||||
button_names);
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveString(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveString(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
ExprResult leftRtrn, rightRtrn;
|
||||
|
@ -694,24 +694,24 @@ ExprResolveString(struct xkb_context *context, ExprDef *expr,
|
|||
exprTypeText(expr->type));
|
||||
return false;
|
||||
}
|
||||
val_rtrn->str = xkb_atom_strdup(context, expr->value.str);
|
||||
val_rtrn->str = xkb_atom_strdup(ctx, expr->value.str);
|
||||
if (val_rtrn->str == NULL)
|
||||
val_rtrn->str = strdup("");
|
||||
return true;
|
||||
case ExprIdent:
|
||||
ERROR("Identifier \"%s\" of type string not found\n",
|
||||
xkb_atom_text(context, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return false;
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type string not found\n",
|
||||
xkb_atom_text(context, expr->value.field.element),
|
||||
xkb_atom_text(context, expr->value.field.field));
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
case OpAdd:
|
||||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveString(context, left, &leftRtrn) &&
|
||||
ExprResolveString(context, right, &rightRtrn))
|
||||
if (ExprResolveString(ctx, left, &leftRtrn) &&
|
||||
ExprResolveString(ctx, right, &rightRtrn))
|
||||
{
|
||||
int len;
|
||||
char *new;
|
||||
|
@ -762,7 +762,7 @@ ExprResolveString(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
|
||||
int
|
||||
ExprResolveKeyName(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveKeyName(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
const char *bogus = NULL;
|
||||
|
@ -780,12 +780,12 @@ ExprResolveKeyName(struct xkb_context *context, ExprDef *expr,
|
|||
return true;
|
||||
case ExprIdent:
|
||||
ERROR("Identifier \"%s\" of type string not found\n",
|
||||
xkb_atom_text(context, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return false;
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type key name not found\n",
|
||||
xkb_atom_text(context, expr->value.field.element),
|
||||
xkb_atom_text(context, expr->value.field.field));
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
case OpAdd:
|
||||
if (bogus == NULL)
|
||||
|
@ -826,7 +826,7 @@ ExprResolveKeyName(struct xkb_context *context, ExprDef *expr,
|
|||
/***====================================================================***/
|
||||
|
||||
int
|
||||
ExprResolveEnum(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveEnum(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, const LookupEntry *values)
|
||||
{
|
||||
if (expr->op != ExprIdent)
|
||||
|
@ -835,11 +835,11 @@ ExprResolveEnum(struct xkb_context *context, ExprDef *expr,
|
|||
exprOpText(expr->op));
|
||||
return false;
|
||||
}
|
||||
if (!SimpleLookup(context, values, expr->value.str, TypeInt, val_rtrn))
|
||||
if (!SimpleLookup(ctx, values, expr->value.str, TypeInt, val_rtrn))
|
||||
{
|
||||
int nOut = 0;
|
||||
ERROR("Illegal identifier %s (expected one of: ",
|
||||
xkb_atom_text(context, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
while (values && values->name)
|
||||
{
|
||||
if (nOut != 0)
|
||||
|
@ -856,7 +856,7 @@ ExprResolveEnum(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
|
||||
static int
|
||||
ExprResolveMaskLookup(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveMaskLookup(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, IdentLookupFunc lookup,
|
||||
const void *lookupPriv)
|
||||
{
|
||||
|
@ -878,15 +878,15 @@ ExprResolveMaskLookup(struct xkb_context *context, ExprDef *expr,
|
|||
val_rtrn->ival = expr->value.ival;
|
||||
return true;
|
||||
case ExprIdent:
|
||||
ok = lookup(context, lookupPriv, expr->value.str, TypeInt, val_rtrn);
|
||||
ok = lookup(ctx, lookupPriv, expr->value.str, TypeInt, val_rtrn);
|
||||
if (!ok)
|
||||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||
xkb_atom_text(context, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return ok;
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type int is unknown\n",
|
||||
xkb_atom_text(context, expr->value.field.element),
|
||||
xkb_atom_text(context, expr->value.field.field));
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
case ExprArrayRef:
|
||||
bogus = "array reference";
|
||||
|
@ -902,8 +902,8 @@ ExprResolveMaskLookup(struct xkb_context *context, ExprDef *expr,
|
|||
case OpDivide:
|
||||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveMaskLookup(context, left, &leftRtrn, lookup, lookupPriv) &&
|
||||
ExprResolveMaskLookup(context, right, &rightRtrn, lookup, lookupPriv))
|
||||
if (ExprResolveMaskLookup(ctx, left, &leftRtrn, lookup, lookupPriv) &&
|
||||
ExprResolveMaskLookup(ctx, right, &rightRtrn, lookup, lookupPriv))
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
|
@ -928,7 +928,7 @@ ExprResolveMaskLookup(struct xkb_context *context, ExprDef *expr,
|
|||
break;
|
||||
case OpInvert:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveIntegerLookup(context, left, &leftRtrn, lookup,
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||
lookupPriv))
|
||||
{
|
||||
val_rtrn->ival = ~leftRtrn.ival;
|
||||
|
@ -939,7 +939,7 @@ ExprResolveMaskLookup(struct xkb_context *context, ExprDef *expr,
|
|||
case OpNegate:
|
||||
case OpNot:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveIntegerLookup(context, left, &leftRtrn, lookup,
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||
lookupPriv))
|
||||
{
|
||||
ERROR("The %s operator cannot be used with a mask\n",
|
||||
|
@ -954,29 +954,29 @@ ExprResolveMaskLookup(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
|
||||
int
|
||||
ExprResolveMask(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveMask(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, const LookupEntry *values)
|
||||
{
|
||||
return ExprResolveMaskLookup(context, expr, val_rtrn, SimpleLookup, values);
|
||||
return ExprResolveMaskLookup(ctx, expr, val_rtrn, SimpleLookup, values);
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveModMask(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveModMask(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
return ExprResolveMaskLookup(context, expr, val_rtrn, LookupModMask, NULL);
|
||||
return ExprResolveMaskLookup(ctx, expr, val_rtrn, LookupModMask, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveVModMask(ExprDef *expr, ExprResult *val_rtrn,
|
||||
struct xkb_keymap *keymap)
|
||||
{
|
||||
return ExprResolveMaskLookup(keymap->context, expr, val_rtrn,
|
||||
LookupVModMask, keymap);
|
||||
return ExprResolveMaskLookup(keymap->ctx, expr, val_rtrn, LookupVModMask,
|
||||
keymap);
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveKeySym(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveKeySym(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn)
|
||||
{
|
||||
int ok = 0;
|
||||
|
@ -985,7 +985,7 @@ ExprResolveKeySym(struct xkb_context *context, ExprDef *expr,
|
|||
if (expr->op == ExprIdent)
|
||||
{
|
||||
const char *str;
|
||||
str = xkb_atom_text(context, expr->value.str);
|
||||
str = xkb_atom_text(ctx, expr->value.str);
|
||||
if (str) {
|
||||
sym = xkb_keysym_from_name(str);
|
||||
if (sym != XKB_KEYSYM_NO_SYMBOL) {
|
||||
|
@ -994,7 +994,7 @@ ExprResolveKeySym(struct xkb_context *context, ExprDef *expr,
|
|||
}
|
||||
}
|
||||
}
|
||||
ok = ExprResolveInteger(context, expr, val_rtrn);
|
||||
ok = ExprResolveInteger(ctx, expr, val_rtrn);
|
||||
if ((ok) && (val_rtrn->uval < 10))
|
||||
val_rtrn->uval += '0';
|
||||
return ok;
|
||||
|
|
|
@ -53,19 +53,19 @@ extern const char *
|
|||
exprOpText(unsigned type);
|
||||
|
||||
extern bool
|
||||
LookupModMask(struct xkb_context *context, const void *priv, xkb_atom_t field,
|
||||
LookupModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn);
|
||||
|
||||
extern bool
|
||||
LookupVModMask(struct xkb_context *context, const void *priv, xkb_atom_t field,
|
||||
LookupVModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn);
|
||||
|
||||
extern bool
|
||||
LookupModIndex(struct xkb_context *context, const void *priv, xkb_atom_t field,
|
||||
LookupModIndex(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveModMask(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveModMask(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
|
@ -73,51 +73,51 @@ ExprResolveVModMask(ExprDef *expr, ExprResult *val_rtrn,
|
|||
struct xkb_keymap *keymap);
|
||||
|
||||
extern int
|
||||
ExprResolveBoolean(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveBoolean(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveKeyCode(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveKeyCode(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveInteger(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveInteger(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveLevel(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveLevel(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveGroup(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveGroup(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveButton(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveButton(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveFloat(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveFloat(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveString(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveString(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveKeyName(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveKeyName(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveEnum(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveEnum(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, const LookupEntry *values);
|
||||
|
||||
extern int
|
||||
ExprResolveMask(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveMask(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, const LookupEntry *values);
|
||||
|
||||
extern int
|
||||
ExprResolveKeySym(struct xkb_context *context, ExprDef *expr,
|
||||
ExprResolveKeySym(struct xkb_ctx *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
#endif /* EXPR_H */
|
||||
|
|
|
@ -32,17 +32,17 @@
|
|||
|
||||
#define ReportIndicatorBadType(keymap, l, f, w) \
|
||||
ReportBadType("indicator map", (f), \
|
||||
xkb_atom_text((keymap)->context, (l)->name), (w))
|
||||
xkb_atom_text((keymap)->ctx, (l)->name), (w))
|
||||
#define ReportIndicatorNotArray(keymap, l, f) \
|
||||
ReportNotArray("indicator map", (f), \
|
||||
xkb_atom_text((keymap)->context, (l)->name))
|
||||
xkb_atom_text((keymap)->ctx, (l)->name))
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
void
|
||||
ClearIndicatorMapInfo(struct xkb_context *context, LEDInfo * info)
|
||||
ClearIndicatorMapInfo(struct xkb_ctx *ctx, LEDInfo * info)
|
||||
{
|
||||
info->name = xkb_atom_intern(context, "default");
|
||||
info->name = xkb_atom_intern(ctx, "default");
|
||||
info->indicator = _LED_NotBound;
|
||||
info->flags = info->which_mods = info->real_mods = 0;
|
||||
info->vmods = 0;
|
||||
|
@ -78,7 +78,7 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
&& (warningLevel > 0)) || (warningLevel > 9))
|
||||
{
|
||||
WARN("Map for indicator %s redefined\n",
|
||||
xkb_atom_text(keymap->context, old->name));
|
||||
xkb_atom_text(keymap->ctx, old->name));
|
||||
ACTION("Earlier definition ignored\n");
|
||||
}
|
||||
*old = *new;
|
||||
|
@ -130,7 +130,7 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
if (collide)
|
||||
{
|
||||
WARN("Map for indicator %s redefined\n",
|
||||
xkb_atom_text(keymap->context, old->name));
|
||||
xkb_atom_text(keymap->ctx, old->name));
|
||||
ACTION("Using %s definition for duplicate fields\n",
|
||||
(new->defs.merge == MergeAugment ? "first" : "last"));
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
{
|
||||
WSGO("Couldn't allocate indicator map\n");
|
||||
ACTION("Map for indicator %s not compiled\n",
|
||||
xkb_atom_text(keymap->context, new->name));
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
return NULL;
|
||||
}
|
||||
*old = *new;
|
||||
|
@ -215,7 +215,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveMask(keymap->context, value, &rtrn, groupNames))
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, groupNames))
|
||||
return ReportIndicatorBadType(keymap, led, field, "group mask");
|
||||
led->groups = rtrn.uval;
|
||||
led->defs.defined |= _LED_Groups;
|
||||
|
@ -225,7 +225,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveMask(keymap->context, value, &rtrn, ctrlNames))
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, ctrlNames))
|
||||
return ReportIndicatorBadType(keymap, led, field,
|
||||
"controls mask");
|
||||
led->ctrls = rtrn.uval;
|
||||
|
@ -235,7 +235,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveBoolean(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
return ReportIndicatorBadType(keymap, led, field, "boolean");
|
||||
if (rtrn.uval)
|
||||
led->flags &= ~XkbIM_NoExplicit;
|
||||
|
@ -248,7 +248,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveMask(keymap->context, value, &rtrn, modComponentNames))
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, modComponentNames))
|
||||
{
|
||||
return ReportIndicatorBadType(keymap, led, field,
|
||||
"mask of modifier state components");
|
||||
|
@ -259,7 +259,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveMask(keymap->context, value, &rtrn, groupComponentNames))
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, groupComponentNames))
|
||||
{
|
||||
return ReportIndicatorBadType(keymap, led, field,
|
||||
"mask of group state components");
|
||||
|
@ -275,7 +275,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveBoolean(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
return ReportIndicatorBadType(keymap, led, field, "boolean");
|
||||
if (rtrn.uval)
|
||||
led->flags |= XkbIM_LEDDrivesKB;
|
||||
|
@ -287,7 +287,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveInteger(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportIndicatorBadType(keymap, led, field,
|
||||
"indicator index");
|
||||
if ((rtrn.uval < 1) || (rtrn.uval > 32))
|
||||
|
@ -295,7 +295,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
ERROR("Illegal indicator index %d (range 1..%d)\n",
|
||||
rtrn.uval, XkbNumIndicators);
|
||||
ACTION("Index definition for %s indicator ignored\n",
|
||||
xkb_atom_text(keymap->context, led->name));
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
return false;
|
||||
}
|
||||
led->indicator = rtrn.uval;
|
||||
|
@ -304,7 +304,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
else
|
||||
{
|
||||
ERROR("Unknown field %s in map for %s indicator\n", field,
|
||||
xkb_atom_text(keymap->context, led->name));
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
ACTION("Definition ignored\n");
|
||||
ok = false;
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds,
|
|||
{
|
||||
free(UNCONSTIFY(keymap->names->indicators[led->indicator - 1]));
|
||||
keymap->names->indicators[led->indicator-1] =
|
||||
xkb_atom_strdup(keymap->context, led->name);
|
||||
xkb_atom_strdup(keymap->ctx, led->name);
|
||||
}
|
||||
free(led);
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
|
|||
{
|
||||
if (keymap->names->indicators[i] &&
|
||||
strcmp(keymap->names->indicators[i],
|
||||
xkb_atom_text(keymap->context, led->name)) == 0)
|
||||
xkb_atom_text(keymap->ctx, led->name)) == 0)
|
||||
{
|
||||
led->indicator = i + 1;
|
||||
break;
|
||||
|
@ -468,7 +468,7 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
|
|||
if (keymap->names->indicators[i] == NULL)
|
||||
{
|
||||
keymap->names->indicators[i] =
|
||||
xkb_atom_strdup(keymap->context, led->name);
|
||||
xkb_atom_strdup(keymap->ctx, led->name);
|
||||
led->indicator = i + 1;
|
||||
break;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
|
|||
ERROR("No unnamed indicators found\n");
|
||||
ACTION
|
||||
("Virtual indicator map \"%s\" not bound\n",
|
||||
xkb_atom_text(keymap->context, led->name));
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -508,13 +508,13 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
|
|||
{
|
||||
if ((keymap->names != NULL) &&
|
||||
(strcmp(keymap->names->indicators[led->indicator - 1],
|
||||
xkb_atom_text(keymap->context, led->name)) != 0))
|
||||
xkb_atom_text(keymap->ctx, led->name)) != 0))
|
||||
{
|
||||
const char *old = keymap->names->indicators[led->indicator - 1];
|
||||
ERROR("Multiple names bound to indicator %d\n",
|
||||
(unsigned int) led->indicator);
|
||||
ACTION("Using %s, ignoring %s\n", old,
|
||||
xkb_atom_text(keymap->context, led->name));
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
led->indicator = _LED_NotBound;
|
||||
if (force)
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef struct _LEDInfo
|
|||
} LEDInfo;
|
||||
|
||||
extern void
|
||||
ClearIndicatorMapInfo(struct xkb_context *context, LEDInfo *info);
|
||||
ClearIndicatorMapInfo(struct xkb_ctx *ctx, LEDInfo *info);
|
||||
|
||||
|
||||
extern LEDInfo *
|
||||
|
|
|
@ -208,7 +208,7 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap,
|
|||
|| (warningLevel > 9))
|
||||
{
|
||||
WARN("Multiple indicators named %s\n",
|
||||
xkb_atom_text(keymap->context, new->name));
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
if (old->ndx == new->ndx)
|
||||
{
|
||||
if (old->virtual != new->virtual)
|
||||
|
@ -286,8 +286,8 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap,
|
|||
ignoring = new->name;
|
||||
}
|
||||
ACTION("Using %s %s, ignoring %s %s\n",
|
||||
oldType, xkb_atom_text(keymap->context, using),
|
||||
newType, xkb_atom_text(keymap->context, ignoring));
|
||||
oldType, xkb_atom_text(keymap->ctx, using),
|
||||
newType, xkb_atom_text(keymap->ctx, ignoring));
|
||||
}
|
||||
}
|
||||
if (replace)
|
||||
|
@ -565,8 +565,8 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
info->explicitMax = XKB_KEYCODE_MAX;
|
||||
return (info->errorCount == 0);
|
||||
} /* parse file, store returned info in the xkb struct */
|
||||
else if (ProcessIncludeFile(keymap->context, stmt, XkmKeyNamesIndex,
|
||||
&rtrn, &newMerge))
|
||||
else if (ProcessIncludeFile(keymap->ctx, stmt, XkmKeyNamesIndex, &rtrn,
|
||||
&newMerge))
|
||||
{
|
||||
InitKeyNamesInfo(&included);
|
||||
HandleKeycodesFile(rtrn, keymap, MergeOverride, &included);
|
||||
|
@ -598,8 +598,8 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
MergeIncludedKeycodes(&included, keymap, info, next->merge);
|
||||
ClearKeyNamesInfo(info);
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->context, next,
|
||||
XkmKeyNamesIndex, &rtrn, &op))
|
||||
else if (ProcessIncludeFile(keymap->ctx, next, XkmKeyNamesIndex,
|
||||
&rtrn, &op))
|
||||
{
|
||||
InitKeyNamesInfo(&next_incl);
|
||||
HandleKeycodesFile(rtrn, keymap, MergeOverride, &next_incl);
|
||||
|
@ -694,7 +694,7 @@ HandleKeyNameVar(VarDef *stmt, struct xkb_keymap *keymap, KeyNamesInfo *info)
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
if (ExprResolveKeyCode(keymap->context, stmt->value, &tmp) == 0)
|
||||
if (ExprResolveKeyCode(keymap->ctx, stmt->value, &tmp) == 0)
|
||||
{
|
||||
ACTION("Assignment to field %s ignored\n", field.str);
|
||||
goto err_out;
|
||||
|
@ -771,14 +771,14 @@ HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
|
|||
}
|
||||
InitIndicatorNameInfo(&ii, info);
|
||||
ii.ndx = def->ndx;
|
||||
if (!ExprResolveString(keymap->context, def->name, &tmp))
|
||||
if (!ExprResolveString(keymap->ctx, def->name, &tmp))
|
||||
{
|
||||
char buf[20];
|
||||
snprintf(buf, sizeof(buf), "%d", def->ndx);
|
||||
info->errorCount++;
|
||||
return ReportBadType("indicator", "name", buf, "string");
|
||||
}
|
||||
ii.name = xkb_atom_intern(keymap->context, tmp.str);
|
||||
ii.name = xkb_atom_intern(keymap->ctx, tmp.str);
|
||||
free(tmp.str);
|
||||
ii.virtual = def->virtual;
|
||||
if (!AddIndicatorName(info, keymap, &ii))
|
||||
|
@ -913,7 +913,7 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge)
|
|||
for (ii = info.leds; ii; ii = (IndicatorNameInfo *)ii->defs.next) {
|
||||
free(UNCONSTIFY(keymap->names->indicators[ii->ndx - 1]));
|
||||
keymap->names->indicators[ii->ndx - 1] =
|
||||
xkb_atom_strdup(keymap->context, ii->name);
|
||||
xkb_atom_strdup(keymap->ctx, ii->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
* XkmKeyNamesIdx, etc.)
|
||||
*/
|
||||
struct xkb_keymap *
|
||||
CompileKeymap(struct xkb_context *context, XkbFile *file)
|
||||
CompileKeymap(struct xkb_ctx *ctx, XkbFile *file)
|
||||
{
|
||||
unsigned have;
|
||||
bool ok;
|
||||
|
@ -41,7 +41,7 @@ CompileKeymap(struct xkb_context *context, XkbFile *file)
|
|||
unsigned mainType;
|
||||
const char *mainName;
|
||||
LEDInfo *unbound = NULL, *next;
|
||||
struct xkb_keymap *keymap = XkbcAllocKeyboard(context);
|
||||
struct xkb_keymap *keymap = XkbcAllocKeyboard(ctx);
|
||||
struct {
|
||||
XkbFile *keycodes;
|
||||
XkbFile *types;
|
||||
|
|
|
@ -94,7 +94,7 @@ static xkb_atom_t tok_KEYPAD;
|
|||
#define PreserveTxt(x, p) \
|
||||
XkbcVModMaskText((x), (p)->preMods, (p)->preVMods)
|
||||
#define TypeTxt(keymap, t) \
|
||||
xkb_atom_text((keymap)->context, (t)->name)
|
||||
xkb_atom_text((keymap)->ctx, (t)->name)
|
||||
#define TypeMaskTxt(t, x) \
|
||||
XkbcVModMaskText((x), (t)->mask, (t)->vmask)
|
||||
|
||||
|
@ -104,10 +104,10 @@ static void
|
|||
InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap,
|
||||
KeyTypesInfo *from)
|
||||
{
|
||||
tok_ONE_LEVEL = xkb_atom_intern(keymap->context, "ONE_LEVEL");
|
||||
tok_TWO_LEVEL = xkb_atom_intern(keymap->context, "TWO_LEVEL");
|
||||
tok_ALPHABETIC = xkb_atom_intern(keymap->context, "ALPHABETIC");
|
||||
tok_KEYPAD = xkb_atom_intern(keymap->context, "KEYPAD");
|
||||
tok_ONE_LEVEL = xkb_atom_intern(keymap->ctx, "ONE_LEVEL");
|
||||
tok_TWO_LEVEL = xkb_atom_intern(keymap->ctx, "TWO_LEVEL");
|
||||
tok_ALPHABETIC = xkb_atom_intern(keymap->ctx, "ALPHABETIC");
|
||||
tok_KEYPAD = xkb_atom_intern(keymap->ctx, "KEYPAD");
|
||||
info->name = strdup("default");
|
||||
info->errorCount = 0;
|
||||
info->stdPresent = 0;
|
||||
|
@ -289,7 +289,7 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
|||
&& (warningLevel > 0)) || (warningLevel > 9))
|
||||
{
|
||||
WARN("Multiple definitions of the %s key type\n",
|
||||
xkb_atom_text(keymap->context, new->name));
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
ACTION("Earlier definition ignored\n");
|
||||
}
|
||||
FreeKeyTypeInfo(old);
|
||||
|
@ -305,7 +305,7 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
|||
if (report)
|
||||
{
|
||||
WARN("Multiple definitions of the %s key type\n",
|
||||
xkb_atom_text(keymap->context, new->name));
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
ACTION("Later definition ignored\n");
|
||||
}
|
||||
FreeKeyTypeInfo(new);
|
||||
|
@ -371,7 +371,7 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
included = *info;
|
||||
memset(info, 0, sizeof(KeyTypesInfo));
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->context, stmt, XkmTypesIndex, &rtrn,
|
||||
else if (ProcessIncludeFile(keymap->ctx, stmt, XkmTypesIndex, &rtrn,
|
||||
&newMerge))
|
||||
{
|
||||
InitKeyTypesInfo(&included, keymap, info);
|
||||
|
@ -406,7 +406,7 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
MergeIncludedKeyTypes(&included, info, next->merge, keymap);
|
||||
FreeKeyTypesInfo(info);
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->context, next, XkmTypesIndex,
|
||||
else if (ProcessIncludeFile(keymap->ctx, next, XkmTypesIndex,
|
||||
&rtrn, &op))
|
||||
{
|
||||
InitKeyTypesInfo(&next_incl, keymap, &included);
|
||||
|
@ -659,7 +659,7 @@ SetMapEntry(KeyTypeInfo *type, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
|||
entry.mods.real_mods &= type->mask;
|
||||
entry.mods.vmods &= type->vmask;
|
||||
}
|
||||
if (!ExprResolveLevel(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveLevel(keymap->ctx, value, &rtrn))
|
||||
{
|
||||
ERROR("Level specifications in a key type must be integer\n");
|
||||
ACTION("Ignoring malformed level specification\n");
|
||||
|
@ -761,8 +761,8 @@ AddLevelName(struct xkb_keymap *keymap, KeyTypeInfo *type,
|
|||
if (warningLevel > 0)
|
||||
{
|
||||
const char *old, *new;
|
||||
old = xkb_atom_text(keymap->context, type->lvlNames[level]);
|
||||
new = xkb_atom_text(keymap->context, name);
|
||||
old = xkb_atom_text(keymap->ctx, type->lvlNames[level]);
|
||||
new = xkb_atom_text(keymap->ctx, name);
|
||||
WARN("Multiple names for level %d of key type %s\n",
|
||||
level + 1, TypeTxt(keymap, type));
|
||||
if (clobber)
|
||||
|
@ -789,17 +789,17 @@ SetLevelName(KeyTypeInfo *type, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
|||
|
||||
if (arrayNdx == NULL)
|
||||
return ReportTypeShouldBeArray(keymap, type, "level name");
|
||||
if (!ExprResolveLevel(keymap->context, arrayNdx, &rtrn))
|
||||
if (!ExprResolveLevel(keymap->ctx, arrayNdx, &rtrn))
|
||||
return ReportTypeBadType(keymap, type, "level name", "integer");
|
||||
level = rtrn.ival - 1;
|
||||
if (!ExprResolveString(keymap->context, value, &rtrn))
|
||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
||||
{
|
||||
ERROR("Non-string name for level %d in key type %s\n", level + 1,
|
||||
xkb_atom_text(keymap->context, type->name));
|
||||
xkb_atom_text(keymap->ctx, type->name));
|
||||
ACTION("Ignoring illegal level name definition\n");
|
||||
return false;
|
||||
}
|
||||
level_name = xkb_atom_intern(keymap->context, rtrn.str);
|
||||
level_name = xkb_atom_intern(keymap->ctx, rtrn.str);
|
||||
free(rtrn.str);
|
||||
return AddLevelName(keymap, type, level, level_name, true);
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ SetKeyTypeField(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
|||
if (type->defs.defined & _KT_Mask)
|
||||
{
|
||||
WARN("Multiple modifier mask definitions for key type %s\n",
|
||||
xkb_atom_text(keymap->context, type->name));
|
||||
xkb_atom_text(keymap->ctx, type->name));
|
||||
ACTION("Using %s, ", TypeMaskTxt(type, keymap));
|
||||
INFO("ignoring %s\n", XkbcVModMaskText(keymap, mods, vmods));
|
||||
return false;
|
||||
|
@ -1102,7 +1102,7 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
|||
{
|
||||
WARN("Couldn't allocate preserve array in CopyDefToKeyType\n");
|
||||
ACTION("Preserve setting for type %s lost\n",
|
||||
xkb_atom_text(keymap->context, def->name));
|
||||
xkb_atom_text(keymap->ctx, def->name));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1118,7 +1118,7 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
|||
}
|
||||
else
|
||||
type->preserve = NULL;
|
||||
type->name = xkb_atom_strdup(keymap->context, def->name);
|
||||
type->name = xkb_atom_strdup(keymap->ctx, def->name);
|
||||
if (def->szNames > 0)
|
||||
{
|
||||
type->level_names = uTypedCalloc(def->numLevels, const char *);
|
||||
|
@ -1126,7 +1126,7 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
|||
/* assert def->szNames<=def->numLevels */
|
||||
for (i = 0; i < def->szNames; i++)
|
||||
{
|
||||
type->level_names[i] = xkb_atom_strdup(keymap->context,
|
||||
type->level_names[i] = xkb_atom_strdup(keymap->ctx,
|
||||
def->lvlNames[i]);
|
||||
}
|
||||
}
|
||||
|
@ -1186,16 +1186,16 @@ CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge)
|
|||
|
||||
if (missing & XkbOneLevelMask)
|
||||
keymap->map->types[XkbOneLevelIndex].name =
|
||||
xkb_atom_strdup(keymap->context, tok_ONE_LEVEL);
|
||||
xkb_atom_strdup(keymap->ctx, tok_ONE_LEVEL);
|
||||
if (missing & XkbTwoLevelMask)
|
||||
keymap->map->types[XkbTwoLevelIndex].name =
|
||||
xkb_atom_strdup(keymap->context, tok_TWO_LEVEL);
|
||||
xkb_atom_strdup(keymap->ctx, tok_TWO_LEVEL);
|
||||
if (missing & XkbAlphabeticMask)
|
||||
keymap->map->types[XkbAlphabeticIndex].name =
|
||||
xkb_atom_strdup(keymap->context, tok_ALPHABETIC);
|
||||
xkb_atom_strdup(keymap->ctx, tok_ALPHABETIC);
|
||||
if (missing & XkbKeypadMask)
|
||||
keymap->map->types[XkbKeypadIndex].name =
|
||||
xkb_atom_strdup(keymap->context, tok_KEYPAD);
|
||||
xkb_atom_strdup(keymap->ctx, tok_KEYPAD);
|
||||
}
|
||||
|
||||
next = &keymap->map->types[XkbLastRequiredType + 1];
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* If the statement defines a specific map to use, this map is returned in
|
||||
* file_rtrn. Otherwise, the default map is returned.
|
||||
*
|
||||
* @param context The context containing include paths
|
||||
* @param ctx The ctx containing include paths
|
||||
* @param stmt The include statement, specifying the file name to look for.
|
||||
* @param file_type Type of file (XkmKeyNamesIdx, etc.)
|
||||
* @param file_rtrn Returns the key map to be used.
|
||||
|
@ -44,7 +44,7 @@
|
|||
* @return true on success or false otherwise.
|
||||
*/
|
||||
bool
|
||||
ProcessIncludeFile(struct xkb_context *context,
|
||||
ProcessIncludeFile(struct xkb_ctx *ctx,
|
||||
IncludeStmt * stmt,
|
||||
unsigned file_type,
|
||||
XkbFile ** file_rtrn, unsigned *merge_rtrn)
|
||||
|
@ -52,7 +52,7 @@ ProcessIncludeFile(struct xkb_context *context,
|
|||
FILE *file;
|
||||
XkbFile *rtrn, *mapToUse, *next;
|
||||
|
||||
file = XkbFindFileInPath(context, stmt->file, file_type, &stmt->path);
|
||||
file = XkbFindFileInPath(ctx, stmt->file, file_type, &stmt->path);
|
||||
if (file == NULL)
|
||||
{
|
||||
ERROR("Can't find file \"%s\" for %s include\n", stmt->file,
|
||||
|
@ -61,7 +61,7 @@ ProcessIncludeFile(struct xkb_context *context,
|
|||
}
|
||||
|
||||
|
||||
if (!XKBParseFile(context, file, stmt->file, &rtrn))
|
||||
if (!XKBParseFile(ctx, file, stmt->file, &rtrn))
|
||||
{
|
||||
ERROR("Error interpreting include file \"%s\"\n", stmt->file);
|
||||
fclose(file);
|
||||
|
|
|
@ -176,7 +176,7 @@ XkbCompositeMap : OptFlags XkbCompositeType OptMapName OBRACE
|
|||
XkbMapConfigList
|
||||
CBRACE SEMI
|
||||
{
|
||||
$$ = CreateXKBFile(param->context, $2, $3,
|
||||
$$ = CreateXKBFile(param->ctx, $2, $3,
|
||||
&$5->common, $1);
|
||||
}
|
||||
;
|
||||
|
@ -209,7 +209,7 @@ XkbMapConfig : OptFlags FileType OptMapName OBRACE
|
|||
}
|
||||
else
|
||||
{
|
||||
$$ = CreateXKBFile(param->context, $2, $3, $5, $1);
|
||||
$$ = CreateXKBFile(param->ctx, $2, $3, $5, $1);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -224,7 +224,7 @@ XkbConfig : OptFlags FileType OptMapName DeclList
|
|||
}
|
||||
else
|
||||
{
|
||||
$$ = CreateXKBFile(param->context, $2, $3, $4, $1);
|
||||
$$ = CreateXKBFile(param->ctx, $2, $3, $4, $1);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -563,21 +563,21 @@ FieldSpec : Ident { $$= $1; }
|
|||
;
|
||||
|
||||
Element : ACTION_TOK
|
||||
{ $$= xkb_atom_intern(param->context, "action"); }
|
||||
{ $$= xkb_atom_intern(param->ctx, "action"); }
|
||||
| INTERPRET
|
||||
{ $$= xkb_atom_intern(param->context, "interpret"); }
|
||||
{ $$= xkb_atom_intern(param->ctx, "interpret"); }
|
||||
| TYPE
|
||||
{ $$= xkb_atom_intern(param->context, "type"); }
|
||||
{ $$= xkb_atom_intern(param->ctx, "type"); }
|
||||
| KEY
|
||||
{ $$= xkb_atom_intern(param->context, "key"); }
|
||||
{ $$= xkb_atom_intern(param->ctx, "key"); }
|
||||
| GROUP
|
||||
{ $$= xkb_atom_intern(param->context, "group"); }
|
||||
{ $$= xkb_atom_intern(param->ctx, "group"); }
|
||||
| MODIFIER_MAP
|
||||
{$$= xkb_atom_intern(param->context, "modifier_map");}
|
||||
{$$= xkb_atom_intern(param->ctx, "modifier_map");}
|
||||
| INDICATOR
|
||||
{ $$= xkb_atom_intern(param->context, "indicator"); }
|
||||
{ $$= xkb_atom_intern(param->ctx, "indicator"); }
|
||||
| SHAPE
|
||||
{ $$= xkb_atom_intern(param->context, "shape"); }
|
||||
{ $$= xkb_atom_intern(param->ctx, "shape"); }
|
||||
| ROW
|
||||
{ $$= XKB_ATOM_NONE; }
|
||||
| SECTION
|
||||
|
@ -769,18 +769,18 @@ KeyName : KEYNAME { $$= $1; }
|
|||
|
||||
Ident : IDENT
|
||||
{
|
||||
$$ = xkb_atom_intern(param->context, $1);
|
||||
$$ = xkb_atom_intern(param->ctx, $1);
|
||||
free($1);
|
||||
}
|
||||
| DEFAULT
|
||||
{
|
||||
$$ = xkb_atom_intern(param->context, "default");
|
||||
$$ = xkb_atom_intern(param->ctx, "default");
|
||||
}
|
||||
;
|
||||
|
||||
String : STRING
|
||||
{
|
||||
$$ = xkb_atom_intern(param->context, $1);
|
||||
$$ = xkb_atom_intern(param->ctx, $1);
|
||||
free($1);
|
||||
}
|
||||
;
|
||||
|
|
|
@ -684,7 +684,7 @@ EnsureSafeMapName(char *name)
|
|||
}
|
||||
|
||||
XkbFile *
|
||||
CreateXKBFile(struct xkb_context *context, int type, char *name,
|
||||
CreateXKBFile(struct xkb_ctx *ctx, int type, char *name,
|
||||
ParseCommon *defs, unsigned flags)
|
||||
{
|
||||
XkbFile *file;
|
||||
|
@ -698,7 +698,7 @@ CreateXKBFile(struct xkb_context *context, int type, char *name,
|
|||
file->topName = uDupString(name);
|
||||
file->name = name;
|
||||
file->defs = defs;
|
||||
file->id = xkb_context_take_file_id(context);
|
||||
file->id = xkb_ctx_take_file_id(ctx);
|
||||
file->flags = flags;
|
||||
}
|
||||
return file;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "parser.h"
|
||||
|
||||
struct parser_param {
|
||||
struct xkb_context *context;
|
||||
struct xkb_ctx *ctx;
|
||||
void *scanner;
|
||||
XkbFile *rtrn;
|
||||
};
|
||||
|
@ -120,16 +120,16 @@ extern void
|
|||
CheckDefaultMap(XkbFile *maps, const char *fileName);
|
||||
|
||||
extern XkbFile *
|
||||
CreateXKBFile(struct xkb_context *context, int type, char *name,
|
||||
CreateXKBFile(struct xkb_ctx *ctx, int type, char *name,
|
||||
ParseCommon *defs, unsigned flags);
|
||||
|
||||
extern bool
|
||||
XKBParseFile(struct xkb_context *context, FILE *file,
|
||||
XKBParseFile(struct xkb_ctx *ctx, FILE *file,
|
||||
const char *file_name, XkbFile **out);
|
||||
|
||||
extern bool
|
||||
XKBParseString(struct xkb_context *context, const char *string,
|
||||
const char *file_name, XkbFile **out);
|
||||
XKBParseString(struct xkb_ctx *context, const char *string,
|
||||
const char *file_name, XkbFile **out);
|
||||
|
||||
extern void
|
||||
FreeXKBFile(XkbFile *file);
|
||||
|
|
|
@ -174,7 +174,7 @@ XkbDirectoryForInclude(unsigned type)
|
|||
/**
|
||||
* Search for the given file name in the include directories.
|
||||
*
|
||||
* @param context the XKB context containing the include paths
|
||||
* @param ctx the XKB ctx containing the include paths
|
||||
* @param type one of XkbTypesIndex, XkbCompatMapIndex, ..., or
|
||||
* XkbSemanticsFile, XkmKeymapFile, ...
|
||||
* @param pathReturn is set to the full path of the file if found.
|
||||
|
@ -183,7 +183,7 @@ XkbDirectoryForInclude(unsigned type)
|
|||
* pathRtrn is undefined.
|
||||
*/
|
||||
FILE *
|
||||
XkbFindFileInPath(struct xkb_context *context,
|
||||
XkbFindFileInPath(struct xkb_ctx *ctx,
|
||||
const char *name, unsigned type, char **pathRtrn)
|
||||
{
|
||||
size_t i;
|
||||
|
@ -193,21 +193,21 @@ XkbFindFileInPath(struct xkb_context *context,
|
|||
const char *typeDir;
|
||||
|
||||
typeDir = XkbDirectoryForInclude(type);
|
||||
for (i = 0; i < xkb_context_num_include_paths(context); i++)
|
||||
for (i = 0; i < xkb_ctx_num_include_paths(ctx); i++)
|
||||
{
|
||||
ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
|
||||
xkb_context_include_path_get(context, i), typeDir, name);
|
||||
xkb_ctx_include_path_get(ctx, i), typeDir, name);
|
||||
if (ret >= (ssize_t)sizeof(buf))
|
||||
{
|
||||
ERROR("File name (%s/%s/%s) too long\n",
|
||||
xkb_context_include_path_get(context, i), typeDir, name);
|
||||
xkb_ctx_include_path_get(ctx, i), typeDir, name);
|
||||
ACTION("Ignored\n");
|
||||
continue;
|
||||
}
|
||||
file = fopen(buf, "r");
|
||||
if (file == NULL) {
|
||||
ERROR("Couldn't open file (%s/%s/%s): %s\n",
|
||||
xkb_context_include_path_get(context, i), typeDir, name,
|
||||
xkb_ctx_include_path_get(ctx, i), typeDir, name,
|
||||
strerror(-errno));
|
||||
ACTION("Ignored\n");
|
||||
continue;
|
||||
|
|
|
@ -205,7 +205,7 @@ yyerror(struct YYLTYPE *loc, void *scanner, const char *msg)
|
|||
}
|
||||
|
||||
bool
|
||||
XKBParseString(struct xkb_context *context, const char *string,
|
||||
XKBParseString(struct xkb_ctx *ctx, const char *string,
|
||||
const char *file_name, XkbFile **out)
|
||||
{
|
||||
int ret;
|
||||
|
@ -216,7 +216,7 @@ XKBParseString(struct xkb_context *context, const char *string,
|
|||
if (string == NULL)
|
||||
return false;
|
||||
|
||||
param.context = context;
|
||||
param.ctx = ctx;
|
||||
|
||||
memset(&extra, 0, sizeof(extra));
|
||||
ret = yylex_init_extra(&extra, ¶m.scanner);
|
||||
|
@ -241,7 +241,7 @@ XKBParseString(struct xkb_context *context, const char *string,
|
|||
}
|
||||
|
||||
bool
|
||||
XKBParseFile(struct xkb_context *context, FILE *file,
|
||||
XKBParseFile(struct xkb_ctx *ctx, FILE *file,
|
||||
const char *file_name, XkbFile **out)
|
||||
{
|
||||
int ret;
|
||||
|
@ -251,7 +251,7 @@ XKBParseFile(struct xkb_context *context, FILE *file,
|
|||
if (!file)
|
||||
return false;
|
||||
|
||||
param.context = context;
|
||||
param.ctx = ctx;
|
||||
|
||||
memset(&extra, 0, sizeof(extra));
|
||||
ret = yylex_init_extra(&extra, ¶m.scanner);
|
||||
|
|
|
@ -663,8 +663,8 @@ MergeKeys(SymbolsInfo *info, struct xkb_keymap *keymap,
|
|||
("Multiple definitions for group %d type of key %s\n",
|
||||
i, longText(into->name));
|
||||
ACTION("Using %s, ignoring %s\n",
|
||||
xkb_atom_text(keymap->context, use),
|
||||
xkb_atom_text(keymap->context, ignore));
|
||||
xkb_atom_text(keymap->ctx, use),
|
||||
xkb_atom_text(keymap->ctx, ignore));
|
||||
}
|
||||
if ((from->defs.merge != MergeAugment)
|
||||
|| (into->types[i] == XKB_ATOM_NONE))
|
||||
|
@ -889,8 +889,8 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
included = *info;
|
||||
memset(info, 0, sizeof(SymbolsInfo));
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->context, stmt, XkmSymbolsIndex,
|
||||
&rtrn, &newMerge))
|
||||
else if (ProcessIncludeFile(keymap->ctx, stmt, XkmSymbolsIndex, &rtrn,
|
||||
&newMerge))
|
||||
{
|
||||
InitSymbolsInfo(&included, keymap);
|
||||
included.fileID = included.dflt.defs.fileID = rtrn->id;
|
||||
|
@ -931,8 +931,8 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
MergeIncludedSymbols(&included, info, next->merge, keymap);
|
||||
FreeSymbolsInfo(info);
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->context, next,
|
||||
XkmSymbolsIndex, &rtrn, &op))
|
||||
else if (ProcessIncludeFile(keymap->ctx, next, XkmSymbolsIndex,
|
||||
&rtrn, &op))
|
||||
{
|
||||
InitSymbolsInfo(&next_incl, keymap);
|
||||
next_incl.fileID = next_incl.dflt.defs.fileID = rtrn->id;
|
||||
|
@ -1009,7 +1009,7 @@ GetGroupIndex(KeyInfo *key, struct xkb_keymap *keymap,
|
|||
ACTION("Ignoring %s defined for extra groups\n", name);
|
||||
return false;
|
||||
}
|
||||
if (!ExprResolveGroup(keymap->context, arrayNdx, &tmp))
|
||||
if (!ExprResolveGroup(keymap->ctx, arrayNdx, &tmp))
|
||||
{
|
||||
ERROR("Illegal group index for %s of key %s\n", name,
|
||||
longText(key->name));
|
||||
|
@ -1070,7 +1070,7 @@ AddSymbolsToKey(KeyInfo *key, struct xkb_keymap *keymap,
|
|||
&key->syms[ndx][key->symsMapIndex[ndx][i] + j])) {
|
||||
WARN("Could not resolve keysym %s for key %s, group %d (%s), level %d\n",
|
||||
value->value.list.syms[i], longText(key->name), ndx + 1,
|
||||
xkb_atom_text(keymap->context, info->groupNames[ndx]), nSyms);
|
||||
xkb_atom_text(keymap->ctx, info->groupNames[ndx]), nSyms);
|
||||
while (--j >= 0)
|
||||
key->syms[ndx][key->symsMapIndex[ndx][i] + j] = NoSymbol;
|
||||
key->symsMapIndex[ndx][i] = -1;
|
||||
|
@ -1181,7 +1181,7 @@ SetSymbolsField(KeyInfo *key, struct xkb_keymap *keymap, char *field,
|
|||
if (strcasecmp(field, "type") == 0)
|
||||
{
|
||||
ExprResult ndx;
|
||||
if ((!ExprResolveString(keymap->context, value, &tmp))
|
||||
if ((!ExprResolveString(keymap->ctx, value, &tmp))
|
||||
&& (warningLevel > 0))
|
||||
{
|
||||
WARN("The type field of a key symbol map must be a string\n");
|
||||
|
@ -1189,10 +1189,10 @@ SetSymbolsField(KeyInfo *key, struct xkb_keymap *keymap, char *field,
|
|||
}
|
||||
if (arrayNdx == NULL)
|
||||
{
|
||||
key->dfltType = xkb_atom_intern(keymap->context, tmp.str);
|
||||
key->dfltType = xkb_atom_intern(keymap->ctx, tmp.str);
|
||||
key->defs.defined |= _Key_Type_Dflt;
|
||||
}
|
||||
else if (!ExprResolveGroup(keymap->context, arrayNdx, &ndx))
|
||||
else if (!ExprResolveGroup(keymap->ctx, arrayNdx, &ndx))
|
||||
{
|
||||
ERROR("Illegal group index for type of key %s\n",
|
||||
longText(key->name));
|
||||
|
@ -1202,8 +1202,7 @@ SetSymbolsField(KeyInfo *key, struct xkb_keymap *keymap, char *field,
|
|||
}
|
||||
else
|
||||
{
|
||||
key->types[ndx.uval - 1] = xkb_atom_intern(keymap->context,
|
||||
tmp.str);
|
||||
key->types[ndx.uval - 1] = xkb_atom_intern(keymap->ctx, tmp.str);
|
||||
key->typesDefined |= (1 << (ndx.uval - 1));
|
||||
}
|
||||
free(tmp.str);
|
||||
|
@ -1234,7 +1233,7 @@ SetSymbolsField(KeyInfo *key, struct xkb_keymap *keymap, char *field,
|
|||
(strcasecmp(field, "lock") == 0) ||
|
||||
(strcasecmp(field, "locks") == 0))
|
||||
{
|
||||
ok = ExprResolveEnum(keymap->context, value, &tmp, lockingEntries);
|
||||
ok = ExprResolveEnum(keymap->ctx, value, &tmp, lockingEntries);
|
||||
if (ok)
|
||||
key->behavior.type = tmp.uval;
|
||||
key->defs.defined |= _Key_Behavior;
|
||||
|
@ -1257,7 +1256,7 @@ SetSymbolsField(KeyInfo *key, struct xkb_keymap *keymap, char *field,
|
|||
(strcasecmp(field, "repeats") == 0) ||
|
||||
(strcasecmp(field, "repeat") == 0))
|
||||
{
|
||||
ok = ExprResolveEnum(keymap->context, value, &tmp, repeatEntries);
|
||||
ok = ExprResolveEnum(keymap->ctx, value, &tmp, repeatEntries);
|
||||
if (!ok)
|
||||
{
|
||||
ERROR("Illegal repeat setting for %s\n",
|
||||
|
@ -1271,7 +1270,7 @@ SetSymbolsField(KeyInfo *key, struct xkb_keymap *keymap, char *field,
|
|||
else if ((strcasecmp(field, "groupswrap") == 0) ||
|
||||
(strcasecmp(field, "wrapgroups") == 0))
|
||||
{
|
||||
ok = ExprResolveBoolean(keymap->context, value, &tmp);
|
||||
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
||||
if (!ok)
|
||||
{
|
||||
ERROR("Illegal groupsWrap setting for %s\n",
|
||||
|
@ -1288,7 +1287,7 @@ SetSymbolsField(KeyInfo *key, struct xkb_keymap *keymap, char *field,
|
|||
else if ((strcasecmp(field, "groupsclamp") == 0) ||
|
||||
(strcasecmp(field, "clampgroups") == 0))
|
||||
{
|
||||
ok = ExprResolveBoolean(keymap->context, value, &tmp);
|
||||
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
||||
if (!ok)
|
||||
{
|
||||
ERROR("Illegal groupsClamp setting for %s\n",
|
||||
|
@ -1305,7 +1304,7 @@ SetSymbolsField(KeyInfo *key, struct xkb_keymap *keymap, char *field,
|
|||
else if ((strcasecmp(field, "groupsredirect") == 0) ||
|
||||
(strcasecmp(field, "redirectgroups") == 0))
|
||||
{
|
||||
if (!ExprResolveGroup(keymap->context, value, &tmp))
|
||||
if (!ExprResolveGroup(keymap->ctx, value, &tmp))
|
||||
{
|
||||
ERROR("Illegal group index for redirect of key %s\n",
|
||||
longText(key->name));
|
||||
|
@ -1337,20 +1336,20 @@ SetGroupName(SymbolsInfo *info, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
|||
ACTION("Group name definition without array subscript ignored\n");
|
||||
return false;
|
||||
}
|
||||
if (!ExprResolveGroup(keymap->context, arrayNdx, &tmp))
|
||||
if (!ExprResolveGroup(keymap->ctx, arrayNdx, &tmp))
|
||||
{
|
||||
ERROR("Illegal index in group name definition\n");
|
||||
ACTION("Definition with non-integer array index ignored\n");
|
||||
return false;
|
||||
}
|
||||
if (!ExprResolveString(keymap->context, value, &name))
|
||||
if (!ExprResolveString(keymap->ctx, value, &name))
|
||||
{
|
||||
ERROR("Group name must be a string\n");
|
||||
ACTION("Illegal name for group %d ignored\n", tmp.uval);
|
||||
return false;
|
||||
}
|
||||
info->groupNames[tmp.uval - 1 + info->explicit_group] =
|
||||
xkb_atom_intern(keymap->context, name.str);
|
||||
xkb_atom_intern(keymap->ctx, name.str);
|
||||
free(name.str);
|
||||
|
||||
return true;
|
||||
|
@ -1380,7 +1379,7 @@ HandleSymbolsVar(VarDef *stmt, struct xkb_keymap *keymap, SymbolsInfo *info)
|
|||
&& ((strcasecmp(field.str, "groupswrap") == 0) ||
|
||||
(strcasecmp(field.str, "wrapgroups") == 0)))
|
||||
{
|
||||
if (!ExprResolveBoolean(keymap->context, stmt->value, &tmp))
|
||||
if (!ExprResolveBoolean(keymap->ctx, stmt->value, &tmp))
|
||||
{
|
||||
ERROR("Illegal setting for global groupsWrap\n");
|
||||
ACTION("Non-boolean value ignored\n");
|
||||
|
@ -1398,7 +1397,7 @@ HandleSymbolsVar(VarDef *stmt, struct xkb_keymap *keymap, SymbolsInfo *info)
|
|||
&& ((strcasecmp(field.str, "groupsclamp") == 0) ||
|
||||
(strcasecmp(field.str, "clampgroups") == 0)))
|
||||
{
|
||||
if (!ExprResolveBoolean(keymap->context, stmt->value, &tmp))
|
||||
if (!ExprResolveBoolean(keymap->ctx, stmt->value, &tmp))
|
||||
{
|
||||
ERROR("Illegal setting for global groupsClamp\n");
|
||||
ACTION("Non-boolean value ignored\n");
|
||||
|
@ -1416,7 +1415,7 @@ HandleSymbolsVar(VarDef *stmt, struct xkb_keymap *keymap, SymbolsInfo *info)
|
|||
&& ((strcasecmp(field.str, "groupsredirect") == 0) ||
|
||||
(strcasecmp(field.str, "redirectgroups") == 0)))
|
||||
{
|
||||
if (!ExprResolveGroup(keymap->context, stmt->value, &tmp))
|
||||
if (!ExprResolveGroup(keymap->ctx, stmt->value, &tmp))
|
||||
{
|
||||
ERROR("Illegal group index for global groupsRedirect\n");
|
||||
ACTION("Definition with non-integer group ignored\n");
|
||||
|
@ -1566,11 +1565,11 @@ HandleModMapDef(ModMapDef *def, struct xkb_keymap *keymap, SymbolsInfo *info)
|
|||
ExprResult rtrn;
|
||||
bool ok;
|
||||
|
||||
if (!LookupModIndex(keymap->context, NULL, def->modifier, TypeInt, &rtrn))
|
||||
if (!LookupModIndex(keymap->ctx, NULL, def->modifier, TypeInt, &rtrn))
|
||||
{
|
||||
ERROR("Illegal modifier map definition\n");
|
||||
ACTION("Ignoring map for non-modifier \"%s\"\n",
|
||||
xkb_atom_text(keymap->context, def->modifier));
|
||||
xkb_atom_text(keymap->ctx, def->modifier));
|
||||
return false;
|
||||
}
|
||||
ok = true;
|
||||
|
@ -1582,7 +1581,7 @@ HandleModMapDef(ModMapDef *def, struct xkb_keymap *keymap, SymbolsInfo *info)
|
|||
tmp.haveSymbol = false;
|
||||
tmp.u.keyName = KeyNameToLong(key->value.keyName);
|
||||
}
|
||||
else if (ExprResolveKeySym(keymap->context, key, &rtrn))
|
||||
else if (ExprResolveKeySym(keymap->ctx, key, &rtrn))
|
||||
{
|
||||
tmp.haveSymbol = true;
|
||||
tmp.u.keySym = rtrn.uval;
|
||||
|
@ -1699,7 +1698,7 @@ static bool
|
|||
FindNamedType(struct xkb_keymap *keymap, xkb_atom_t atom, unsigned *type_rtrn)
|
||||
{
|
||||
unsigned n;
|
||||
const char *name = xkb_atom_text(keymap->context, atom);
|
||||
const char *name = xkb_atom_text(keymap->ctx, atom);
|
||||
|
||||
if (keymap && keymap->map && keymap->map->types)
|
||||
{
|
||||
|
@ -1738,23 +1737,23 @@ FindAutomaticType(struct xkb_keymap *keymap, int width, xkb_keysym_t *syms,
|
|||
*autoType = false;
|
||||
if ((width == 1) || (width == 0))
|
||||
{
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->context, "ONE_LEVEL");
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->ctx, "ONE_LEVEL");
|
||||
*autoType = true;
|
||||
}
|
||||
else if (width == 2)
|
||||
{
|
||||
if (syms && XkbcKSIsLower(syms[0]) && XkbcKSIsUpper(syms[1]))
|
||||
{
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->context, "ALPHABETIC");
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->ctx, "ALPHABETIC");
|
||||
}
|
||||
else if (syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])))
|
||||
{
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->context, "KEYPAD");
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->ctx, "KEYPAD");
|
||||
*autoType = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->context, "TWO_LEVEL");
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->ctx, "TWO_LEVEL");
|
||||
*autoType = true;
|
||||
}
|
||||
}
|
||||
|
@ -1763,15 +1762,15 @@ FindAutomaticType(struct xkb_keymap *keymap, int width, xkb_keysym_t *syms,
|
|||
if (syms && XkbcKSIsLower(syms[0]) && XkbcKSIsUpper(syms[1]))
|
||||
if (XkbcKSIsLower(syms[2]) && XkbcKSIsUpper(syms[3]))
|
||||
*typeNameRtrn =
|
||||
xkb_atom_intern(keymap->context, "FOUR_LEVEL_ALPHABETIC");
|
||||
xkb_atom_intern(keymap->ctx, "FOUR_LEVEL_ALPHABETIC");
|
||||
else
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->context,
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->ctx,
|
||||
"FOUR_LEVEL_SEMIALPHABETIC");
|
||||
|
||||
else if (syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])))
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->context, "FOUR_LEVEL_KEYPAD");
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->ctx, "FOUR_LEVEL_KEYPAD");
|
||||
else
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->context, "FOUR_LEVEL");
|
||||
*typeNameRtrn = xkb_atom_intern(keymap->ctx, "FOUR_LEVEL");
|
||||
/* XXX: why not set autoType here? */
|
||||
}
|
||||
return ((width >= 0) && (width <= 4));
|
||||
|
@ -1985,7 +1984,7 @@ CopySymbolsDef(struct xkb_keymap *keymap, KeyInfo *key, int start_from)
|
|||
WARN("No automatic type for %d symbols\n",
|
||||
(unsigned int) key->numLevels[i]);
|
||||
ACTION("Using %s for the %s key (keycode %d)\n",
|
||||
xkb_atom_text(keymap->context, key->types[i]),
|
||||
xkb_atom_text(keymap->ctx, key->types[i]),
|
||||
longText(key->name), kc);
|
||||
}
|
||||
}
|
||||
|
@ -2000,7 +1999,7 @@ CopySymbolsDef(struct xkb_keymap *keymap, KeyInfo *key, int start_from)
|
|||
if (warningLevel >= 3)
|
||||
{
|
||||
WARN("Type \"%s\" is not defined\n",
|
||||
xkb_atom_text(keymap->context, key->types[i]));
|
||||
xkb_atom_text(keymap->ctx, key->types[i]));
|
||||
ACTION("Using TWO_LEVEL for the %s key (keycode %d)\n",
|
||||
longText(key->name), kc);
|
||||
}
|
||||
|
@ -2014,7 +2013,7 @@ CopySymbolsDef(struct xkb_keymap *keymap, KeyInfo *key, int start_from)
|
|||
{
|
||||
WARN("Type \"%s\" has %d levels, but %s has %d symbols\n",
|
||||
type->name, type->num_levels,
|
||||
xkb_atom_text(keymap->context, key->name), key->numLevels[i]);
|
||||
xkb_atom_text(keymap->ctx, key->name), key->numLevels[i]);
|
||||
ACTION("Ignoring extra symbols\n");
|
||||
}
|
||||
key->numLevels[i] = type->num_levels;
|
||||
|
@ -2223,7 +2222,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, unsigned merge)
|
|||
for (i = 0; i < XkbNumKbdGroups; i++) {
|
||||
if (info.groupNames[i] != XKB_ATOM_NONE) {
|
||||
free(UNCONSTIFY(keymap->names->groups[i]));
|
||||
keymap->names->groups[i] = xkb_atom_strdup(keymap->context,
|
||||
keymap->names->groups[i] = xkb_atom_strdup(keymap->ctx,
|
||||
info.groupNames[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, unsigned mergeMode,
|
|||
{
|
||||
if (names->vmods[i] &&
|
||||
strcmp(names->vmods[i],
|
||||
xkb_atom_text(keymap->context, stmt->name)) == 0)
|
||||
xkb_atom_text(keymap->ctx, stmt->name)) == 0)
|
||||
{ /* already defined */
|
||||
info->available |= bit;
|
||||
if (stmt->value == NULL)
|
||||
|
@ -92,16 +92,16 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, unsigned mergeMode,
|
|||
{
|
||||
const char *str1;
|
||||
const char *str2 = "";
|
||||
if (!ExprResolveModMask(keymap->context, stmt->value, &mod))
|
||||
if (!ExprResolveModMask(keymap->ctx, stmt->value, &mod))
|
||||
{
|
||||
str1 = xkb_atom_text(keymap->context, stmt->name);
|
||||
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
||||
ACTION("Declaration of %s ignored\n", str1);
|
||||
return false;
|
||||
}
|
||||
if (mod.uval == srv->vmods[i])
|
||||
return true;
|
||||
|
||||
str1 = xkb_atom_text(keymap->context, stmt->name);
|
||||
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
||||
WARN("Virtual modifier %s multiply defined\n", str1);
|
||||
str1 = XkbcModMaskText(srv->vmods[i], true);
|
||||
if (mergeMode == MergeOverride)
|
||||
|
@ -128,15 +128,15 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, unsigned mergeMode,
|
|||
info->defined |= (1 << nextFree);
|
||||
info->newlyDefined |= (1 << nextFree);
|
||||
info->available |= (1 << nextFree);
|
||||
names->vmods[nextFree] = xkb_atom_strdup(keymap->context, stmt->name);
|
||||
names->vmods[nextFree] = xkb_atom_strdup(keymap->ctx, stmt->name);
|
||||
if (stmt->value == NULL)
|
||||
return true;
|
||||
if (ExprResolveModMask(keymap->context, stmt->value, &mod))
|
||||
if (ExprResolveModMask(keymap->ctx, stmt->value, &mod))
|
||||
{
|
||||
srv->vmods[nextFree] = mod.uval;
|
||||
return true;
|
||||
}
|
||||
ACTION("Declaration of %s ignored\n", xkb_atom_text(keymap->context, stmt->name));
|
||||
ACTION("Declaration of %s ignored\n", xkb_atom_text(keymap->ctx, stmt->name));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
|
|||
unsigned type, ExprResult * val_rtrn)
|
||||
{
|
||||
int i;
|
||||
const char *name = xkb_atom_text(keymap->context, field);
|
||||
const char *name = xkb_atom_text(keymap->ctx, field);
|
||||
|
||||
if ((keymap == NULL) || (keymap->names == NULL) || (type != TypeInt))
|
||||
{
|
||||
|
@ -190,10 +190,10 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
|
|||
* undefined.
|
||||
*/
|
||||
bool
|
||||
LookupVModMask(struct xkb_context *context, const void *priv, xkb_atom_t field,
|
||||
LookupVModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn)
|
||||
{
|
||||
if (LookupModMask(context, NULL, field, type, val_rtrn))
|
||||
if (LookupModMask(ctx, NULL, field, type, val_rtrn))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -212,8 +212,8 @@ FindKeypadVMod(struct xkb_keymap *keymap)
|
|||
xkb_atom_t name;
|
||||
ExprResult rtrn;
|
||||
|
||||
name = xkb_atom_intern(keymap->context, "NumLock");
|
||||
if (keymap && LookupVModIndex(keymap, name, TypeInt, &rtrn))
|
||||
name = xkb_atom_intern(keymap->ctx, "NumLock");
|
||||
if ((keymap) && LookupVModIndex(keymap, name, TypeInt, &rtrn))
|
||||
{
|
||||
return rtrn.ival;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
|
|||
if (def->op == ExprIdent)
|
||||
{
|
||||
int i, bit;
|
||||
const char *name = xkb_atom_text(keymap->context, def->value.str);
|
||||
const char *name = xkb_atom_text(keymap->ctx, def->value.str);
|
||||
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1)
|
||||
{
|
||||
if ((info->available & bit) && names->vmods[i] &&
|
||||
|
@ -240,7 +240,7 @@ ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (ExprResolveInteger(keymap->context, def, val_rtrn))
|
||||
if (ExprResolveInteger(keymap->ctx, def, val_rtrn))
|
||||
{
|
||||
if (val_rtrn->uval < XkbNumVirtualMods)
|
||||
return true;
|
||||
|
|
|
@ -64,7 +64,7 @@ extern int
|
|||
ReportBadField(const char *type, const char *field, const char *name);
|
||||
|
||||
extern bool
|
||||
ProcessIncludeFile(struct xkb_context *context,
|
||||
ProcessIncludeFile(struct xkb_ctx *ctx,
|
||||
IncludeStmt *stmt, unsigned file_type, XkbFile **file_rtrn,
|
||||
unsigned *merge_rtrn);
|
||||
|
||||
|
@ -84,7 +84,7 @@ extern const char *
|
|||
XkbDirectoryForInclude(unsigned type);
|
||||
|
||||
extern FILE *
|
||||
XkbFindFileInPath(struct xkb_context *context, const char *name,
|
||||
XkbFindFileInPath(struct xkb_ctx *ctx, const char *name,
|
||||
unsigned type, char **pathRtrn);
|
||||
|
||||
extern bool
|
||||
|
|
|
@ -34,38 +34,38 @@ unsigned int warningLevel = 0;
|
|||
#define ISEMPTY(str) (!(str) || (strlen(str) == 0))
|
||||
|
||||
static XkbFile *
|
||||
XkbKeymapFileFromComponents(struct xkb_context *context,
|
||||
XkbKeymapFileFromComponents(struct xkb_ctx *ctx,
|
||||
const struct xkb_component_names *ktcsg)
|
||||
{
|
||||
XkbFile *keycodes, *types, *compat, *symbols;
|
||||
IncludeStmt *inc;
|
||||
|
||||
inc = IncludeCreate(ktcsg->keycodes, MergeDefault);
|
||||
keycodes = CreateXKBFile(context, XkmKeyNamesIndex, NULL,
|
||||
keycodes = CreateXKBFile(ctx, XkmKeyNamesIndex, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
|
||||
inc = IncludeCreate(ktcsg->types, MergeDefault);
|
||||
types = CreateXKBFile(context, XkmTypesIndex, NULL,
|
||||
types = CreateXKBFile(ctx, XkmTypesIndex, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
AppendStmt(&keycodes->common, &types->common);
|
||||
|
||||
inc = IncludeCreate(ktcsg->compat, MergeDefault);
|
||||
compat = CreateXKBFile(context, XkmCompatMapIndex, NULL,
|
||||
compat = CreateXKBFile(ctx, XkmCompatMapIndex, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
AppendStmt(&keycodes->common, &compat->common);
|
||||
|
||||
inc = IncludeCreate(ktcsg->symbols, MergeDefault);
|
||||
symbols = CreateXKBFile(context, XkmSymbolsIndex, NULL,
|
||||
symbols = CreateXKBFile(ctx, XkmSymbolsIndex, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
AppendStmt(&keycodes->common, &symbols->common);
|
||||
|
||||
return CreateXKBFile(context, XkmKeymapFile,
|
||||
return CreateXKBFile(ctx, XkmKeymapFile,
|
||||
ktcsg->keymap ? ktcsg->keymap : strdup(""),
|
||||
&keycodes->common, 0);
|
||||
}
|
||||
|
||||
static struct xkb_component_names *
|
||||
XkbComponentsFromRules(struct xkb_context *context,
|
||||
XkbComponentsFromRules(struct xkb_ctx *ctx,
|
||||
const char *rules,
|
||||
const XkbRF_VarDefsPtr defs)
|
||||
{
|
||||
|
@ -75,13 +75,13 @@ XkbComponentsFromRules(struct xkb_context *context,
|
|||
struct xkb_component_names * names = NULL;
|
||||
int i;
|
||||
|
||||
rulesFile = XkbFindFileInPath(context, rules, XkmRulesFile, &rulesPath);
|
||||
rulesFile = XkbFindFileInPath(ctx, rules, XkmRulesFile, &rulesPath);
|
||||
if (!rulesFile) {
|
||||
ERROR("could not find \"%s\" rules in XKB path\n", rules);
|
||||
ERROR("%d include paths searched:\n",
|
||||
xkb_context_num_include_paths(context));
|
||||
for (i = 0; i < xkb_context_num_include_paths(context); i++)
|
||||
ERROR("\t%s\n", xkb_context_include_path_get(context, i));
|
||||
xkb_ctx_num_include_paths(ctx));
|
||||
for (i = 0; i < xkb_ctx_num_include_paths(ctx); i++)
|
||||
ERROR("\t%s\n", xkb_ctx_include_path_get(ctx, i));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ unwind_file:
|
|||
}
|
||||
|
||||
_X_EXPORT struct xkb_keymap *
|
||||
xkb_map_new_from_names(struct xkb_context *context,
|
||||
xkb_map_new_from_names(struct xkb_ctx *ctx,
|
||||
const struct xkb_rule_names *rmlvo,
|
||||
enum xkb_map_compile_flags flags)
|
||||
{
|
||||
|
@ -138,14 +138,14 @@ xkb_map_new_from_names(struct xkb_context *context,
|
|||
defs.variant = rmlvo->variant;
|
||||
defs.options = rmlvo->options;
|
||||
|
||||
names = XkbComponentsFromRules(context, rmlvo->rules, &defs);
|
||||
names = XkbComponentsFromRules(ctx, rmlvo->rules, &defs);
|
||||
if (!names) {
|
||||
ERROR("failed to generate XKB components from rules \"%s\"\n",
|
||||
rmlvo->rules);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
keymap = xkb_map_new_from_kccgst(context, names, 0);
|
||||
keymap = xkb_map_new_from_kccgst(ctx, names, 0);
|
||||
|
||||
free(names->keymap);
|
||||
free(names->keycodes);
|
||||
|
@ -192,7 +192,7 @@ XkbChooseMap(XkbFile *file, const char *name)
|
|||
}
|
||||
|
||||
static struct xkb_keymap *
|
||||
compile_keymap(struct xkb_context *context, XkbFile *file)
|
||||
compile_keymap(struct xkb_ctx *ctx, XkbFile *file)
|
||||
{
|
||||
XkbFile *mapToUse;
|
||||
struct xkb_keymap *keymap = NULL;
|
||||
|
@ -212,7 +212,7 @@ compile_keymap(struct xkb_context *context, XkbFile *file)
|
|||
goto err;
|
||||
}
|
||||
|
||||
keymap = CompileKeymap(context, mapToUse);
|
||||
keymap = CompileKeymap(ctx, mapToUse);
|
||||
if (!keymap)
|
||||
goto err;
|
||||
|
||||
|
@ -222,7 +222,7 @@ err:
|
|||
}
|
||||
|
||||
_X_EXPORT struct xkb_keymap *
|
||||
xkb_map_new_from_kccgst(struct xkb_context *context,
|
||||
xkb_map_new_from_kccgst(struct xkb_ctx *ctx,
|
||||
const struct xkb_component_names *kccgst,
|
||||
enum xkb_map_compile_flags flags)
|
||||
{
|
||||
|
@ -253,16 +253,16 @@ xkb_map_new_from_kccgst(struct xkb_context *context,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!(file = XkbKeymapFileFromComponents(context, kccgst))) {
|
||||
if (!(file = XkbKeymapFileFromComponents(ctx, kccgst))) {
|
||||
ERROR("failed to generate parsed XKB file from components\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return compile_keymap(context, file);
|
||||
return compile_keymap(ctx, file);
|
||||
}
|
||||
|
||||
_X_EXPORT struct xkb_keymap *
|
||||
xkb_map_new_from_string(struct xkb_context *context,
|
||||
xkb_map_new_from_string(struct xkb_ctx *ctx,
|
||||
const char *string,
|
||||
enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags)
|
||||
|
@ -279,16 +279,16 @@ xkb_map_new_from_string(struct xkb_context *context,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!XKBParseString(context, string, "input", &file)) {
|
||||
if (!XKBParseString(ctx, string, "input", &file)) {
|
||||
ERROR("failed to parse input xkb file\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return compile_keymap(context, file);
|
||||
return compile_keymap(ctx, file);
|
||||
}
|
||||
|
||||
_X_EXPORT struct xkb_keymap *
|
||||
xkb_map_new_from_fd(struct xkb_context *context,
|
||||
xkb_map_new_from_fd(struct xkb_ctx *ctx,
|
||||
int fd,
|
||||
enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags)
|
||||
|
@ -312,12 +312,12 @@ xkb_map_new_from_fd(struct xkb_context *context,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!XKBParseFile(context, fptr, "(unknown file)", &file)) {
|
||||
if (!XKBParseFile(ctx, fptr, "(unknown file)", &file)) {
|
||||
ERROR("failed to parse input xkb file\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return compile_keymap(context, file);
|
||||
return compile_keymap(ctx, file);
|
||||
}
|
||||
|
||||
_X_EXPORT struct xkb_keymap *
|
||||
|
|
|
@ -250,7 +250,7 @@ typedef struct _XkbFile
|
|||
} XkbFile;
|
||||
|
||||
extern struct xkb_keymap *
|
||||
CompileKeymap(struct xkb_context *context, XkbFile *file);
|
||||
CompileKeymap(struct xkb_ctx *ctx, XkbFile *file);
|
||||
|
||||
extern bool
|
||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
int
|
||||
main(void)
|
||||
{
|
||||
struct xkb_context *context = xkb_context_new(0);
|
||||
struct xkb_ctx *ctx = xkb_ctx_new(0);
|
||||
|
||||
assert(context);
|
||||
assert(ctx);
|
||||
|
||||
/* FIXME: Test include path stuff. */
|
||||
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -40,28 +40,28 @@ static int
|
|||
test_file(const char *path)
|
||||
{
|
||||
int fd;
|
||||
struct xkb_context *context;
|
||||
struct xkb_ctx *ctx;
|
||||
struct xkb_keymap *keymap;
|
||||
|
||||
fd = open(path, O_RDONLY);
|
||||
assert(fd >= 0);
|
||||
|
||||
context = xkb_context_new(0);
|
||||
assert(context);
|
||||
ctx = xkb_ctx_new(0);
|
||||
assert(ctx);
|
||||
|
||||
fprintf(stderr, "\nCompiling path: %s\n", path);
|
||||
|
||||
keymap = xkb_map_new_from_fd(context, fd, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
keymap = xkb_map_new_from_fd(ctx, fd, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
close(fd);
|
||||
|
||||
if (!keymap) {
|
||||
fprintf(stderr, "Failed to compile keymap\n");
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
xkb_map_unref(keymap);
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -78,23 +78,22 @@ test_file_name(const char *file_name)
|
|||
static int
|
||||
test_string(const char *string)
|
||||
{
|
||||
struct xkb_context *context;
|
||||
struct xkb_ctx *ctx;
|
||||
struct xkb_keymap *keymap;
|
||||
|
||||
context = xkb_context_new(0);
|
||||
assert(context);
|
||||
ctx = xkb_ctx_new(0);
|
||||
assert(ctx);
|
||||
|
||||
fprintf(stderr, "\nCompiling string\n");
|
||||
|
||||
keymap = xkb_map_new_from_string(context, string,
|
||||
XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
keymap = xkb_map_new_from_string(ctx, string, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
if (!keymap) {
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
xkb_map_unref(keymap);
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ test_names(const char *keycodes, const char *types,
|
|||
const char *compat, const char *symbols)
|
||||
{
|
||||
int ret = 1;
|
||||
struct xkb_context *context;
|
||||
struct xkb_ctx *ctx;
|
||||
struct xkb_keymap *keymap;
|
||||
struct xkb_component_names kccgst = {
|
||||
.keymap = NULL,
|
||||
|
@ -46,13 +46,13 @@ test_names(const char *keycodes, const char *types,
|
|||
.symbols = strdup(symbols),
|
||||
};
|
||||
|
||||
context = xkb_context_new(0);
|
||||
assert(context);
|
||||
ctx = xkb_ctx_new(0);
|
||||
assert(ctx);
|
||||
|
||||
fprintf(stderr, "\nCompiling %s %s %s %s\n", kccgst.keycodes, kccgst.types,
|
||||
kccgst.compat, kccgst.symbols);
|
||||
|
||||
keymap = xkb_map_new_from_kccgst(context, &kccgst, 0);
|
||||
keymap = xkb_map_new_from_kccgst(ctx, &kccgst, 0);
|
||||
if (!keymap) {
|
||||
ret = 0;
|
||||
goto err_ctx;
|
||||
|
@ -60,7 +60,7 @@ test_names(const char *keycodes, const char *types,
|
|||
|
||||
xkb_map_unref(keymap);
|
||||
err_ctx:
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
free(kccgst.keycodes);
|
||||
free(kccgst.types);
|
||||
free(kccgst.compat);
|
||||
|
|
|
@ -33,7 +33,7 @@ static int
|
|||
test_rmlvo(const char *rules, const char *model, const char *layout,
|
||||
const char *variant, const char *options)
|
||||
{
|
||||
struct xkb_context *context;
|
||||
struct xkb_ctx *ctx;
|
||||
struct xkb_keymap *keymap;
|
||||
struct xkb_rule_names rmlvo = {
|
||||
.rules = rules,
|
||||
|
@ -43,20 +43,20 @@ test_rmlvo(const char *rules, const char *model, const char *layout,
|
|||
.options = options
|
||||
};
|
||||
|
||||
context = xkb_context_new(0);
|
||||
assert(context);
|
||||
ctx = xkb_ctx_new(0);
|
||||
assert(ctx);
|
||||
|
||||
fprintf(stderr, "\nCompiling %s %s %s %s %s\n", rmlvo.rules, rmlvo.model,
|
||||
rmlvo.layout, rmlvo.variant, rmlvo.options);
|
||||
|
||||
keymap = xkb_map_new_from_names(context, &rmlvo, 0);
|
||||
keymap = xkb_map_new_from_names(ctx, &rmlvo, 0);
|
||||
if (!keymap) {
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
xkb_map_unref(keymap);
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
10
test/state.c
10
test/state.c
|
@ -225,7 +225,7 @@ test_serialisation(struct xkb_keymap *keymap)
|
|||
int
|
||||
main(void)
|
||||
{
|
||||
struct xkb_context *context;
|
||||
struct xkb_ctx *ctx;
|
||||
struct xkb_keymap *keymap;
|
||||
struct xkb_rule_names rmlvo = {
|
||||
.rules = "evdev",
|
||||
|
@ -235,15 +235,15 @@ main(void)
|
|||
.options = NULL,
|
||||
};
|
||||
|
||||
context = xkb_context_new(0);
|
||||
assert(context);
|
||||
ctx = xkb_ctx_new(0);
|
||||
assert(ctx);
|
||||
|
||||
keymap = xkb_map_new_from_names(context, &rmlvo, 0);
|
||||
keymap = xkb_map_new_from_names(ctx, &rmlvo, 0);
|
||||
assert(keymap);
|
||||
|
||||
test_update_key(keymap);
|
||||
test_serialisation(keymap);
|
||||
|
||||
xkb_map_unref(keymap);
|
||||
xkb_context_unref(context);
|
||||
xkb_ctx_unref(ctx);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue