Replace xkb_keycode_t 'key' variable name by 'kc'
We want to reserve the name 'key' for something else. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
a52fb7e21c
commit
81d029f563
22
src/alloc.c
22
src/alloc.c
|
@ -67,27 +67,27 @@ XkbcCopyKeyType(const struct xkb_key_type *from, struct xkb_key_type *into)
|
|||
}
|
||||
|
||||
bool
|
||||
XkbcResizeKeySyms(struct xkb_keymap *keymap, xkb_keycode_t key,
|
||||
XkbcResizeKeySyms(struct xkb_keymap *keymap, xkb_keycode_t kc,
|
||||
unsigned int needed)
|
||||
{
|
||||
darray_resize0(darray_item(keymap->key_sym_map, key).syms, needed);
|
||||
darray_resize0(darray_item(keymap->key_sym_map, kc).syms, needed);
|
||||
return true;
|
||||
}
|
||||
|
||||
union xkb_action *
|
||||
XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t key,
|
||||
XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t kc,
|
||||
uint32_t needed)
|
||||
{
|
||||
size_t old_ndx, old_num_acts, new_ndx;
|
||||
|
||||
if (needed == 0) {
|
||||
darray_item(keymap->key_acts, key) = 0;
|
||||
darray_item(keymap->key_acts, kc) = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (XkbKeyHasActions(keymap, key) &&
|
||||
XkbKeyGroupsWidth(keymap, key) >= needed)
|
||||
return XkbKeyActionsPtr(keymap, key);
|
||||
if (XkbKeyHasActions(keymap, kc) &&
|
||||
XkbKeyGroupsWidth(keymap, kc) >= needed)
|
||||
return XkbKeyActionsPtr(keymap, kc);
|
||||
|
||||
/*
|
||||
* The key may already be in the array, but without enough space.
|
||||
|
@ -96,12 +96,12 @@ XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t key,
|
|||
* space for the key at the end, and leave the old space alone.
|
||||
*/
|
||||
|
||||
old_ndx = darray_item(keymap->key_acts, key);
|
||||
old_num_acts = XkbKeyNumActions(keymap, key);
|
||||
old_ndx = darray_item(keymap->key_acts, kc);
|
||||
old_num_acts = XkbKeyNumActions(keymap, kc);
|
||||
new_ndx = darray_size(keymap->acts);
|
||||
|
||||
darray_resize0(keymap->acts, new_ndx + needed);
|
||||
darray_item(keymap->key_acts, key) = new_ndx;
|
||||
darray_item(keymap->key_acts, kc) = new_ndx;
|
||||
|
||||
/*
|
||||
* The key was already in the array, copy the old actions to the
|
||||
|
@ -112,7 +112,7 @@ XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t key,
|
|||
darray_mem(keymap->acts, old_ndx),
|
||||
old_num_acts * sizeof(union xkb_action));
|
||||
|
||||
return XkbKeyActionsPtr(keymap, key);
|
||||
return XkbKeyActionsPtr(keymap, kc);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -39,11 +39,11 @@ extern int
|
|||
XkbcCopyKeyType(const struct xkb_key_type *from, struct xkb_key_type *into);
|
||||
|
||||
extern bool
|
||||
XkbcResizeKeySyms(struct xkb_keymap *keymap, xkb_keycode_t key,
|
||||
XkbcResizeKeySyms(struct xkb_keymap *keymap, xkb_keycode_t kc,
|
||||
uint32_t needed);
|
||||
|
||||
extern union xkb_action *
|
||||
XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t key,
|
||||
XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t kc,
|
||||
uint32_t needed);
|
||||
|
||||
#endif /* ALLOC_H */
|
||||
|
|
|
@ -309,7 +309,7 @@ static bool
|
|||
write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||
size_t *offset)
|
||||
{
|
||||
xkb_keycode_t key;
|
||||
xkb_keycode_t kc;
|
||||
struct xkb_key_alias *alias;
|
||||
int i;
|
||||
|
||||
|
@ -324,13 +324,13 @@ write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
write_buf(keymap, buf, size, offset, "\t\tmaximum = %d;\n",
|
||||
keymap->max_key_code);
|
||||
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
||||
if (darray_item(keymap->key_names, key).name[0] == '\0')
|
||||
for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
|
||||
if (darray_item(keymap->key_names, kc).name[0] == '\0')
|
||||
continue;
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t\t%6s = %d;\n",
|
||||
XkbcKeyNameText(darray_item(keymap->key_names, key).name),
|
||||
key);
|
||||
XkbcKeyNameText(darray_item(keymap->key_names, kc).name),
|
||||
kc);
|
||||
}
|
||||
|
||||
for (i = 0; i < XkbNumIndicators; i++) {
|
||||
|
@ -740,17 +740,17 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
|
||||
static bool
|
||||
write_keysyms(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||
size_t *offset, xkb_keycode_t key, unsigned int group)
|
||||
size_t *offset, xkb_keycode_t kc, unsigned int group)
|
||||
{
|
||||
const xkb_keysym_t *syms;
|
||||
int num_syms, level;
|
||||
#define OUT_BUF_LEN 128
|
||||
char out_buf[OUT_BUF_LEN];
|
||||
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group); level++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group); level++) {
|
||||
if (level != 0)
|
||||
write_buf(keymap, buf, size, offset, ", ");
|
||||
num_syms = xkb_key_get_syms_by_level(keymap, key, group, level,
|
||||
num_syms = xkb_key_get_syms_by_level(keymap, kc, group, level,
|
||||
&syms);
|
||||
if (num_syms == 0) {
|
||||
write_buf(keymap, buf, size, offset, "%15s", "NoSymbol");
|
||||
|
@ -780,7 +780,7 @@ static bool
|
|||
write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||
size_t *offset)
|
||||
{
|
||||
xkb_keycode_t key;
|
||||
xkb_keycode_t kc;
|
||||
int group, tmp;
|
||||
bool showActions;
|
||||
|
||||
|
@ -801,35 +801,35 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
if (tmp > 0)
|
||||
write_buf(keymap, buf, size, offset, "\n");
|
||||
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
||||
for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
|
||||
bool simple = true;
|
||||
|
||||
if (xkb_key_num_groups(keymap, key) == 0)
|
||||
if (xkb_key_num_groups(keymap, kc) == 0)
|
||||
continue;
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t\tkey %6s {",
|
||||
XkbcKeyNameText(darray_item(keymap->key_names, key).name));
|
||||
XkbcKeyNameText(darray_item(keymap->key_names, kc).name));
|
||||
if (keymap->explicit) {
|
||||
if ((keymap->explicit[key] & XkbExplicitKeyTypesMask)) {
|
||||
if ((keymap->explicit[kc] & XkbExplicitKeyTypesMask)) {
|
||||
bool multi_type = false;
|
||||
int type = XkbKeyTypeIndex(keymap, key, 0);
|
||||
int type = XkbKeyTypeIndex(keymap, kc, 0);
|
||||
|
||||
simple = false;
|
||||
|
||||
for (group = 0; group < xkb_key_num_groups(keymap, key);
|
||||
for (group = 0; group < xkb_key_num_groups(keymap, kc);
|
||||
group++) {
|
||||
if (XkbKeyTypeIndex(keymap, key, group) != type) {
|
||||
if (XkbKeyTypeIndex(keymap, kc, group) != type) {
|
||||
multi_type = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (multi_type) {
|
||||
for (group = 0;
|
||||
group < xkb_key_num_groups(keymap, key);
|
||||
group < xkb_key_num_groups(keymap, kc);
|
||||
group++) {
|
||||
if (!(keymap->explicit[key] & (1 << group)))
|
||||
if (!(keymap->explicit[kc] & (1 << group)))
|
||||
continue;
|
||||
type = XkbKeyTypeIndex(keymap, key, group);
|
||||
type = XkbKeyTypeIndex(keymap, kc, group);
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\ttype[group%d]= \"%s\",",
|
||||
group + 1,
|
||||
|
@ -842,8 +842,8 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
darray_item(keymap->types, type).name);
|
||||
}
|
||||
}
|
||||
if (keymap->explicit[key] & XkbExplicitAutoRepeatMask) {
|
||||
if (keymap->per_key_repeat[key / 8] & (1 << (key % 8)))
|
||||
if (keymap->explicit[kc] & XkbExplicitAutoRepeatMask) {
|
||||
if (keymap->per_key_repeat[kc / 8] & (1 << (kc % 8)))
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\trepeat= Yes,");
|
||||
else
|
||||
|
@ -851,15 +851,15 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
"\n\t\t\trepeat= No,");
|
||||
simple = false;
|
||||
}
|
||||
if (keymap->vmodmap[key] &&
|
||||
(keymap->explicit[key] & XkbExplicitVModMapMask)) {
|
||||
if (keymap->vmodmap[kc] &&
|
||||
(keymap->explicit[kc] & XkbExplicitVModMapMask)) {
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\tvirtualMods= %s,",
|
||||
get_mod_mask_text(keymap, 0, keymap->vmodmap[key]));
|
||||
get_mod_mask_text(keymap, 0, keymap->vmodmap[kc]));
|
||||
}
|
||||
}
|
||||
|
||||
switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(keymap, key))) {
|
||||
switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(keymap, kc))) {
|
||||
case XkbClampIntoRange:
|
||||
write_buf(keymap, buf, size, offset, "\n\t\t\tgroupsClamp,");
|
||||
break;
|
||||
|
@ -868,22 +868,22 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\tgroupsRedirect= Group%d,",
|
||||
XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(keymap,
|
||||
key)) + 1);
|
||||
kc)) + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (keymap->explicit == NULL ||
|
||||
(keymap->explicit[key] & XkbExplicitInterpretMask))
|
||||
showActions = XkbKeyHasActions(keymap, key);
|
||||
(keymap->explicit[kc] & XkbExplicitInterpretMask))
|
||||
showActions = XkbKeyHasActions(keymap, kc);
|
||||
else
|
||||
showActions = false;
|
||||
|
||||
if (xkb_key_num_groups(keymap, key) > 1 || showActions)
|
||||
if (xkb_key_num_groups(keymap, kc) > 1 || showActions)
|
||||
simple = false;
|
||||
|
||||
if (simple) {
|
||||
write_buf(keymap, buf, size, offset, "\t[ ");
|
||||
if (!write_keysyms(keymap, buf, size, offset, key, 0))
|
||||
if (!write_keysyms(keymap, buf, size, offset, kc, 0))
|
||||
return false;
|
||||
write_buf(keymap, buf, size, offset, " ] };\n");
|
||||
}
|
||||
|
@ -891,21 +891,20 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
union xkb_action *acts;
|
||||
int level;
|
||||
|
||||
acts = XkbKeyActionsPtr(keymap, key);
|
||||
for (group = 0; group < xkb_key_num_groups(keymap, key);
|
||||
group++) {
|
||||
acts = XkbKeyActionsPtr(keymap, kc);
|
||||
for (group = 0; group < xkb_key_num_groups(keymap, kc); group++) {
|
||||
if (group != 0)
|
||||
write_buf(keymap, buf, size, offset, ",");
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\tsymbols[Group%d]= [ ", group + 1);
|
||||
if (!write_keysyms(keymap, buf, size, offset, key, group))
|
||||
if (!write_keysyms(keymap, buf, size, offset, kc, group))
|
||||
return false;
|
||||
write_buf(keymap, buf, size, offset, " ]");
|
||||
if (showActions) {
|
||||
write_buf(keymap, buf, size, offset,
|
||||
",\n\t\t\tactions[Group%d]= [ ", group + 1);
|
||||
for (level = 0;
|
||||
level < XkbKeyGroupWidth(keymap, key, group);
|
||||
level < XkbKeyGroupWidth(keymap, kc, group);
|
||||
level++) {
|
||||
if (level != 0)
|
||||
write_buf(keymap, buf, size, offset, ", ");
|
||||
|
@ -913,29 +912,28 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
NULL, NULL);
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, " ]");
|
||||
acts += XkbKeyGroupsWidth(keymap, key);
|
||||
acts += XkbKeyGroupsWidth(keymap, kc);
|
||||
}
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\n\t\t};\n");
|
||||
}
|
||||
}
|
||||
if (keymap->modmap) {
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code;
|
||||
key++) {
|
||||
for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
|
||||
int mod;
|
||||
|
||||
if (keymap->modmap[key] == 0)
|
||||
if (keymap->modmap[kc] == 0)
|
||||
continue;
|
||||
|
||||
for (mod = 0; mod < XkbNumModifiers; mod++) {
|
||||
if (!(keymap->modmap[key] & (1 << mod)))
|
||||
if (!(keymap->modmap[kc] & (1 << mod)))
|
||||
continue;
|
||||
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\t\tmodifier_map %s { %s };\n",
|
||||
get_mod_index_text(mod),
|
||||
XkbcKeyNameText(darray_item(keymap->key_names,
|
||||
key).name));
|
||||
kc).name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
40
src/map.c
40
src/map.c
|
@ -185,9 +185,9 @@ xkb_map_group_get_index(struct xkb_keymap *keymap, const char *name)
|
|||
* Returns the number of groups active for a particular key.
|
||||
*/
|
||||
_X_EXPORT xkb_group_index_t
|
||||
xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t key)
|
||||
xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t kc)
|
||||
{
|
||||
return XkbKeyNumGroups(keymap, key);
|
||||
return XkbKeyNumGroups(keymap, kc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,11 +241,11 @@ xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name)
|
|||
* Returns the level to use for the given key and state, or -1 if invalid.
|
||||
*/
|
||||
_X_EXPORT unsigned int
|
||||
xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
|
||||
xkb_key_get_level(struct xkb_state *state, xkb_keycode_t kc,
|
||||
unsigned int group)
|
||||
{
|
||||
struct xkb_keymap *keymap = xkb_state_get_map(state);
|
||||
struct xkb_key_type *type = XkbKeyType(keymap, key, group);
|
||||
struct xkb_key_type *type = XkbKeyType(keymap, kc, group);
|
||||
struct xkb_kt_map_entry *entry;
|
||||
unsigned int active_mods;
|
||||
|
||||
|
@ -265,14 +265,14 @@ xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
|
|||
* wrapping/clamping/etc into account.
|
||||
*/
|
||||
_X_EXPORT unsigned int
|
||||
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
|
||||
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t kc)
|
||||
{
|
||||
struct xkb_keymap *keymap = xkb_state_get_map(state);
|
||||
unsigned int info = XkbKeyGroupInfo(keymap, key);
|
||||
unsigned int num_groups = XkbKeyNumGroups(keymap, key);
|
||||
unsigned int info = XkbKeyGroupInfo(keymap, kc);
|
||||
unsigned int num_groups = XkbKeyNumGroups(keymap, kc);
|
||||
unsigned int ret = xkb_state_serialize_group(state, XKB_STATE_EFFECTIVE);
|
||||
|
||||
if (ret < XkbKeyNumGroups(keymap, key))
|
||||
if (ret < XkbKeyNumGroups(keymap, kc))
|
||||
return ret;
|
||||
|
||||
switch (XkbOutOfRangeGroupAction(info)) {
|
||||
|
@ -299,22 +299,22 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
|
|||
* As below, but takes an explicit group/level rather than state.
|
||||
*/
|
||||
int
|
||||
xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t key,
|
||||
xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t kc,
|
||||
unsigned int group, unsigned int level,
|
||||
const xkb_keysym_t **syms_out)
|
||||
{
|
||||
int num_syms;
|
||||
|
||||
if (group >= XkbKeyNumGroups(keymap, key))
|
||||
if (group >= XkbKeyNumGroups(keymap, kc))
|
||||
goto err;
|
||||
if (level >= XkbKeyGroupWidth(keymap, key, group))
|
||||
if (level >= XkbKeyGroupWidth(keymap, kc, group))
|
||||
goto err;
|
||||
|
||||
num_syms = XkbKeyNumSyms(keymap, key, group, level);
|
||||
num_syms = XkbKeyNumSyms(keymap, kc, group, level);
|
||||
if (num_syms == 0)
|
||||
goto err;
|
||||
|
||||
*syms_out = XkbKeySymEntry(keymap, key, group, level);
|
||||
*syms_out = XkbKeySymEntry(keymap, kc, group, level);
|
||||
return num_syms;
|
||||
|
||||
err:
|
||||
|
@ -327,24 +327,24 @@ err:
|
|||
* number of symbols pointed to in syms_out.
|
||||
*/
|
||||
_X_EXPORT int
|
||||
xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
|
||||
xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t kc,
|
||||
const xkb_keysym_t **syms_out)
|
||||
{
|
||||
struct xkb_keymap *keymap = xkb_state_get_map(state);
|
||||
int group;
|
||||
int level;
|
||||
|
||||
if (!state || key < keymap->min_key_code || key > keymap->max_key_code)
|
||||
if (!state || kc < keymap->min_key_code || kc > keymap->max_key_code)
|
||||
return -1;
|
||||
|
||||
group = xkb_key_get_group(state, key);
|
||||
group = xkb_key_get_group(state, kc);
|
||||
if (group == -1)
|
||||
goto err;
|
||||
level = xkb_key_get_level(state, key, group);
|
||||
level = xkb_key_get_level(state, kc, group);
|
||||
if (level == -1)
|
||||
goto err;
|
||||
|
||||
return xkb_key_get_syms_by_level(keymap, key, group, level, syms_out);
|
||||
return xkb_key_get_syms_by_level(keymap, kc, group, level, syms_out);
|
||||
|
||||
err:
|
||||
*syms_out = NULL;
|
||||
|
@ -355,7 +355,7 @@ err:
|
|||
* Simple boolean specifying whether or not the key should repeat.
|
||||
*/
|
||||
_X_EXPORT int
|
||||
xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key)
|
||||
xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc)
|
||||
{
|
||||
return !!(keymap->per_key_repeat[key / 8] & (1 << (key % 8)));
|
||||
return !!(keymap->per_key_repeat[kc / 8] & (1 << (kc % 8)));
|
||||
}
|
||||
|
|
80
src/state.c
80
src/state.c
|
@ -66,9 +66,9 @@
|
|||
struct xkb_filter {
|
||||
struct xkb_state *state;
|
||||
union xkb_action action;
|
||||
xkb_keycode_t keycode;
|
||||
xkb_keycode_t kc;
|
||||
uint32_t priv;
|
||||
int (*func)(struct xkb_filter *filter, xkb_keycode_t key,
|
||||
int (*func)(struct xkb_filter *filter, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction);
|
||||
int refcnt;
|
||||
struct xkb_filter *next;
|
||||
|
@ -107,22 +107,22 @@ struct xkb_state {
|
|||
};
|
||||
|
||||
static union xkb_action *
|
||||
xkb_key_get_action(struct xkb_state *state, xkb_keycode_t key)
|
||||
xkb_key_get_action(struct xkb_state *state, xkb_keycode_t kc)
|
||||
{
|
||||
unsigned int group, level;
|
||||
|
||||
if (!XkbKeyHasActions(state->keymap, key) ||
|
||||
!XkbKeycodeInRange(state->keymap, key)) {
|
||||
if (!XkbKeyHasActions(state->keymap, kc) ||
|
||||
!XkbKeycodeInRange(state->keymap, kc)) {
|
||||
static union xkb_action fake;
|
||||
memset(&fake, 0, sizeof(fake));
|
||||
fake.type = XkbSA_NoAction;
|
||||
return &fake;
|
||||
}
|
||||
|
||||
group = xkb_key_get_group(state, key);
|
||||
level = xkb_key_get_level(state, key, group);
|
||||
group = xkb_key_get_group(state, kc);
|
||||
level = xkb_key_get_level(state, kc, group);
|
||||
|
||||
return XkbKeyActionEntry(state->keymap, key, group, level);
|
||||
return XkbKeyActionEntry(state->keymap, kc, group, level);
|
||||
}
|
||||
|
||||
static struct xkb_filter *
|
||||
|
@ -151,10 +151,10 @@ xkb_filter_new(struct xkb_state *state)
|
|||
/***====================================================================***/
|
||||
|
||||
static int
|
||||
xkb_filter_group_set_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
||||
xkb_filter_group_set_func(struct xkb_filter *filter, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction)
|
||||
{
|
||||
if (keycode != filter->keycode) {
|
||||
if (kc != filter->kc) {
|
||||
filter->action.group.flags &= ~XkbSA_ClearLocks;
|
||||
return 1;
|
||||
}
|
||||
|
@ -180,14 +180,14 @@ xkb_filter_group_set_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
|||
}
|
||||
|
||||
static int
|
||||
xkb_filter_group_set_new(struct xkb_state *state, xkb_keycode_t keycode,
|
||||
xkb_filter_group_set_new(struct xkb_state *state, xkb_keycode_t kc,
|
||||
union xkb_action *action)
|
||||
{
|
||||
struct xkb_filter *filter = xkb_filter_new(state);
|
||||
|
||||
if (!filter) /* WSGO */
|
||||
return -1;
|
||||
filter->keycode = keycode;
|
||||
filter->kc = kc;
|
||||
filter->func = xkb_filter_group_set_func;
|
||||
filter->action = *action;
|
||||
|
||||
|
@ -203,10 +203,10 @@ xkb_filter_group_set_new(struct xkb_state *state, xkb_keycode_t keycode,
|
|||
}
|
||||
|
||||
static int
|
||||
xkb_filter_group_lock_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
||||
xkb_filter_group_lock_func(struct xkb_filter *filter, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction)
|
||||
{
|
||||
if (keycode != filter->keycode)
|
||||
if (kc != filter->kc)
|
||||
return 1;
|
||||
|
||||
if (direction == XKB_KEY_DOWN) {
|
||||
|
@ -221,7 +221,7 @@ xkb_filter_group_lock_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
|||
}
|
||||
|
||||
static int
|
||||
xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
|
||||
xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t kc,
|
||||
union xkb_action *action)
|
||||
{
|
||||
struct xkb_filter *filter = xkb_filter_new(state);
|
||||
|
@ -229,7 +229,7 @@ xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
|
|||
if (!filter)
|
||||
return 0;
|
||||
|
||||
filter->keycode = keycode;
|
||||
filter->kc = kc;
|
||||
filter->func = xkb_filter_group_lock_func;
|
||||
filter->action = *action;
|
||||
|
||||
|
@ -242,10 +242,10 @@ xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
|
|||
}
|
||||
|
||||
static int
|
||||
xkb_filter_mod_set_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
||||
xkb_filter_mod_set_func(struct xkb_filter *filter, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction)
|
||||
{
|
||||
if (keycode != filter->keycode) {
|
||||
if (kc != filter->kc) {
|
||||
filter->action.mods.flags &= ~XkbSA_ClearLocks;
|
||||
return 1;
|
||||
}
|
||||
|
@ -268,14 +268,14 @@ xkb_filter_mod_set_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
|||
}
|
||||
|
||||
static int
|
||||
xkb_filter_mod_set_new(struct xkb_state *state, xkb_keycode_t keycode,
|
||||
xkb_filter_mod_set_new(struct xkb_state *state, xkb_keycode_t kc,
|
||||
union xkb_action *action)
|
||||
{
|
||||
struct xkb_filter *filter = xkb_filter_new(state);
|
||||
|
||||
if (!filter) /* WSGO */
|
||||
return -1;
|
||||
filter->keycode = keycode;
|
||||
filter->kc = kc;
|
||||
filter->func = xkb_filter_mod_set_func;
|
||||
filter->action = *action;
|
||||
|
||||
|
@ -285,10 +285,10 @@ xkb_filter_mod_set_new(struct xkb_state *state, xkb_keycode_t keycode,
|
|||
}
|
||||
|
||||
static int
|
||||
xkb_filter_mod_lock_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
||||
xkb_filter_mod_lock_func(struct xkb_filter *filter, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction)
|
||||
{
|
||||
if (keycode != filter->keycode)
|
||||
if (kc != filter->kc)
|
||||
return 1;
|
||||
|
||||
if (direction == XKB_KEY_DOWN) {
|
||||
|
@ -304,7 +304,7 @@ xkb_filter_mod_lock_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
|||
}
|
||||
|
||||
static int
|
||||
xkb_filter_mod_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
|
||||
xkb_filter_mod_lock_new(struct xkb_state *state, xkb_keycode_t kc,
|
||||
union xkb_action *action)
|
||||
{
|
||||
struct xkb_filter *filter = xkb_filter_new(state);
|
||||
|
@ -312,7 +312,7 @@ xkb_filter_mod_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
|
|||
if (!filter) /* WSGO */
|
||||
return 0;
|
||||
|
||||
filter->keycode = keycode;
|
||||
filter->kc = kc;
|
||||
filter->func = xkb_filter_mod_lock_func;
|
||||
filter->action = *action;
|
||||
filter->priv = state->locked_mods & action->mods.mask;
|
||||
|
@ -328,7 +328,7 @@ enum xkb_key_latch_state {
|
|||
};
|
||||
|
||||
static int
|
||||
xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
||||
xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction)
|
||||
{
|
||||
enum xkb_key_latch_state latch = filter->priv;
|
||||
|
@ -338,7 +338,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
|||
* keypress, then either break the latch if any random key is pressed,
|
||||
* or promote it to a lock or plain base set if it's the same
|
||||
* modifier. */
|
||||
union xkb_action *action = xkb_key_get_action(filter->state, keycode);
|
||||
union xkb_action *action = xkb_key_get_action(filter->state, kc);
|
||||
if (action->type == XkbSA_LatchMods &&
|
||||
action->mods.flags == filter->action.mods.flags &&
|
||||
action->mods.mask == filter->action.mods.mask) {
|
||||
|
@ -353,7 +353,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
|||
filter->func = xkb_filter_mod_set_func;
|
||||
filter->state->set_mods = filter->action.mods.mask;
|
||||
}
|
||||
filter->keycode = keycode;
|
||||
filter->kc = kc;
|
||||
filter->state->latched_mods &= ~filter->action.mods.mask;
|
||||
/* XXX beep beep! */
|
||||
return 0;
|
||||
|
@ -366,7 +366,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
else if (direction == XKB_KEY_UP && keycode == filter->keycode) {
|
||||
else if (direction == XKB_KEY_UP && kc == filter->kc) {
|
||||
/* Our key got released. If we've set it to clear locks, and we
|
||||
* currently have the same modifiers locked, then release them and
|
||||
* don't actually latch. Else we've actually hit the latching
|
||||
|
@ -406,7 +406,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
|
|||
}
|
||||
|
||||
static int
|
||||
xkb_filter_mod_latch_new(struct xkb_state *state, xkb_keycode_t keycode,
|
||||
xkb_filter_mod_latch_new(struct xkb_state *state, xkb_keycode_t kc,
|
||||
union xkb_action *action)
|
||||
{
|
||||
struct xkb_filter *filter = xkb_filter_new(state);
|
||||
|
@ -414,7 +414,7 @@ xkb_filter_mod_latch_new(struct xkb_state *state, xkb_keycode_t keycode,
|
|||
|
||||
if (!filter) /* WSGO */
|
||||
return -1;
|
||||
filter->keycode = keycode;
|
||||
filter->kc = kc;
|
||||
filter->priv = latch;
|
||||
filter->func = xkb_filter_mod_latch_func;
|
||||
filter->action = *action;
|
||||
|
@ -430,7 +430,7 @@ xkb_filter_mod_latch_new(struct xkb_state *state, xkb_keycode_t keycode,
|
|||
* apply a new filter from the key action.
|
||||
*/
|
||||
static void
|
||||
xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t key,
|
||||
xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction)
|
||||
{
|
||||
struct xkb_filter *filter;
|
||||
|
@ -442,25 +442,25 @@ xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t key,
|
|||
darray_foreach(filter, state->filters) {
|
||||
if (!filter->func)
|
||||
continue;
|
||||
send &= filter->func(filter, key, direction);
|
||||
send &= filter->func(filter, kc, direction);
|
||||
}
|
||||
|
||||
if (!send || direction == XKB_KEY_UP)
|
||||
return;
|
||||
|
||||
act = xkb_key_get_action(state, key);
|
||||
act = xkb_key_get_action(state, kc);
|
||||
switch (act->type) {
|
||||
case XkbSA_SetMods:
|
||||
send = xkb_filter_mod_set_new(state, key, act);
|
||||
send = xkb_filter_mod_set_new(state, kc, act);
|
||||
break;
|
||||
case XkbSA_LatchMods:
|
||||
send = xkb_filter_mod_latch_new(state, key, act);
|
||||
send = xkb_filter_mod_latch_new(state, kc, act);
|
||||
break;
|
||||
case XkbSA_LockMods:
|
||||
send = xkb_filter_mod_lock_new(state, key, act);
|
||||
send = xkb_filter_mod_lock_new(state, kc, act);
|
||||
break;
|
||||
case XkbSA_SetGroup:
|
||||
send = xkb_filter_group_set_new(state, key, act);
|
||||
send = xkb_filter_group_set_new(state, kc, act);
|
||||
break;
|
||||
#if 0
|
||||
case XkbSA_LatchGroup:
|
||||
|
@ -468,7 +468,7 @@ xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t key,
|
|||
break;
|
||||
#endif
|
||||
case XkbSA_LockGroup:
|
||||
send = xkb_filter_group_lock_new(state, key, act);
|
||||
send = xkb_filter_group_lock_new(state, kc, act);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,7 @@ xkb_state_update_derived(struct xkb_state *state)
|
|||
* new modifiers.
|
||||
*/
|
||||
_X_EXPORT void
|
||||
xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
|
||||
xkb_state_update_key(struct xkb_state *state, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction)
|
||||
{
|
||||
xkb_mod_index_t i;
|
||||
|
@ -599,7 +599,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
|
|||
state->set_mods = 0;
|
||||
state->clear_mods = 0;
|
||||
|
||||
xkb_filter_apply_all(state, key, direction);
|
||||
xkb_filter_apply_all(state, kc, direction);
|
||||
|
||||
for (i = 0, bit = 1; state->set_mods; i++, bit <<= 1) {
|
||||
if (state->set_mods & bit) {
|
||||
|
|
|
@ -188,7 +188,7 @@ struct xkb_switch_screen_action {
|
|||
|
||||
struct xkb_redirect_key_action {
|
||||
uint8_t type;
|
||||
xkb_keycode_t new_key;
|
||||
xkb_keycode_t new_kc;
|
||||
uint8_t mods_mask;
|
||||
uint8_t mods;
|
||||
uint16_t vmods_mask;
|
||||
|
@ -526,14 +526,14 @@ const char *
|
|||
xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom);
|
||||
|
||||
extern unsigned int
|
||||
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key);
|
||||
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t kc);
|
||||
|
||||
extern unsigned int
|
||||
xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
|
||||
xkb_key_get_level(struct xkb_state *state, xkb_keycode_t kc,
|
||||
unsigned int group);
|
||||
|
||||
extern int
|
||||
xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t key,
|
||||
xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t kc,
|
||||
unsigned int group, unsigned int level,
|
||||
const xkb_keysym_t **syms_out);
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
return ReportNotFound(action->type, field, "Key",
|
||||
XkbcKeyNameText(rtrn.keyName.name));
|
||||
}
|
||||
act->new_key = kc;
|
||||
act->new_kc = kc;
|
||||
return true;
|
||||
|
||||
case F_ModsToClear:
|
||||
|
|
|
@ -826,7 +826,7 @@ UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act,
|
|||
* generic XKB_KEY_NoSymbol match.
|
||||
*/
|
||||
static struct xkb_sym_interpret *
|
||||
FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
|
||||
FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t kc,
|
||||
uint32_t group, uint32_t level)
|
||||
{
|
||||
struct xkb_sym_interpret *ret = NULL;
|
||||
|
@ -834,7 +834,7 @@ FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
|
|||
const xkb_keysym_t *syms;
|
||||
int num_syms;
|
||||
|
||||
num_syms = xkb_key_get_syms_by_level(keymap, key, group, level, &syms);
|
||||
num_syms = xkb_key_get_syms_by_level(keymap, kc, group, level, &syms);
|
||||
if (num_syms == 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -847,7 +847,7 @@ FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
|
|||
continue;
|
||||
|
||||
if (level == 0 || !(interp->match & XkbSI_LevelOneOnly))
|
||||
mods = keymap->modmap[key];
|
||||
mods = keymap->modmap[kc];
|
||||
else
|
||||
mods = 0;
|
||||
|
||||
|
@ -884,7 +884,7 @@ FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
|
|||
/**
|
||||
*/
|
||||
static bool
|
||||
ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
||||
ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc)
|
||||
{
|
||||
#define INTERP_SIZE (8 * 4)
|
||||
struct xkb_sym_interpret *interps[INTERP_SIZE];
|
||||
|
@ -892,36 +892,36 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
|||
uint32_t vmodmask = 0;
|
||||
int num_acts = 0;
|
||||
int group, level;
|
||||
int width = XkbKeyGroupsWidth(keymap, key);
|
||||
int width = XkbKeyGroupsWidth(keymap, kc);
|
||||
int i;
|
||||
|
||||
/* If we've been told not to bind interps to this key, then don't. */
|
||||
if (keymap->explicit[key] & XkbExplicitInterpretMask)
|
||||
if (keymap->explicit[kc] & XkbExplicitInterpretMask)
|
||||
return true;
|
||||
|
||||
for (i = 0; i < INTERP_SIZE; i++)
|
||||
interps[i] = NULL;
|
||||
|
||||
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
|
||||
for (group = 0; group < XkbKeyNumGroups(keymap, kc); group++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group);
|
||||
level++) {
|
||||
i = (group * width) + level;
|
||||
if (i >= INTERP_SIZE) /* XXX FIXME */
|
||||
return false;
|
||||
interps[i] = FindInterpForKey(keymap, key, group, level);
|
||||
interps[i] = FindInterpForKey(keymap, kc, group, level);
|
||||
if (interps[i])
|
||||
num_acts++;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_acts)
|
||||
num_acts = XkbKeyNumGroups(keymap, key) * width;
|
||||
acts = XkbcResizeKeyActions(keymap, key, num_acts);
|
||||
num_acts = XkbKeyNumGroups(keymap, kc) * width;
|
||||
acts = XkbcResizeKeyActions(keymap, kc, num_acts);
|
||||
if (num_acts && !acts)
|
||||
return false;
|
||||
|
||||
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
|
||||
for (group = 0; group < XkbKeyNumGroups(keymap, kc); group++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group);
|
||||
level++) {
|
||||
struct xkb_sym_interpret *interp;
|
||||
|
||||
|
@ -930,12 +930,12 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
|||
|
||||
/* Infer default key behaviours from the base level. */
|
||||
if (group == 0 && level == 0) {
|
||||
if (!(keymap->explicit[key] & XkbExplicitAutoRepeatMask) &&
|
||||
if (!(keymap->explicit[kc] & XkbExplicitAutoRepeatMask) &&
|
||||
(!interp || interp->flags & XkbSI_AutoRepeat))
|
||||
keymap->per_key_repeat[key / 8] |= (1 << (key % 8));
|
||||
if (!(keymap->explicit[key] & XkbExplicitBehaviorMask) &&
|
||||
keymap->per_key_repeat[kc / 8] |= (1 << (kc % 8));
|
||||
if (!(keymap->explicit[kc] & XkbExplicitBehaviorMask) &&
|
||||
interp && (interp->flags & XkbSI_LockingKey))
|
||||
keymap->behaviors[key].type = XkbKB_Lock;
|
||||
keymap->behaviors[kc].type = XkbKB_Lock;
|
||||
}
|
||||
|
||||
if (!interp)
|
||||
|
@ -950,8 +950,8 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(keymap->explicit[key] & XkbExplicitVModMapMask))
|
||||
keymap->vmodmap[key] = vmodmask;
|
||||
if (!(keymap->explicit[kc] & XkbExplicitVModMapMask))
|
||||
keymap->vmodmap[kc] = vmodmask;
|
||||
|
||||
return true;
|
||||
#undef INTERP_SIZE
|
||||
|
@ -966,27 +966,27 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
|||
bool
|
||||
UpdateModifiersFromCompat(struct xkb_keymap *keymap)
|
||||
{
|
||||
xkb_keycode_t key;
|
||||
xkb_keycode_t kc;
|
||||
int i;
|
||||
struct xkb_key_type *type;
|
||||
struct xkb_kt_map_entry *entry;
|
||||
|
||||
/* Find all the interprets for the key and bind them to actions,
|
||||
* which will also update the vmodmap. */
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++)
|
||||
if (!ApplyInterpsToKey(keymap, key))
|
||||
for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++)
|
||||
if (!ApplyInterpsToKey(keymap, kc))
|
||||
return false;
|
||||
|
||||
/* Update keymap->vmods, the virtual -> real mod mapping. */
|
||||
for (i = 0; i < XkbNumVirtualMods; i++)
|
||||
keymap->vmods[i] = 0;
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
||||
if (!keymap->vmodmap[key])
|
||||
for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
|
||||
if (!keymap->vmodmap[kc])
|
||||
continue;
|
||||
for (i = 0; i < XkbNumVirtualMods; i++) {
|
||||
if (!(keymap->vmodmap[key] & (1 << i)))
|
||||
if (!(keymap->vmodmap[kc] & (1 << i)))
|
||||
continue;
|
||||
keymap->vmods[i] |= keymap->modmap[key];
|
||||
keymap->vmods[i] |= keymap->modmap[kc];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1008,12 +1008,12 @@ UpdateModifiersFromCompat(struct xkb_keymap *keymap)
|
|||
}
|
||||
|
||||
/* Update action modifiers. */
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
||||
union xkb_action *acts = XkbKeyActionsPtr(keymap, key);
|
||||
for (i = 0; i < XkbKeyNumActions(keymap, key); i++) {
|
||||
for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
|
||||
union xkb_action *acts = XkbKeyActionsPtr(keymap, kc);
|
||||
for (i = 0; i < XkbKeyNumActions(keymap, kc); i++) {
|
||||
if (acts[i].any.type == XkbSA_NoAction)
|
||||
continue;
|
||||
UpdateActionMods(keymap, &acts[i], keymap->modmap[key]);
|
||||
UpdateActionMods(keymap, &acts[i], keymap->modmap[kc]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -732,7 +732,7 @@ bool
|
|||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge)
|
||||
{
|
||||
xkb_keycode_t i;
|
||||
xkb_keycode_t kc;
|
||||
KeyNamesInfo info; /* contains all the info after parsing */
|
||||
|
||||
InitKeyNamesInfo(&info, file->id);
|
||||
|
@ -755,9 +755,9 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
|
|||
keymap->max_key_code = info.computedMax;
|
||||
|
||||
darray_resize0(keymap->key_names, keymap->max_key_code + 1);
|
||||
for (i = info.computedMin; i <= info.computedMax; i++)
|
||||
LongToKeyName(darray_item(info.names, i),
|
||||
darray_item(keymap->key_names, i).name);
|
||||
for (kc = info.computedMin; kc <= info.computedMax; kc++)
|
||||
LongToKeyName(darray_item(info.names, kc),
|
||||
darray_item(keymap->key_names, kc).name);
|
||||
|
||||
if (info.name)
|
||||
keymap->keycodes_section_name = strdup(info.name);
|
||||
|
|
|
@ -1445,15 +1445,15 @@ static bool
|
|||
FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym,
|
||||
xkb_keycode_t *kc_rtrn)
|
||||
{
|
||||
xkb_keycode_t key;
|
||||
xkb_keycode_t kc;
|
||||
unsigned int group, level, min_group = UINT_MAX, min_level = UINT_MAX;
|
||||
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
||||
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
|
||||
for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
|
||||
for (group = 0; group < XkbKeyNumGroups(keymap, kc); group++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group);
|
||||
level++) {
|
||||
if (XkbKeyNumSyms(keymap, key, group, level) != 1 ||
|
||||
(XkbKeySymEntry(keymap, key, group, level))[0] != sym)
|
||||
if (XkbKeyNumSyms(keymap, kc, group, level) != 1 ||
|
||||
(XkbKeySymEntry(keymap, kc, group, level))[0] != sym)
|
||||
continue;
|
||||
|
||||
/*
|
||||
|
@ -1463,7 +1463,7 @@ FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym,
|
|||
*/
|
||||
if (group < min_group ||
|
||||
(group == min_group && level < min_level)) {
|
||||
*kc_rtrn = key;
|
||||
*kc_rtrn = kc;
|
||||
if (group == 0 && level == 0) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ test_key_seq(struct xkb_keymap *keymap, ...)
|
|||
struct xkb_state *state;
|
||||
|
||||
va_list ap;
|
||||
xkb_keycode_t keycode;
|
||||
xkb_keycode_t kc;
|
||||
int op;
|
||||
xkb_keysym_t keysym;
|
||||
|
||||
|
@ -77,16 +77,16 @@ test_key_seq(struct xkb_keymap *keymap, ...)
|
|||
va_start(ap, keymap);
|
||||
|
||||
for (;;) {
|
||||
keycode = va_arg(ap, int) + EVDEV_OFFSET;
|
||||
kc = va_arg(ap, int) + EVDEV_OFFSET;
|
||||
op = va_arg(ap, int);
|
||||
|
||||
nsyms = xkb_key_get_syms(state, keycode, &syms);
|
||||
fprintf(stderr, "got %d syms for key 0x%x: [", nsyms, keycode);
|
||||
nsyms = xkb_key_get_syms(state, kc, &syms);
|
||||
fprintf(stderr, "got %d syms for key 0x%x: [", nsyms, kc);
|
||||
|
||||
if (op == DOWN || op == BOTH)
|
||||
xkb_state_update_key(state, keycode, XKB_KEY_DOWN);
|
||||
xkb_state_update_key(state, kc, XKB_KEY_DOWN);
|
||||
if (op == UP || op == BOTH)
|
||||
xkb_state_update_key(state, keycode, XKB_KEY_UP);
|
||||
xkb_state_update_key(state, kc, XKB_KEY_UP);
|
||||
|
||||
for (i = 0; i < nsyms; i++) {
|
||||
keysym = va_arg(ap, int);
|
||||
|
|
Loading…
Reference in New Issue