Files
msime-windows/server
Lu Fan(SonnyCalcr) ef28cf690d fix(server,ui,ui-html): 打磨 Direct2D 设置窗口:图标、检查更新、热力图、滚动与冷启动 (#1001)
* fix(ui): SVG 按整像素栅格化、滚动改为跟手的指数滑动,并可预热 D3D 设备

- GetSvgBitmap 按四舍五入的像素尺寸建位图,避免 D2D 向上取整后被挤压采样
- ScrollViewer 平滑滚动改为按帧时间逼近目标:连续滚轮不再每格从零速重起,
  内容按整设备像素排布,滑动中文字不再抖动
- 新增 DeviceResources::PrewarmComposition,在后台线程提前创建 D3D11 设备,
  首帧复用,省去约 200ms 的驱动初始化

* fix(server): 修复 Direct2D 设置窗口的图标、检查更新与热力图交互,加快冷启动

- 侧栏等 SVG 图标对齐设备像素绘制,不再发糊
- 关于页「检查更新」:页面持有状态,点击不再无反应;按钮加悬停描边与按下位移;
  后台任务结果改为投递消息回窗口,窗口被遮挡时不再因 WM_TIMER 被压制而卡在「正在检查…」
- 弹窗按显式宽度测量内容,换行文字不再与下一行重叠
- 以 --about 打开时侧栏指示条落在「关于」
- 日历热力图可横向滚动(拖动滑块、点击轨道、Shift+滚轮),滚动条与竖向一致:
  8px、无箭头、2px 圆角;悬停格子 500ms 后显示日期与字数
- 滚轮每格 60px;暗色主题首帧前不再闪白(按主题色擦底并在首帧前隐藏窗口)
- 启动时预热 D3D 设备,首帧从约 300ms 降到约 140ms

* fix(ui-html): 热力图滚动条与页面竖向滚动条一致,检查更新按钮加悬停与按下反馈

与 Direct2D 设置窗口的同步改动保持一致。
2026-10-16 18:51:21 +08:00
..
2026-03-12 01:34:41 +08:00
2025-04-16 02:03:11 +08:00
2025-11-10 21:10:36 +08:00

Metasequoia IME Server(水杉输入法 Server 端)

This is the server end of MSIME-Windows.

How to build

Prerequisites

  • Visual Studio 2026
  • CMake
  • vcpkg
  • Python3.10+
  • Boost
  • Node.js and pnpm 10 (settings page build)

Make sure vcpkg and Boost are installed by Scoop.

Build steps(For Dev)

Clone the product and provision the reviewed dictionary release from its root:

git clone --recursive https://github.com/metasequoiaime/MSIME-Windows.git
cd MSIME-Windows
python scripts/product_lock.py fetch-dictionaries --staging-root .
if ($LASTEXITCODE -ne 0) { throw 'Dictionary verification failed' }
$devLocalData = Join-Path $PWD 'build/dev-local'
$devData = Join-Path $devLocalData 'metasequoiaime'
New-Item -ItemType Directory -Force $devData | Out-Null
Copy-Item MetasequoiaImeDict/out/* $devData -Force
Copy-Item engine/helpcode/helpcodes $devData -Recurse -Force
Copy-Item server/assets/tables/* $devData -Force
Copy-Item server/assets/config/config.toml $devData -Force
Push-Location ui-html/webview2/settings/ime-settings
try {
    pnpm install --frozen-lockfile
    if ($LASTEXITCODE -ne 0) { throw 'Settings dependencies failed' }
    pnpm build
    if ($LASTEXITCODE -ne 0) { throw 'Settings page build failed' }
} finally { Pop-Location }
$devWebview = Join-Path $devData 'html/webview2'
New-Item -ItemType Directory -Force $devWebview | Out-Null
foreach ($part in @('shared', 'candwnd', 'ftb', 'menu')) {
    Copy-Item "ui-html/webview2/$part" $devWebview -Recurse -Force
}
$devSettings = Join-Path $devWebview 'settings/ime-settings'
New-Item -ItemType Directory -Force $devSettings | Out-Null
Copy-Item ui-html/webview2/settings/ime-settings/dist $devSettings -Recurse -Force
python server/scripts/prepare_env.py
if ($LASTEXITCODE -ne 0) { throw 'Server environment setup failed' }
$env:LOCALAPPDATA = $devLocalData
$env:METASEQUOIA_IME_DATA_DIR = $devData
cd server

Use a dedicated PowerShell terminal. These steps stage the same locked data as CI and the current product pages in a separate development directory. Both LOCALAPPDATA (Windows config/pages) and METASEQUOIA_IME_DATA_DIR (Engine data) are set for that terminal; setting only the latter would still use installed Windows configuration and pages. Close the terminal after development. Dictionary source changes belong in Engine's dictionary/; use its root build_profile.py to build data instead of calling internal stages in the archived Dict repository.

Then, build and run,

.\scripts\lcompile.ps1
.\scripts\lrun.ps1

If you want to build and run in one step, run the following command,

.\scripts\llaunch.ps1

Watchdog

MetasequoiaImeWatchdog.exe is built next to the server. Starting the server directly also starts the watchdog, which monitors the server from the same directory and restarts it after an unexpected exit. Repeated early crashes use an exponential restart delay (up to 30 seconds) to avoid a restart storm.

The developer terminate shortcut stops both processes. The restart shortcut asks the watchdog to start a fresh server after the current process exits.

English prefix candidates

Place english.db next to msime.db in %LOCALAPPDATA%\metasequoiaime. Set general.cn_en_mixed_input = true in config.toml to enable asynchronous English prefix candidates for Quanpin and Shuangpin. The master switch utility.mixed_candidates must also be on; English, emoji, kaomoji and date/time mixed candidates are queried together on the single MixedCandidates worker thread (src/mixed/).

Developer Shortcuts

The server process includes a few built-in global shortcuts that are useful during development:

  • Ctrl + Shift + Alt + T
    • terminate MetasequoiaImeServer immediately
  • Ctrl + Shift + Alt + R
    • restart MetasequoiaImeServer
    • Settings exposes the same restart under 外观 → 重启输入法进程; it reaches the server over the Aux pipe because Settings runs in its own process
  • Ctrl + Shift + Alt + C
    • clear IME engine cache
  • Ctrl + Shift + Alt + 1 to Ctrl + Shift + Alt + 8
    • delete candidate 1 to 8 from the current candidate window
    • this only works while the candidate window is visible

Screenshots

Shared voice providers

The server links Engine VoiceCapture and Voice. WAV encoding and batch transcription/polish codecs come from the public library; Windows keeps provider configuration, SiliconFlow padding/retry behavior and Doubao streaming. Batch uploads are bounded to 20 MiB and responses to 1 MiB. Failed or empty polish responses retain the original transcript.

本地 Release 构建脚本可通过 -ManifestTool <mt.exe 路径> 使用其他 Windows SDK;未指定时沿用现有 SDK 路径。配置、编译或 manifest 嵌入失败都会中止,避免安装器收集旧产物。