mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-25 01:40:19 -05:00
kitty: implement “base layout key” in “report alternate key”
This commit is contained in:
parent
010c4001d2
commit
7e9ca65f4d
1 changed files with 31 additions and 5 deletions
36
input.c
36
input.c
|
|
@ -1248,7 +1248,7 @@ emit_escapes:
|
||||||
encoded_mods |= mods & (1 << seat->kbd.mod_num) ? (1 << 7) : 0;
|
encoded_mods |= mods & (1 << seat->kbd.mod_num) ? (1 << 7) : 0;
|
||||||
encoded_mods++;
|
encoded_mods++;
|
||||||
|
|
||||||
int key = -1, alternate = -1;
|
int key = -1, alternate = -1, base = -1;
|
||||||
char final;
|
char final;
|
||||||
|
|
||||||
switch (sym) {
|
switch (sym) {
|
||||||
|
|
@ -1431,8 +1431,23 @@ emit_escapes:
|
||||||
key = xkb_keysym_to_utf32(sym_to_use);
|
key = xkb_keysym_to_utf32(sym_to_use);
|
||||||
if (key == 0)
|
if (key == 0)
|
||||||
key = sym_to_use;
|
key = sym_to_use;
|
||||||
else
|
|
||||||
|
if (report_alternate) {
|
||||||
|
/* The *shifted* key. May be the same as the unshifted
|
||||||
|
* key - if so, this is filtered out below, when
|
||||||
|
* emitting the CSI */
|
||||||
alternate = xkb_keysym_to_utf32(sym);
|
alternate = xkb_keysym_to_utf32(sym);
|
||||||
|
|
||||||
|
/* Base layout key. I.e the symbol the pressed key
|
||||||
|
* produces in the base/default layout (layout idx
|
||||||
|
* 0) */
|
||||||
|
const xkb_keysym_t *base_syms;
|
||||||
|
int base_sym_count = xkb_keymap_key_get_syms_by_level(
|
||||||
|
seat->kbd.xkb_keymap, ctx->key, 0, 0, &base_syms);
|
||||||
|
|
||||||
|
if (base_sym_count > 0)
|
||||||
|
base = xkb_keysym_to_utf32(base_syms[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final = 'u';
|
final = 'u';
|
||||||
|
|
@ -1463,9 +1478,20 @@ emit_escapes:
|
||||||
bytes = snprintf(p, left, "\x1b[%u", key);
|
bytes = snprintf(p, left, "\x1b[%u", key);
|
||||||
p += bytes; left -= bytes;
|
p += bytes; left -= bytes;
|
||||||
|
|
||||||
if (report_alternate && alternate > 0 && alternate != key) {
|
if (report_alternate) {
|
||||||
bytes = snprintf(p, left, ":%u", alternate);
|
bool emit_alternate = alternate > 0 && alternate != key;
|
||||||
p += bytes; left -= bytes;
|
bool emit_base = base > 0 && base != key && base != alternate;
|
||||||
|
|
||||||
|
if (emit_alternate) {
|
||||||
|
bytes = snprintf(p, left, ":%u", alternate);
|
||||||
|
p += bytes; left -= bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (emit_base) {
|
||||||
|
bytes = snprintf(
|
||||||
|
p, left, "%s:%u", !emit_alternate ? ":" : "", base);
|
||||||
|
p += bytes; left -= bytes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encoded_mods > 1 || event[0] != '\0' || report_associated_text) {
|
if (encoded_mods > 1 || event[0] != '\0' || report_associated_text) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue