From a9a51cebde21fb198abc661f1d57f48d40eb2327 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 3 Jun 2024 14:41:36 -0700
Subject: [PATCH] Disable raw keyboard input by default
It interferes with keyboard hooks and most applications don't expect key events coming from another thread
---
include/SDL3/SDL_hints.h | 4 ++--
src/video/windows/SDL_windowsvideo.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h
index 0b6fdbabbcc89..a316838654cb3 100644
--- a/include/SDL3/SDL_hints.h
+++ b/include/SDL3/SDL_hints.h
@@ -3464,8 +3464,8 @@ extern "C" {
*
* The variable can be set to the following values:
*
- * - "0": The Windows message loop is used for keyboard events.
- * - "1": Low latency raw keyboard events are used. (default)
+ * - "0": The Windows message loop is used for keyboard events. (default)
+ * - "1": Low latency raw keyboard events are used.
*
* This hint can be set anytime.
*
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 660b59d730e95..3130ecfbf6715 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -54,7 +54,7 @@ SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
static void SDLCALL UpdateWindowsRawKeyboard(void *userdata, const char *name, const char *oldValue, const char *newValue)
{
SDL_VideoDevice *_this = (SDL_VideoDevice *)userdata;
- SDL_bool enabled = SDL_GetStringBoolean(newValue, SDL_TRUE);
+ SDL_bool enabled = SDL_GetStringBoolean(newValue, SDL_FALSE);
WIN_SetRawKeyboardEnabled(_this, enabled);
}