diff options
author | Ran Benita <ran@unusedvar.com> | 2020-04-05 00:07:57 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-04-18 22:23:06 +0300 |
commit | 860cfc039fef7e6067170e4dee224a8c1cec56af (patch) | |
tree | 664a14e49aa09abdfa7f00a949577d6e3a150c4c /test | |
parent | 908e014f0176734e1882da12167c6cc46f94a795 (diff) | |
download | xorg-lib-libxkbcommon-860cfc039fef7e6067170e4dee224a8c1cec56af.tar.gz |
keymap: don't forget about fallback mappings in xkb_keymap_key_get_mods_for_level()
If the active set of modifiers doesn't match any explicit entry of the
key type, the resulting level is 0 (i.e. Level 1). Some key types don't
explicitly map Level 1, taking advantage of this fallback.
Previously, xkb_keymap_key_get_mods_for_level didn't consider this, and
only reported masks for explicit mappings. But this causes some glaring
omissions, like matching "a" in the "us" keymap returning not results.
Since every mask which isn't explicitly mapped falls back to 0, we can't
return the all. Almost always the best choice for this is the empty
mask, so return that, when applicable.
Fixes https://github.com/xkbcommon/libxkbcommon/issues/140.
Reported-by: https://github.com/AliKet
Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/keymap.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/keymap.c b/test/keymap.c index 75e59f3..a6bade8 100644 --- a/test/keymap.c +++ b/test/keymap.c @@ -69,7 +69,8 @@ main(void) // AC01 level 0 ('a') requires no modifiers on us-pc104 mask_count = xkb_keymap_key_get_mods_for_level(keymap, kc, 0, 0, masks_out, 4); - assert(mask_count == 0); + assert(mask_count == 1); + assert(masks_out[0] == 0); shift_mask = 1 << xkb_keymap_mod_get_index(keymap, "Shift"); lock_mask = 1 << xkb_keymap_mod_get_index(keymap, "Lock"); |