MetasequoiaIME.cpp 有 3000 多行,激活/停用生命周期、按键路径的 edit session 请求、Worker Pipe 读线程和消息窗口处理全挤在一个文件里。按职责 拆成以下几个翻译单元: - MetasequoiaIME.cpp:Server 拉起辅助、CreateInstance、构造/析构、焦点 会话与 composition epoch 校验、本地会话重置、候选 presenter 延迟清理、 QueryInterface/AddRef/Release、ActivateEx/Deactivate、 _WakeServerIfNeeded/_NoteKeyEventIpcFailure 和 ITfFunctionProvider 系列 - MetasequoiaIME_AsyncRequests.cpp:标点、智能标点、延迟应用文本几个 edit session 及其 _Request*EditSession,待取的 Server 候选,异步按键 请求表(_PostAsyncKeyRequest/_TakeAsyncKeyRequest/_ClearAsyncKeyRequests) 和 _ClearPendingIpcRequests - MetasequoiaIME_IpcWorker.cpp:IpcWorkerThread,以及把它收到的上屏、 语音快照和 compartment 切换交给 TSF 线程的令牌表 - MetasequoiaIME_WindowProc.cpp:CMetasequoiaIME_WindowProc 及其用到的 状态快照发送、CommitCandidateAndContinue edit session,还有主题注册表 监听与语言栏图标刷新 - MetasequoiaIMEInternal.h:上述文件之间共享的声明,只给 MetasequoiaIME*.cpp 包含 纯搬移,不改行为:函数体、注释和格式都没动。原来在匿名命名空间里、现在 要跨文件用的 NextWindowMessageToken 仍定义在 MetasequoiaIME.cpp,改放进 metasequoia_ime_detail 命名空间并在内部头文件里声明; CONNECT_NAMEDPIPE_RETRY_INTERVAL_MS 常量挪进内部头文件的同一命名空间。 只被一个文件用到的仍留在该文件的匿名命名空间。_bareShiftHookOwner 这个 thread_local 和 #pragma comment 仍只在 MetasequoiaIME.cpp。没有新增全局 构造器或函数内静态变量。 用脚本比对了原文件与拆分后全部文件的非空、非 #include 行多重集:没有缺 失的行,差异只有新增的声明、命名空间包装、using 指令、#pragma once 和文 件头注释。可用 git diff --color-moved 复核。
Metasequoia IME for Windows
中文 README · Website · Docs · Privacy
A free and open-source Chinese and Japanese input method for Windows 10 and 11, built on TSF with no legacy IMM32 path.
This repository is the whole Windows product: the TSF text service DLL, the resident server, the conversion engine, a self-written native GUI framework, the HTML surfaces and the installer. The engine was imported from MSIME-Engine and specialized for Windows; it now lives in engine/ as a first-party component, so a plain clone builds the product. See engine/UPSTREAM.md.
This is a public beta. Expect rough edges and read the release notes before upgrading.
Install
Download the installer from Releases or the download page, run it, then switch with Win + Space.
Current builds are not code signed. SmartScreen will block them and uiAccess is unavailable, which means the candidate window cannot float above elevated applications. Verify the download with the SHA256 published on the download page.
You need the Microsoft Visual C++ 2015–2022 Redistributable (x64). The server and settings app are 64-bit; the x86 redistributable is a separate package and does not substitute for it. If you cannot switch to the IME, the server keeps exiting, or the settings window closes immediately, install that first.
What it does
- Chinese input: full pinyin, double pinyin (Xiaohe / Ziranma / Shoudao / Microsoft), Wubi 86
- Japanese input: romaji, with hiragana, katakana and dictionary candidates; also available as a temporary mode from Chinese
- Helpcode (形码) filtering on pinyin schemes: six tables, single- and double-code
- Optional cloud candidates, and AI suggestions via DeepSeek / OpenAI / SiliconFlow / Groq
- English-Chinese glosses in the vertical candidate window
- Mixed Chinese-English input, emoji and kaomoji, a dedicated English candidate mode
- Local input statistics (off by default): character counts and active time stay on this machine; view and clean them under Settings → Statistics
- Voice input with streaming recognition and optional cleanup
- Handwriting, on-screen keyboard, floating toolbar, clipboard history
- User dictionary management, candidate frequency tuning, skins with light and dark variants
Privacy
An input method sees every keystroke, so the boundaries are stated explicitly in PRIVACY.md: which features reach the network, what each one sends, what the defaults are, and how to turn each off.
Two things worth knowing up front. Cloud candidates are on by default — the composition spelling goes to Google's input-tools service, and it is the only network feature that works without you supplying a credential. API tokens are stored in plain text in config.toml, unlike macOS and Linux which use the Keychain and Secret Service.
There is no telemetry, analytics or crash reporting of any kind.
Building and contributing
CONTRIBUTING.md has the environment, the build order and what to run before opening a pull request. Contributions do not have to be code — dictionary entries, documentation, icons and compatibility testing all count, and the recruiting page lists them by area.
Note that most issues, documentation and code comments are in Chinese. English pull requests and issues are welcome.
Licence
GPL-3.0. See LICENSE and THIRD_PARTY_NOTICES.txt.