mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
input: kitty: fix alternate codepoint sometimes not being reported
When alternate key reporting is enabled (i.e. when we're supposed to report the shifted key along with the unshifted key), we try to figure out whether the key really is shifted or not (and thus which xkb keysym to use for the unshifted and shifted keys in the escape). This was done by getting the layout's *all* modifier combinations that produce the shifted keysym, and if any of of them contained a modifier that isn't supported by the kitty protocol, the shifted and unshifted keys are derived from the same keysym. This is to ensure we handle things like AltGr-combos correctly. The issue is, since there may be more than one modifier combination generating the shifted keysym, we may end up using the wrong keysym just because _another_ combination set contains modifiers not supported by the kitty protocol. What we're interrested in is whether the *pressed* set of modifiers contains such modifiers. Closes #1918
This commit is contained in:
parent
22e1b1610f
commit
2ff38e86a7
2 changed files with 9 additions and 23 deletions
|
|
@ -71,6 +71,13 @@
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
* Kitty keyboard protocol: alternate key reporting failing to report
|
||||||
|
the alternate codepoint in some corner cases ([#1918][1918]).
|
||||||
|
|
||||||
|
[1918]: https://codeberg.org/dnkl/foot/issues/1918
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
|
|
|
||||||
25
input.c
25
input.c
|
|
@ -1315,29 +1315,8 @@ emit_escapes:
|
||||||
* (yes, this matches what kitty does, as of 0.23.1)
|
* (yes, this matches what kitty does, as of 0.23.1)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Get the key's shift level */
|
const bool use_level0_sym = (ctx->mods & ~seat->kbd.kitty_significant) == 0;
|
||||||
xkb_level_index_t lvl = xkb_state_key_get_level(
|
const xkb_keysym_t sym_to_use = use_level0_sym && ctx->level0_syms.count > 0
|
||||||
seat->kbd.xkb_state, ctx->key, ctx->layout);
|
|
||||||
|
|
||||||
/* And get all modifier combinations that, combined with
|
|
||||||
* the pressed key, results in the current shift level */
|
|
||||||
xkb_mod_mask_t masks[32];
|
|
||||||
size_t mask_count = xkb_keymap_key_get_mods_for_level(
|
|
||||||
seat->kbd.xkb_keymap, ctx->key, ctx->layout, lvl,
|
|
||||||
masks, ALEN(masks));
|
|
||||||
|
|
||||||
/* Check modifier combinations - if a combination has
|
|
||||||
* modifiers not in our set of 'significant' modifiers,
|
|
||||||
* use key sym as-is */
|
|
||||||
bool use_level0_sym = true;
|
|
||||||
for (size_t i = 0; i < mask_count; i++) {
|
|
||||||
if ((masks[i] & ~seat->kbd.kitty_significant) > 0) {
|
|
||||||
use_level0_sym = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xkb_keysym_t sym_to_use = use_level0_sym && ctx->level0_syms.count > 0
|
|
||||||
? ctx->level0_syms.syms[0]
|
? ctx->level0_syms.syms[0]
|
||||||
: sym;
|
: sym;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue