SDL: Disable "The key you just pressed is not recognized by SDL." message by default

From 91ff88451bb01104eda608bca855f0d14cd2d7cf Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 13 Oct 2022 23:56:17 -0700
Subject: [PATCH] Disable "The key you just pressed is not recognized by SDL."
 message by default

---
 src/video/cocoa/SDL_cocoakeyboard.m | 4 ++--
 src/video/nacl/SDL_naclevents.c     | 2 ++
 src/video/riscos/SDL_riscosevents.c | 2 ++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m
index 02c99e8e72a5..e9f80a41231f 100644
--- a/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/src/video/cocoa/SDL_cocoakeyboard.m
@@ -558,9 +558,9 @@ - (NSArray *)validAttributesForMarkedText
         }
 
         SDL_SendKeyboardKey(SDL_PRESSED, code);
-#if 1
+#ifdef DEBUG_SCANCODES
         if (code == SDL_SCANCODE_UNKNOWN) {
-            fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list <https://discourse.libsdl.org/> or to Christian Walther <cwalther@gmx.ch>. Mac virtual key code is %d.\n", scancode);
+            SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list <https://discourse.libsdl.org/> or to Christian Walther <cwalther@gmx.ch>. Mac virtual key code is %d.\n", scancode);
         }
 #endif
         if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
diff --git a/src/video/nacl/SDL_naclevents.c b/src/video/nacl/SDL_naclevents.c
index f161e9c2ecf1..dbfce081b371 100644
--- a/src/video/nacl/SDL_naclevents.c
+++ b/src/video/nacl/SDL_naclevents.c
@@ -313,9 +313,11 @@ SDL_NACL_translate_keycode(int keycode)
     if (keycode < SDL_arraysize(NACL_Keycodes)) {
         scancode = NACL_Keycodes[keycode];
     }
+#ifdef DEBUG_SCANCODES
     if (scancode == SDL_SCANCODE_UNKNOWN) {
         SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> NACL KeyCode %d", keycode);
     }
+#endif
     return scancode;
 }
 
diff --git a/src/video/riscos/SDL_riscosevents.c b/src/video/riscos/SDL_riscosevents.c
index 56fe39882eb6..fcca4701146c 100644
--- a/src/video/riscos/SDL_riscosevents.c
+++ b/src/video/riscos/SDL_riscosevents.c
@@ -40,9 +40,11 @@ SDL_RISCOS_translate_keycode(int keycode)
     if (keycode < SDL_arraysize(riscos_scancode_table)) {
         scancode = riscos_scancode_table[keycode];
 
+#ifdef DEBUG_SCANCODES
         if (scancode == SDL_SCANCODE_UNKNOWN) {
             SDL_Log("The key you just pressed is not recognized by SDL: %d", keycode);
         }
+#endif
     }
 
     return scancode;