diff --git a/.changes/x11-pending-events-buildup.md b/.changes/x11-pending-events-buildup.md new file mode 100644 index 0000000..9ed5ce7 --- /dev/null +++ b/.changes/x11-pending-events-buildup.md @@ -0,0 +1,5 @@ +--- +"global-hotkey": patch +--- + +Always service all pending events to avoid a queue of events from building up. \ No newline at end of file diff --git a/src/platform_impl/x11/mod.rs b/src/platform_impl/x11/mod.rs index 509f1ad..ab8fd85 100644 --- a/src/platform_impl/x11/mod.rs +++ b/src/platform_impl/x11/mod.rs @@ -199,7 +199,8 @@ fn events_processor(thread_rx: Receiver) { let mut event: xlib::XEvent = std::mem::zeroed(); loop { - if (xlib.XPending)(display) > 0 { + // Always service all pending events to avoid a queue of events from building up. + while (xlib.XPending)(display) > 0 { (xlib.XNextEvent)(display, &mut event); match event.get_type() { e @ xlib::KeyPress | e @ xlib::KeyRelease => {