aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-26 19:54:42 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-03-08 19:30:23 +0000
commit6cd72bdee6c2b11f7cab15df9afb0ed92a7f8ba0 (patch)
tree4cb505998ad409c7725c0a2b0a64e98138aba2b2
parentMerge branch 'xkbcommon-bump' (diff)
input: do not include consumed modifiers in the set sent to the client
When sending a key escape sequence to the client application, do not include consumed modifiers. Fixes part of #376
-rw-r--r--CHANGELOG.md2
-rw-r--r--input.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc90b279..d1d9629e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -78,6 +78,8 @@
**must** now be written as either `Control+C` or `Control+Shift+c`,
the latter being the preferred
variant. (https://codeberg.org/dnkl/foot/issues/376)
+* Consumed modifiers are no longer sent to the client application
+ (https://codeberg.org/dnkl/foot/issues/376).
* The minimum version requirement for the libxkbcommon dependency is
now 1.0.0.
diff --git a/input.c b/input.c
index 98abac9c..110bd378 100644
--- a/input.c
+++ b/input.c
@@ -1026,10 +1026,10 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
*/
enum modifier keymap_mods = MOD_NONE;
- keymap_mods |= seat->kbd.shift ? MOD_SHIFT : MOD_NONE;
- keymap_mods |= seat->kbd.alt ? MOD_ALT : MOD_NONE;
- keymap_mods |= seat->kbd.ctrl ? MOD_CTRL : MOD_NONE;
- keymap_mods |= seat->kbd.meta ? MOD_META : MOD_NONE;
+ keymap_mods |= mods & ~consumed & shift ? MOD_SHIFT : MOD_NONE;
+ keymap_mods |= mods & ~consumed & alt ? MOD_ALT : MOD_NONE;
+ keymap_mods |= mods & ~consumed & ctrl ? MOD_CTRL : MOD_NONE;
+ keymap_mods |= mods & ~consumed & meta ? MOD_META : MOD_NONE;
const struct key_data *keymap;
if (sym == XKB_KEY_Escape && keymap_mods == MOD_NONE && term->modify_escape_key) {
@@ -1113,7 +1113,7 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
}
else {
- if (mods & alt) {
+ if (mods & ~consumed & alt) {
/*
* When the alt modifier is pressed, we do one out of three things:
*