Merge pull request #193: Detach the game window from the input method (shenjackyuanjie)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-31 12:51:45 +03:00
commit 1681ad1bd6
2 files changed
+8 -2

No files matched your search

+6
View File
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <imm.h>
#include "cfg.h"
#include "flight.h"
@@ -484,6 +485,11 @@ static DWORD WINAPI window_main(void *arg) {
rt_log("gfx: CreateWindowEx failed (%lu)", GetLastError());
g_wnd_failed = 1;
} else {
// An IME switched on over the game attaches to this window and then shows its candidate window and eats the keys
// it composes, although there is nothing here to type into (Shift, which a player may have bound as the walk key,
// is one of the keys a Chinese IME takes). Detaching the game's window leaves the software keyboard alone: its
// edit box is a window of its own and gets the IME it needs.
ImmAssociateContext(g_hwnd, NULL);
// The frame was measured at the system DPI; the window may have opened on a monitor at another scale.
InterlockedExchange(&g_dpi, (LONG)GetDpiForWindow(g_hwnd));
outer_size(g_hwnd, cw, ch, &ow, &oh);