src/xkbcomp/symbols.c
static struct xkb_key *
FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym)
{
    struct xkb_key *key;
    xkb_layout_index_t group;
    bool got_one_group, got_one_level;

    group = 0;
    do {
        xkb_level_index_t level = 0;
        got_one_group = false;
        do {
            got_one_level = false;
            xkb_keys_foreach(key, keymap) {
                if (group < key->num_groups &&
                    level < XkbKeyNumLevels(key, group)) {
                    got_one_group = got_one_level = true;
                    if (key->groups[group].levels[level].num_syms == 1 &&
                        key->groups[group].levels[level].u.sym == sym)
                        return key;
                }
            }
            level++;
        } while (got_one_level);
        group++;
    } while (got_one_group);

    return NULL;
}
/**
 * Given a keysym @sym, return a key which generates it, or NULL.
 * This is used for example in a modifier map definition, such as:
 *      modifier_map Lock           { Caps_Lock };
 * where we want to add the Lock modifier to the modmap of the key
 * which matches the keysym Caps_Lock.
 * Since there can be many keys which generates the keysym, the key
 * is chosen first by lowest group in which the keysym appears, than
 * by lowest level and than by lowest key code.
 */
Given a keysym @sym, return a key which generates it, or NULL.
This is used for example in a modifier map definition, such as:
modifier_map Lock           { Caps_Lock };
where we want to add the Lock modifier to the modmap of the key
which matches the keysym Caps_Lock.
Since there can be many keys which generates the keysym, the key
is chosen first by lowest group in which the keysym appears, than
by lowest level and than by lowest key code.
Given a keysym @sym return a key which generates it or NULL . This is used for example in a modifier map definition such as : modifier_map Lock { Caps_Lock } ; where we want to add the Lock modifier to the modmap of the key which matches the keysym Caps_Lock . Since there can be many keys which generates the keysym the key is chosen first by lowest group in which the keysym appears than by lowest level and than by lowest key code .
static struct xkb_key *
FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym)
{
    struct xkb_key *key;
    xkb_layout_index_t group;
    bool got_one_group, got_one_level;
    group = 0;
    do {
        xkb_level_index_t level = 0;
        got_one_group = false;
        do {
            got_one_level = false;
            xkb_keys_foreach(key, keymap) {
                if (group < key->num_groups &&
                    level < XkbKeyNumLevels(key, group)) {
                    got_one_group = got_one_level = true;
                    if (key->groups[group].levels[level].num_syms == 1 &&
                        key->groups[group].levels[level].u.sym == sym)
                        return key;
                }
            }
            level++;
        } while (got_one_level);
        group++;
    } while (got_one_group);
    return NULL;
}
static struct xkb_key * FindKeyForSymbol ( struct xkb_keymap * keymap , xkb_keysym_t sym ) { struct xkb_key * key ; xkb_layout_index_t group ; bool got_one_group , got_one_level ; group = 0 ; do { xkb_level_index_t level = 0 ; got_one_group = false ; do { got_one_level = false ; xkb_keys_foreach ( key , keymap ) { if ( group < key -> num_groups && level < XkbKeyNumLevels ( key , group ) ) { got_one_group = got_one_level = true ; if ( key -> groups [ group ] . levels [ level ] . num_syms == 1 && key -> groups [ group ] . levels [ level ] . u . sym == sym ) return key ; } } level ++ ; } while ( got_one_level ) ; group ++ ; } while ( got_one_group ) ; return NULL ; }
Given a keysym @sym, return a key which generates it, or NULL.
Given a keysym @sym return a key which generates it or NULL .