Skip to content

Commit 05fb5f1

Browse files
committed
x11: Ignore key repetition
This backend should avoid producing key press events for key repeat, the libinput backend. You can see in `wev` that this prevents repeated key press events on held keys that don't happen with libinput.
1 parent c9791e5 commit 05fb5f1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/backend/x11/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ use x11rb::{
111111
protocol::{
112112
self as x11,
113113
dri3::ConnectionExt as _,
114+
xinput,
114115
xproto::{ColormapAlloc, ConnectionExt, CreateWindowAux, VisualClass, WindowClass, WindowWrapper},
115116
ErrorKind,
116117
},
@@ -792,6 +793,10 @@ impl X11Inner {
792793
}
793794

794795
x11::Event::XinputKeyPress(key_press) => {
796+
if key_press.flags.contains(xinput::KeyEventFlags::KEY_REPEAT) {
797+
return;
798+
}
799+
795800
if let Some(window) = X11Inner::window_ref_from_id(inner, &key_press.event) {
796801
// Do not hold the lock.
797802
let count = { inner.lock().unwrap().key_counter.fetch_add(1, Ordering::SeqCst) + 1 };

0 commit comments

Comments
 (0)