feat(client): 添加 Windows IME 自动控制功能#36
Conversation
XSana
commented
Jan 4, 2026
- 游戏内无 GUI 时自动禁用输入法,防止 WASD 等按键被拦截
- 打开 GUI 时自动启用输入法,方便输入中文
- 通过 JNA 调用 Windows IMM32 API 实现
- 添加配置项 enableIMEControl 可开关此功能
- 仅在 Windows 系统上生效
- 游戏内无 GUI 时自动禁用输入法,防止 WASD 等按键被拦截 - 打开 GUI 时自动启用输入法,方便输入中文 - 通过 JNA 调用 Windows IMM32 API 实现 - 添加配置项 enableIMEControl 可开关此功能 - 仅在 Windows 系统上生效
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bf324117a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dependencies { | ||
| // JNA for Windows IME control | ||
| // shadowImplementation('net.java.dev.jna:jna:5.14.0') | ||
| // shadowImplementation('net.java.dev.jna:jna-platform:5.14.0') | ||
| shadowImplementation('net.java.dev.jna:jna:5.14.0') | ||
| shadowImplementation('net.java.dev.jna:jna-platform:5.14.0') |
There was a problem hiding this comment.
Avoid relocating JNA to keep IME control working
JNA was added as shadowImplementation here while gradle.properties now enables shadowed dependencies with relocation (lines 111‑119). ShadowImplementation relocates classes to a renamed package, but JNA hardcodes the /com/sun/jna/... resource path when loading its jnidispatch native, so relocating it prevents the native library from being found. On Windows builds this yields an UnsatisfiedLinkError during Native.load, causing IMEControl.init() to log a failure and the IME handler never registers, so the new IME auto-control never works. Please either keep JNA unshadowed or exclude it from relocation.
Useful? React with 👍 / 👎.