From 4df6165fa93c7caeea86385312415e312de4d11f Mon Sep 17 00:00:00 2001
From: Moli <13026959681@163.com>
Date: 星期二, 05 五月 2026 01:10:39 +0800
Subject: [PATCH] 暂存

---
 src/Moli.Desktop/Windows/WidgetWindow.cs |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/Moli.Desktop/Windows/WidgetWindow.cs b/src/Moli.Desktop/Windows/WidgetWindow.cs
index 18fecbc..ed232bc 100644
--- a/src/Moli.Desktop/Windows/WidgetWindow.cs
+++ b/src/Moli.Desktop/Windows/WidgetWindow.cs
@@ -33,6 +33,7 @@
     private readonly Border _editBorder;
     private readonly Border _resizeGrip;
     private WidgetLayout _layout;
+    private double? _requestedHeight;
     private bool _editMode;
     private bool _safeInputMode;
     private Point? _dragStart;
@@ -98,6 +99,10 @@
 
     public WidgetInstanceId InstanceId => _layout.InstanceId;
 
+    public WidgetLayout CurrentLayout => _layout;
+
+    public string HostId => _webView.HostId;
+
     public async Task LoadAsync(CancellationToken cancellationToken = default)
     {
         ApplyLayout(_layout, _editMode, _safeInputMode);
@@ -123,7 +128,7 @@
         Left = layout.Bounds.X;
         Top = layout.Bounds.Y;
         Width = layout.Bounds.Width;
-        Height = layout.Bounds.Height;
+        Height = Math.Max(layout.Bounds.Height, _requestedHeight ?? layout.Bounds.Height);
         Opacity = Math.Clamp(layout.Opacity, 0.1, 1.0);
         Visibility = layout.IsVisible ? Visibility.Visible : Visibility.Hidden;
         Topmost = layout.DisplayLayer == DisplayLayer.GlobalTop;
@@ -132,6 +137,20 @@
         ApplyWin32Styles();
     }
 
+    public void ApplyRequestedSize(double? width, double? height)
+    {
+        if (width is > 0)
+        {
+            Width = Math.Max(LayoutManager.MinWidth, width.Value);
+        }
+
+        _requestedHeight = height is > 0 && height.Value > _layout.Bounds.Height
+            ? height.Value
+            : null;
+        Height = Math.Max(_layout.Bounds.Height, _requestedHeight ?? _layout.Bounds.Height);
+        ApplyWin32Styles();
+    }
+
     public Task SetEditModeAsync(bool enabled, CancellationToken cancellationToken = default)
     {
         ApplyLayout(_layout, enabled, _safeInputMode);

--
Gitblit v1.9.1