Fix backspace in grab mode: inject KEY_BACKSPACE via uinput

When grab is enabled, the physical key is intercepted by evdev grab.
The engine's pop() updates the buffer but the KEY_BACKSPACE was never
injected — send_char('\x08') can't emit a keycode and fell through to
paste_string. Now backspace injects KEY_BACKSPACE press+release via
uinput directly.
This commit is contained in:
vndangkhoa 2026-06-24 18:04:09 +07:00
parent cdb5eb4812
commit 42595d4bae

View file

@ -439,6 +439,19 @@ fn run_with_evdev(
// as separate channels have no ordering guarantee.
let keycode = key.0;
// Backspace in grab mode: pop engine, inject via uinput.
// send_char('\x08') can't emit a keycode and falls through
// to paste_string, which is wrong.
if key == evdev::Key::KEY_BACKSPACE && grabbed {
if value == 1 || value == 2 {
daemon.engine.process_key('\x08');
injector.send_key_event(14, 1);
injector.send_key_event(14, 0);
}
consumed_keys.insert(keycode);
continue;
}
if value == 1 {
// Press: process through engine
if consumed_keys.contains(&keycode) {