From f763fc75599a1cf2ae1d7bfb82bf093ce6b44f5e Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 14 Oct 2022 01:21:25 -0400
Subject: [PATCH] events: Key repeat waits the delay PLUS one interval at
start.
In 1.2, this just sets a flag when the delay is done and restarts
the counter for the first interval, but doesn't send a repeat
keydown event at this point. To simplify, we just set the initial
wait to be the delay plus the interval instead of just the delay.
Fixes #251.
---
src/SDL12_compat.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index b0fb649a4..468322693 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -4306,7 +4306,8 @@ static int FlushPendingKeydownEvent(Uint32 unicode)
if (KeyRepeatDelay) {
SDL20_memcpy(&KeyRepeatEvent, &PendingKeydownEvent, sizeof (SDL12_Event));
- KeyRepeatNextTicks = SDL20_GetTicks() + KeyRepeatDelay;
+ /* SDL 1.2 waits for the delay, and then a full interval past that before the first repeat is reported. */
+ KeyRepeatNextTicks = SDL20_GetTicks() + KeyRepeatDelay + KeyRepeatInterval;
}
/* Reset the event. */