From a0dad58dbfff25154013002662d446545de9b271 Mon Sep 17 00:00:00 2001 From: Tom Rothamel Date: Mon, 9 Sep 2019 22:57:33 -0400 Subject: [PATCH] Ignore printable keycodes without unicode. This should fix a race condition where that could cause unprefixed key commands (like 'v' or 'a') to trigger if KEYDOWN is present but the TEXTINPUT hasn't been delivered yet. --- renpy/display/behavior.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/renpy/display/behavior.py b/renpy/display/behavior.py index 02229d4b59..c4942e099b 100644 --- a/renpy/display/behavior.py +++ b/renpy/display/behavior.py @@ -1386,7 +1386,10 @@ def event(self, ev, x, y, st): if ev.unicode and ord(ev.unicode[0]) >= 32: raw_text = ev.unicode elif renpy.display.interface.text_event_in_queue(): - raw_text = '' + raise renpy.display.core.IgnoreEvent() + elif (32 <= ev.key < 127) and not (ev.mod & (pygame.KMOD_ALT | pygame.KMOD_META)): + # Ignore printable keycodes without unicode. + raise renpy.display.core.IgnoreEvent() if raw_text is not None: