diff --git a/docs/XPath定位.md b/docs/XPath定位.md
index 6f7bdf3..4b5e775 100644
--- a/docs/XPath定位.md
+++ b/docs/XPath定位.md
@@ -397,7 +397,7 @@ i3/o1
点击“检测显示条件”,按提示处理:
-> 检测是在设置页里做的,而设置窗口本身会盖住目标窗口。因此**检测会忽略本工具自己的窗口**(主界面、设置窗口),只报告外部程序的遮挡;运行时仍然会严格判断——设置窗口关掉后,悬浮条才会按条件出现。
+> 本工具自己的窗口(主界面、设置窗口)**不算遮挡**,无论是设置页的检测还是运行时判断:你在设置窗口里配置时,悬浮条照样会按条件显示。只有**别的程序**挡住了锚定窗口,悬浮条才会隐藏,并在检测结果里点名是哪个窗口挡住的。
1. 悬浮条是否启用;
2. 是否有至少一个启用按钮;
diff --git a/src/pacs_win_uia/Services/FloatingBarManager.cs b/src/pacs_win_uia/Services/FloatingBarManager.cs
index 9404fa3..01cf9af 100644
--- a/src/pacs_win_uia/Services/FloatingBarManager.cs
+++ b/src/pacs_win_uia/Services/FloatingBarManager.cs
@@ -392,7 +392,7 @@ namespace pacs_win_uia.Services
var anchor = new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top);
string reason;
if (runtime.Definition.RequireWindowVisible &&
- !WindowVisibility.IsVisibleOnScreen(runtime.Anchor, anchor, _ownProcessId, out reason))
+ !WindowVisibility.IsVisibleOnScreen(runtime.Anchor, anchor, _ownProcessId, true, out reason))
{
Hide(runtime);
return;
@@ -420,32 +420,22 @@ namespace pacs_win_uia.Services
return results.ToArray();
}
- /// Run on a worker thread. Never activates windows, invokes buttons or runs commands.
+ ///
+ /// Run on a worker thread. Never activates windows, invokes buttons or runs commands.
+ ///
+ /// The tool's own windows (main window, settings dialog) never count as occluders here, in the
+ /// runtime check as well as in the settings diagnostic: the operator's own UI is under their
+ /// control, and "the target is behind our own window" must not make the bar silently vanish.
+ /// Only other applications hide it.
+ ///
public static FloatingBarDisplayCheck CheckDisplayConditions(FloatingBarDefinition bar)
- {
- return CheckDisplayConditions(bar, false);
- }
-
- ///
- /// True for the settings-page diagnostic: the tool's own windows (main window, this settings
- /// dialog) are not counted as occluders. While the dialog is open it covers the target, so a
- /// strict check would always report "被遮挡" and tell the operator nothing. Runtime keeps false.
- ///
- public static FloatingBarDisplayCheck CheckDisplayConditions(FloatingBarDefinition bar,
- bool ignoreOwnProcessWindows)
{
IList windows = null;
- return EvaluateDisplay(bar, ref windows, ignoreOwnProcessWindows);
+ return EvaluateDisplay(bar, ref windows);
}
private static FloatingBarDisplayCheck EvaluateDisplay(FloatingBarDefinition bar,
ref IList windows)
- {
- return EvaluateDisplay(bar, ref windows, false);
- }
-
- private static FloatingBarDisplayCheck EvaluateDisplay(FloatingBarDefinition bar,
- ref IList windows, bool ignoreOwnProcessWindows)
{
var result = new FloatingBarDisplayCheck();
try
@@ -490,7 +480,7 @@ namespace pacs_win_uia.Services
result.Details = "锚定窗口:" + window + ";PID=" + window.ProcessId;
if (bar.RequireWindowVisible && !WindowVisibility.IsVisibleOnScreen(window.Handle,
window.WindowRectangle, System.Diagnostics.Process.GetCurrentProcess().Id,
- ignoreOwnProcessWindows, out error))
+ true, out error))
{
result.Reason = "锚定窗口可见性不满足:" + error;
return result;
diff --git a/src/pacs_win_uia/UI/SettingsForm.cs b/src/pacs_win_uia/UI/SettingsForm.cs
index 877f8d6..9b7015f 100644
--- a/src/pacs_win_uia/UI/SettingsForm.cs
+++ b/src/pacs_win_uia/UI/SettingsForm.cs
@@ -898,10 +898,8 @@ namespace pacs_win_uia.UI
_barCheckStatus.Text = "正在后台检测当前草稿(只读,不执行操作)…";
try
{
- // Diagnostic on purpose: this dialog covers the target window, so "本工具窗口遮挡" must
- // not make every check fail. Runtime still counts them.
Task check = Task.Run(
- () => FloatingBarManager.CheckDisplayConditions(snapshot, true));
+ () => FloatingBarManager.CheckDisplayConditions(snapshot));
if (await Task.WhenAny(check, Task.Delay(10000)) != check)
{
if (!IsDisposed && !Disposing && version == _barEditVersion)