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/Windows/WallpaperWindow.cs | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/Moli.Desktop/Windows/WallpaperWindow.cs b/src/Moli.Desktop/Windows/WallpaperWindow.cs
index 9cc0132..a639f2e 100644
--- a/src/Moli.Desktop/Windows/WallpaperWindow.cs
+++ b/src/Moli.Desktop/Windows/WallpaperWindow.cs
@@ -23,7 +23,6 @@
private readonly DesktopPaths _paths;
private readonly IDiagnosticsService _diagnostics;
private bool _clickThrough = true;
- private double _opacity = 1;
public WallpaperWindow(
PluginDescriptor plugin,
@@ -59,7 +58,7 @@
public async Task LoadAsync(WallpaperRuntimeState state, CancellationToken cancellationToken = default)
{
_clickThrough = state.ClickThrough;
- _opacity = state.Opacity;
+ Opacity = Math.Clamp(state.Opacity, 0.1, 1.0);
await _webView.InitializeAsync(new WebViewHostOptions
{
UserDataFolder = Path.Combine(_paths.WebViewDataDirectory, "wallpaper", _plugin.Id.Value),
@@ -77,7 +76,6 @@
public void ApplyState(WallpaperRuntimeState state, bool safeInputMode)
{
_clickThrough = !safeInputMode && state.ClickThrough;
- _opacity = state.Opacity;
Opacity = Math.Clamp(state.Opacity, 0.1, 1.0);
ApplyWin32Styles();
}
@@ -124,9 +122,9 @@
{
_interop.SetToolWindow(hwnd, true);
_interop.SetNoActivate(hwnd, true);
- _interop.SetLayered(hwnd, true, ToAlpha(_opacity));
+ _interop.SetLayered(hwnd, true);
_interop.SetClickThrough(hwnd, _clickThrough);
- _interop.MoveToDesktopLayer(hwnd, DesktopLayerMode.WorkerW, _monitor);
+ _interop.MoveToDesktopLayer(hwnd, DesktopLayerMode.WorkerW, _monitor, _monitor.Bounds);
}
catch (Exception ex)
{
@@ -137,6 +135,4 @@
new Dictionary<string, string> { ["pluginId"] = _plugin.Id.Value, ["exception"] = ex.GetType().Name });
}
}
-
- private static byte ToAlpha(double opacity) => (byte)Math.Round(Math.Clamp(opacity, 0.1, 1.0) * 255);
}
--
Gitblit v1.9.1