From 574a6a769115034f37bdecf3284545d74843816a Mon Sep 17 00:00:00 2001
From: chunhualin1 <chunhualin1@lenovo.com>
Date: 星期三, 12 八月 2026 15:21:41 +0800
Subject: [PATCH] 添加显示器切换兼容处理

---
 src/Moli.Desktop.Tests/Interop/Win32InteropContractTests.cs |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/Moli.Desktop.Tests/Interop/Win32InteropContractTests.cs b/src/Moli.Desktop.Tests/Interop/Win32InteropContractTests.cs
index 01c32f2..c1cf9cd 100644
--- a/src/Moli.Desktop.Tests/Interop/Win32InteropContractTests.cs
+++ b/src/Moli.Desktop.Tests/Interop/Win32InteropContractTests.cs
@@ -1,3 +1,4 @@
+using Moli.Desktop.Configuration;
 using Moli.Desktop.Interop;
 
 namespace Moli.Desktop.Tests.Interop;
@@ -13,15 +14,23 @@
         interop.SetClickThrough(hwnd, true);
         interop.SetToolWindow(hwnd, true);
         interop.SetNoActivate(hwnd, true);
-        interop.SetLayered(hwnd, true, 128);
-        interop.MoveToDesktopLayer(hwnd, DesktopLayerMode.WorkerW, new Moli.Desktop.Layout.RectD(10, 20, 300, 120));
+        interop.SetLayered(hwnd, true);
+        var monitor = new MonitorInfo
+        {
+            Id = new Moli.Desktop.Layout.MonitorId("primary"),
+            Bounds = new Moli.Desktop.Layout.RectD(0, 0, 1920, 1080),
+            WorkArea = new Moli.Desktop.Layout.RectD(0, 0, 1920, 1040),
+            IsPrimary = true,
+            Scale = 1
+        };
+        interop.MoveToDesktopLayer(hwnd, DesktopLayerMode.WorkerW, monitor, new Moli.Desktop.Layout.RectD(10, 20, 300, 120));
         interop.RestoreTopLevelWindow(hwnd);
         interop.SetBottomMost(hwnd);
 
         Assert.True(interop.ClickThroughEnabled);
         Assert.True(interop.ToolWindowEnabled);
         Assert.True(interop.NoActivateEnabled);
-        Assert.Equal(128, interop.Opacity);
+        Assert.True(interop.LayeredEnabled);
         Assert.Equal(new Moli.Desktop.Layout.RectD(10, 20, 300, 120), interop.LayerBounds);
         Assert.True(interop.RestoredTopLevel);
         Assert.Single(interop.GetMonitors());

--
Gitblit v1.9.1