From 22fa45b3c1392c16f52b49ef01caa19cfa9731e7 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Thu, 5 Jun 2025 12:14:54 -0400
Subject: [PATCH] win32: Ensure that text input is initially disabled when
creating a window
Windows seems to implicitly enable IME text input on windows created while an IME is active, which causes the IME suggestion window to pop up when keys are pressed, even if a client never explicitly enabled it. Ensure that IME support is initially disabled on new windows; SDL will enable it at a later time, if required.
---
src/video/windows/SDL_windowswindow.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index f61dc0e8f8d24..de2788290176d 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -33,6 +33,7 @@
#include "../SDL_sysvideo.h"
#include "SDL_windowsvideo.h"
+#include "SDL_windowskeyboard.h"
#include "SDL_windowswindow.h"
// Dropfile support
@@ -780,6 +781,9 @@ bool WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties
return false;
}
+ // Ensure that the IME isn't active on the new window until explicitly requested.
+ WIN_StopTextInput(_this, window);
+
// Inform Windows of the frame change so we can respond to WM_NCCALCSIZE
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE);