mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-26 01:40:12 -05:00
input: bind key bindings to raw key codes too
Before, when looking for a matching user key binding, we only matched *symbols*. This means that the physical keys that generate a specific key binding is layout dependent. What's worse, it may not even be possible to generate the key binding at all. Russian is one such layout, where all the "normal" (us) symbols are replaced. By using raw key codes, we can get around this - the key code has a direct mapping to the physical key. However, matching raw key codes **only** doesn't always make sense either. For now, match **both** symbols _and_ key codes. Symbols take precedence. TODO: we might have to make this configurable _per binding_. Note: 'search' mode still uses mostly hardcoded shortcuts that still have this problem (i.e. ctrl+g doesn't work with a russian layout).
This commit is contained in:
parent
fb5ab022de
commit
6d30e7d15d
4 changed files with 61 additions and 1 deletions
9
search.c
9
search.c
|
|
@ -430,10 +430,19 @@ search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym,
|
|||
* User configurable bindings
|
||||
*/
|
||||
tll_foreach(term->wl->kbd.bindings.search, it) {
|
||||
/* Match symbol */
|
||||
if (it->item.mods == mods && it->item.sym == sym) {
|
||||
input_execute_binding(term, it->item.action, serial);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Match raw key code */
|
||||
tll_foreach(it->item.key_codes, code) {
|
||||
if (code->item == key) {
|
||||
input_execute_binding(term, it->item.action, serial);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Cancel search */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue