aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'input.c')
-rw-r--r--input.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/input.c b/input.c
index e8e84fb7..aa6b7f1d 100644
--- a/input.c
+++ b/input.c
@@ -1605,6 +1605,9 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (released)
stop_repeater(seat, key);
+ if (pressed)
+ seat->kbd.last_shortcut_sym = XKB_KEYSYM_MAX + 1;
+
bool should_repeat =
pressed && xkb_keymap_key_repeats(seat->kbd.xkb_keymap, key);
@@ -1706,6 +1709,7 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (bind->k.sym == raw_syms[i] &&
execute_binding(seat, term, bind, serial, 1))
{
+ seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat;
}
}
@@ -1719,6 +1723,7 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
bind->mods == (mods & ~consumed) &&
execute_binding(seat, term, bind, serial, 1))
{
+ seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat;
}
}
@@ -1734,12 +1739,31 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (code->item == key &&
execute_binding(seat, term, bind, serial, 1))
{
+ seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat;
}
}
}
}
+ if (released && seat->kbd.last_shortcut_sym == sym) {
+ /*
+ * Don't process a release event, if it corresponds to a
+ * triggered shortcut.
+ *
+ * 1. If we consumed a key (press) event, we shouldn't emit an
+ * escape for its release event.
+ * 2. Ignoring the incorrectness of doing so; this also caused
+ * us to reset the viewport.
+ *
+ * Background: if the kitty keyboard protocol was enabled,
+ * then the viewport was instantly reset to the bottom, after
+ * scrolling up.
+ */
+ //seat->kbd.last_shortcut_sym = XKB_KEYSYM_MAX + 1;
+ goto maybe_repeat;
+ }
+
/*
* Keys generating escape sequences
*/