From 111819dbf33c97aa762a82b0a00fa505d4ed4095 Mon Sep 17 00:00:00 2001
From: CJKmkp <2564608840@qq.com>
Date: Sat, 6 Sep 2025 15:16:03 +0800
Subject: [PATCH] fix:issue #164 #155
---
Ink Canvas/MainWindow_cs/MW_Timer.cs | 59 ++++++++++++++++++++++++++--
1 file changed, 55 insertions(+), 4 deletions(-)
diff --git a/Ink Canvas/MainWindow_cs/MW_Timer.cs b/Ink Canvas/MainWindow_cs/MW_Timer.cs
index 210521a0..e9a32ba2 100644
--- a/Ink Canvas/MainWindow_cs/MW_Timer.cs
+++ b/Ink Canvas/MainWindow_cs/MW_Timer.cs
@@ -294,6 +294,17 @@ namespace Ink_Canvas
private bool foldFloatingBarByUser, // 保持收纳操作不受自动收纳的控制
unfoldFloatingBarByUser; // 允许用户在希沃软件内进行展开操作
+ ///
+ /// 检测是否为批注窗口(窗口标题为空且高度小于500像素)
+ ///
+ /// 如果是批注窗口返回true,否则返回false
+ private bool IsAnnotationWindow()
+ {
+ var windowTitle = ForegroundWindowInfo.WindowTitle();
+ var windowRect = ForegroundWindowInfo.WindowRect();
+ return windowTitle.Length == 0 && windowRect.Height < 500;
+ }
+
private void timerCheckAutoFold_Elapsed(object sender, ElapsedEventArgs e)
{
if (isFloatingBarChangingHideMode) return;
@@ -336,7 +347,17 @@ namespace Ink_Canvas
ForegroundWindowInfo.WindowRect().Height >= SystemParameters.WorkArea.Height - 16 &&
ForegroundWindowInfo.WindowRect().Width >= SystemParameters.WorkArea.Width - 16)
{
- if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ // 检测到批注窗口时保持收纳状态
+ if (IsAnnotationWindow())
+ {
+ // 批注窗口打开时,如果当前是展开状态则收纳
+ if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ }
+ else
+ {
+ // 非批注窗口时正常处理
+ if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ }
// EasiNote5C
}
else if (Settings.Automation.IsAutoFoldInEasiNote5C && windowProcessName == "EasiNote5C" &&
@@ -355,14 +376,34 @@ namespace Ink_Canvas
ForegroundWindowInfo.WindowRect().Height >= SystemParameters.WorkArea.Height - 16 &&
ForegroundWindowInfo.WindowRect().Width >= SystemParameters.WorkArea.Width - 16)
{
- if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ // 检测到批注窗口时保持收纳状态
+ if (IsAnnotationWindow())
+ {
+ // 批注窗口打开时,如果当前是展开状态则收纳
+ if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ }
+ else
+ {
+ // 非批注窗口时正常处理
+ if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ }
// HiteTouchPro
}
else if (Settings.Automation.IsAutoFoldInHiteTouchPro && windowProcessName == "HiteTouchPro" &&
ForegroundWindowInfo.WindowRect().Height >= SystemParameters.WorkArea.Height - 16 &&
ForegroundWindowInfo.WindowRect().Width >= SystemParameters.WorkArea.Width - 16)
{
- if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ // 检测到批注窗口时保持收纳状态
+ if (IsAnnotationWindow())
+ {
+ // 批注窗口打开时,如果当前是展开状态则收纳
+ if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ }
+ else
+ {
+ // 非批注窗口时正常处理
+ if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ }
// WxBoardMain
}
else if (Settings.Automation.IsAutoFoldInWxBoardMain && windowProcessName == "WxBoardMain" &&
@@ -389,7 +430,17 @@ namespace Ink_Canvas
ForegroundWindowInfo.WindowRect().Height >= SystemParameters.WorkArea.Height - 16 &&
ForegroundWindowInfo.WindowRect().Width >= SystemParameters.WorkArea.Width - 16)
{
- if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ // 检测到批注窗口时保持收纳状态
+ if (IsAnnotationWindow())
+ {
+ // 批注窗口打开时,如果当前是展开状态则收纳
+ if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ }
+ else
+ {
+ // 非批注窗口时正常处理
+ if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
+ }
// AdmoxWhiteboard
}
else if (Settings.Automation.IsAutoFoldInAdmoxWhiteboard && windowProcessName == "Amdox.WhiteBoard" &&