新增开关 general.caret_state_indicator_on_focus(默认关闭,需同时开启光标 状态提示)。 - DLL 把以下情况视为“换了输入框”:焦点窗口变化(Win32 编辑框、对话框、 其他应用各有自己的窗口);焦点经过一段没有可编辑文档的间隙后落到可 编辑文档上(Chromium、WPF 等单窗口宿主在字段之间就是先失焦再聚焦); 焦点会话真正结束后重新开始。Chromium 打字时在两个可编辑文档之间直接 替换文档管理器,不会触发。从 Win+. 面板返回不计入;线程焦点在真正的 应用切换后返回计入。一次切换的多次回调由定时器合并为一次提示;组字 过程中、以及没有光标的控件都保持静默。每次判断在 TSF 诊断日志里记录 判定标志,不含任何文本 - 协议复用 IMESwitch:wch 改为 FanyImeCaretStateTrigger(UserToggle / CapsLockEdge / FocusEntered),CapsLockEdge 保持首发时的 VK_CAPITAL 取值,Server 对未知值按 UserToggle 处理 - Server 在开关打开时显示当前的有效模式(Caps Lock 开启时为“英”); 配置项同步写入两份模板和两个设置窗口宿主的读写映射 - 设置页在光标状态提示卡片中增加“切换输入框时提示”开关
34 lines
1.3 KiB
C++
34 lines
1.3 KiB
C++
#include "Thread/FocusAnnouncementPolicy.h"
|
|
|
|
int main()
|
|
{
|
|
// Do not use assert: Release builds must execute these checks too.
|
|
|
|
// Chromium swapping document managers between two editable documents in
|
|
// the same window while the session stays up is typing, not a new field.
|
|
if (ShouldAnnounceDocumentFocus(true, false, true, false))
|
|
return 1;
|
|
// A different focus window: another Win32 edit, a dialog, another app.
|
|
if (!ShouldAnnounceDocumentFocus(true, true, true, false))
|
|
return 2;
|
|
// Same window, but focus passed through no editable document first: a
|
|
// single-window host (Chromium, WPF) moving from one field to the next.
|
|
if (!ShouldAnnounceDocumentFocus(true, false, false, false))
|
|
return 3;
|
|
// Coming back after the focus session really ended.
|
|
if (!ShouldAnnounceDocumentFocus(true, false, true, true))
|
|
return 4;
|
|
// Focus on something that cannot take text never announces.
|
|
if (ShouldAnnounceDocumentFocus(false, true, false, true))
|
|
return 5;
|
|
|
|
if (!ShouldAnnounceThreadFocusReturn(true, false))
|
|
return 6;
|
|
// Closing the Win+. panel returns thread focus without a field change.
|
|
if (ShouldAnnounceThreadFocusReturn(true, true))
|
|
return 7;
|
|
if (ShouldAnnounceThreadFocusReturn(false, false))
|
|
return 8;
|
|
return 0;
|
|
}
|