From 97df0fb5ed49e37d1c8e0e62057bb72ba5c9eb6a Mon Sep 17 00:00:00 2001
From: chunhualin1 <chunhualin1@lenovo.com>
Date: 星期三, 12 八月 2026 17:24:49 +0800
Subject: [PATCH] 优化透明样式
---
src/Moli.Desktop/Windows/WidgetWindow.cs | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/Moli.Desktop/Windows/WidgetWindow.cs b/src/Moli.Desktop/Windows/WidgetWindow.cs
index 94ecba0..23a87cf 100644
--- a/src/Moli.Desktop/Windows/WidgetWindow.cs
+++ b/src/Moli.Desktop/Windows/WidgetWindow.cs
@@ -40,6 +40,7 @@
private Point? _dragStart;
private RectD _startBounds;
private bool _resizing;
+ private DisplayLayer? _lastDisplayLayer;
public WidgetWindow(
PluginDescriptor plugin,
@@ -149,7 +150,6 @@
? height.Value
: null;
Height = Math.Max(_layout.Bounds.Height, _requestedHeight ?? _layout.Bounds.Height);
- ApplyWin32Styles();
}
public Task SetEditModeAsync(bool enabled, CancellationToken cancellationToken = default)
@@ -311,27 +311,45 @@
_interop.SetToolWindow(hwnd, true);
_interop.SetLayered(hwnd, true);
_interop.SetClickThrough(hwnd, !_editMode && !_safeInputMode && _layout.ClickThrough);
- switch (_layout.DisplayLayer)
+
+ var currentLayer = _layout.DisplayLayer;
+ if (currentLayer == _lastDisplayLayer)
+ {
+ return;
+ }
+
+ var parentChanged = false;
+ switch (currentLayer)
{
case DisplayLayer.Desktop:
Topmost = false;
if (_monitorInfo is not null)
{
_interop.MoveToDesktopLayer(hwnd, DesktopLayerMode.WorkerW, _monitorInfo, _layout.Bounds);
+ parentChanged = true;
}
break;
case DisplayLayer.GlobalTop:
_interop.RestoreTopLevelWindow(hwnd);
Topmost = true;
+ parentChanged = true;
break;
case DisplayLayer.AppTop:
case DisplayLayer.Normal:
default:
_interop.RestoreTopLevelWindow(hwnd);
Topmost = false;
+ parentChanged = true;
break;
}
+
+ _lastDisplayLayer = currentLayer;
+
+ if (parentChanged)
+ {
+ _ = _webView.NotifyParentWindowPositionChangedAsync();
+ }
}
catch (Exception ex)
{
--
Gitblit v1.9.1