Repository navigation
Conversation
macOS IMKit only sent FocusGained/FocusLost, so the core's handle_ime_activated never ran. With `input.default.remember_last_state = false`, switching away to another input source and back kept the previous English state instead of resetting to `input.default.chinese_mode`. Send IME_ACTIVATED with the same clientToken after FocusGained. The command is async (no ack), so it is sent without readFrame. Add an 8-byte token frame codec helper and a frame roundtrip test. Verified: `cd wind_macos && swift build` (Swift 6.3.3 / macOS 26). Not run: `swift test` (XCTest unavailable in this Command Line Tools-only env).
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
macOS IMKit 端只发
FocusGained/FocusLost,服务端的handle_ime_activated从未被调用。因此input.default.remember_last_state = false的「每次激活重置中英」在 macOS 上不生效:从清风切到 ABC 再切回,仍保持切走前的英文状态。本 PR 在
InputController.activateServer里,于sendFocusGained()之后补发一帧IME_ACTIVATED(复用同一个clientToken),让服务端走与 Windows 相同的apply_initial_mode(..., reset_aux = true)。remember_last_state = false时会重置为input.default.chinese_mode,同时重置全角/标点。IME_ACTIVATED是异步命令、服务端不回 ack,因此只send不readFrame。同时新增
BinaryCodec.encodeTokenFrame(8 字节clientToken载荷)及对应帧 roundtrip 测试。只改 macOS Swift 客户端,没有 Rust / Windows 改动。
变更类型
相关 Issue
Related: #9(Windows 端同类问题已修复;这个 PR 补齐 macOS 的激活重置路径)
测试情况
.\scripts\dev.ps1 ci通过(fmt 检查 + clippy + 测试)补充:
cd wind_macos && swift build通过(Swift 6.3.3 / macOS 26)。swift test未能在提交者环境跑完:当前机器只有 Command Line Tools,没有完整 Xcode,XCTest模块不可用。测试文件已随 PR 提交,在完整 Xcode 环境可运行。.app/.pkg做端到端验证;改动仅在 Swift IMKit 客户端,逻辑路径已按服务端现有协议核对。检查清单
cargo fmt格式化(本 PR 无 Rust 改动)AGENTS.md(本 PR 未改对外接口,N/A)行为说明
macOS 的
activateServer不只发生在「从别的输入法切回清风」时,切换文本框也会调用。因此本改动的效果是:每个新的输入上下文都会按input.default的初始模式重置(remember_last_state = false时即中文)。这与 Windows 上
IME_ACTIVATED的语义一致,也是input.default.remember_last_state文档里写的「每次激活重置」。如果维护者希望只在「输入源切换」时重置、而应用内换文本框保持现状,需要额外区分 macOS 的 TIS 输入源切换通知和普通activateServer;本 PR 先按现有跨平台语义做最小修复,愿意根据维护者的意见调整。