From b84db8983d63a9a981083ebce1a139860c6bdf25 Mon Sep 17 00:00:00 2001
From: chunhualin1 <chunhualin1@lenovo.com>
Date: 星期五, 14 八月 2026 15:35:21 +0800
Subject: [PATCH] commit
---
src/Moli.Desktop/Interop/Win32InteropService.cs | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/Moli.Desktop/Interop/Win32InteropService.cs b/src/Moli.Desktop/Interop/Win32InteropService.cs
index 1b56207..512cf03 100644
--- a/src/Moli.Desktop/Interop/Win32InteropService.cs
+++ b/src/Moli.Desktop/Interop/Win32InteropService.cs
@@ -190,15 +190,25 @@
var styleFlag = unchecked((uint)flag);
var currentStyle = unchecked((uint)current);
var updated = enabled ? currentStyle | styleFlag : currentStyle & ~styleFlag;
- NativeMethods.SetWindowLongPtr(hwnd, NativeMethods.GwlExStyle, new IntPtr(updated));
- var error = NativeMethods.GetLastError();
- if (error != 0)
+ if (updated == currentStyle)
{
- _diagnostics.Record(
- DiagnosticSeverity.Warning,
- DiagnosticCodes.Win32InteropFailed,
- $"{operation} failed.",
- new Dictionary<string, string> { ["hwnd"] = hwnd.ToString("X"), ["error"] = error.ToString() });
+ return;
+ }
+
+ NativeMethods.SetWindowLongPtr(hwnd, NativeMethods.GwlExStyle, new IntPtr(unchecked((int)updated)));
+ // Extended-style changes (especially WS_EX_TRANSPARENT) do not reliably update hit-testing
+ // until the frame is refreshed. Without this, clearing click-through in edit/safe-input
+ // mode can leave the window visually present but permanently unclickable.
+ if (!NativeMethods.SetWindowPos(
+ hwnd,
+ IntPtr.Zero,
+ 0,
+ 0,
+ 0,
+ 0,
+ NativeMethods.SwpNoMove | NativeMethods.SwpNoSize | NativeMethods.SwpNoZOrder | NativeMethods.SwpNoActivate | NativeMethods.SwpFrameChanged))
+ {
+ RecordWin32Failure($"{operation}.SetWindowPos", hwnd);
}
}
--
Gitblit v1.9.1