From c39259cc9cd2d44321a188035dc613f1a13a1c6c Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 17 Jun 2021 21:29:24 -0400
Subject: [PATCH] SDL_EnableUNICODE(-1) should query the current state without
changing it.
---
src/SDL12_compat.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 8734e7d..da5e61d 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -5488,12 +5488,14 @@ SDL_GetKeyRepeat(int *delay, int *interval)
DECLSPEC int SDLCALL
SDL_EnableUNICODE(int enable)
{
- int old = EnabledUnicode;
- EnabledUnicode = enable;
- if (enable) {
- SDL20_StartTextInput();
- } else {
- SDL20_StopTextInput();
+ const int old = EnabledUnicode;
+ if (enable >= 0) {
+ EnabledUnicode = enable;
+ if (enable) {
+ SDL20_StartTextInput();
+ } else {
+ SDL20_StopTextInput();
+ }
}
return old;
}