Commit: a87dbc0319ec0b82832b21dcfb48a31676c49d95
Parent: 5764895236c87fcdea9e9a2d1960525feafd9a7c
Author: Randy Palamar
Date: Tue, 10 Mar 2026 12:00:22 -0600
portage: xdotool: patch for fixing input delay code
Diffstat:
1 file changed, 50 insertions(+), 0 deletions(-)
diff --git a/.config/sys/etc/portage/patches/x11-misc/xdotool/delay.patch b/.config/sys/etc/portage/patches/x11-misc/xdotool/delay.patch
@@ -0,0 +1,50 @@
+From ec33b87748e39136a2b1c0eebc4f591949fc3d52 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jo=C3=A3o=20Lucas?= <jlucas@disroot.org>
+Date: Fri, 26 Dec 2025 16:38:20 +0000
+Subject: [PATCH] Fix #471 total type delay
+
+Commit c5e037a0edeebef728c9a276ad1a4ef25ec64721 fixed key repetition for
+large delays, but ended up breaking smaller delays by hardcoding a
+keydown delay. It also added an additional 50ms delay for each key.
+
+This patch makes it not exceed user-specified delay, while keeping the
+key repetition fix.
+---
+ xdo.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/xdo.c b/xdo.c
+index 5215387..d417471 100644
+--- a/xdo.c
++++ b/xdo.c
+@@ -983,8 +983,13 @@ int xdo_click_window_multiple(const xdo_t *xdo, Window window, int button,
+
+ /* XXX: Return proper code if errors found */
+ int xdo_enter_text_window(const xdo_t *xdo, Window window, const char *string, useconds_t delay) {
+- /* Keep the original delay for key up events, but use 50000 microseconds (50ms) for key down */
+- useconds_t down_delay = 50000;
++ /* Split delay into keyup and keydown, not letting keydown exceed 50000 (50ms) */
++ useconds_t down_delay, up_delay;
++ down_delay = up_delay = delay / 2;
++ if (down_delay > 50000) {
++ down_delay = 50000;
++ up_delay = delay - down_delay;
++ }
+
+ charcodemap_t key;
+ setlocale(LC_CTYPE,"");
+@@ -1002,11 +1007,11 @@ int xdo_enter_text_window(const xdo_t *xdo, Window window, const char *string, u
+ continue;
+ }
+
+- /* Send the key press event with the fixed 50ms delay */
++ /* Send the key press event */
+ xdo_send_keysequence_window_list_do(xdo, window, &key, 1, True, NULL, down_delay);
+ key.needs_binding = 0;
+- /* Send the key release event with the user-specified delay */
+- xdo_send_keysequence_window_list_do(xdo, window, &key, 1, False, NULL, delay);
++ /* Send the key release event */
++ xdo_send_keysequence_window_list_do(xdo, window, &key, 1, False, NULL, up_delay);
+ }
+
+ return XDO_SUCCESS;