mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-24 10:49:51 +08:00
Fix Window Size
This commit is contained in:
+5
@@ -127,6 +127,11 @@ namespace System.Application.Services.Implementation
|
||||
newSize.right -= 8;
|
||||
newSize.bottom -= 8;
|
||||
|
||||
//if (_owner.IsNewSizeWindow)
|
||||
//{
|
||||
// _owner.Resized(new Size(ncParams.rgrc[1].Width, ncParams.rgrc[1].Height), PlatformResizeReason.Layout);
|
||||
//}
|
||||
|
||||
_owner.IsNewSizeWindow = true;
|
||||
}
|
||||
|
||||
|
||||
+13
-3
@@ -124,7 +124,7 @@ namespace Avalonia.Controls
|
||||
vm.SizePosition.Y = e.Point.Y;
|
||||
}
|
||||
}
|
||||
|
||||
bool _isFirstOpenWindow = true;
|
||||
protected virtual void FluentWindow_Opened(object? sender, EventArgs e)
|
||||
{
|
||||
if (DataContext is WindowViewModel vm)
|
||||
@@ -166,17 +166,22 @@ namespace Avalonia.Controls
|
||||
vm.SizePosition.Width = x.Width;
|
||||
vm.SizePosition.Height = x.Height;
|
||||
});
|
||||
|
||||
this.GetObservable(WindowStateProperty)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (x == WindowState.Normal)
|
||||
if (!_isFirstOpenWindow)
|
||||
{
|
||||
HandleResized(new Size(Width + (IsNewSizeWindow ? 32 : 0), Height + (IsNewSizeWindow ? 16 : 0)), PlatformResizeReason.Application);
|
||||
if (x == WindowState.Normal)
|
||||
{
|
||||
HandleResized(new Size(Width + (IsNewSizeWindow ? 32 : 0), Height + (IsNewSizeWindow ? 16 : 0)), PlatformResizeReason.Application);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_isFirstOpenWindow = false;
|
||||
IsHideWindow = false;
|
||||
}
|
||||
|
||||
@@ -207,6 +212,11 @@ namespace Avalonia.Controls
|
||||
|
||||
#region CoreWindow
|
||||
|
||||
public void Resized(Size clientSize, PlatformResizeReason reason)
|
||||
{
|
||||
HandleResized(clientSize, reason);
|
||||
}
|
||||
|
||||
Window ICoreWindow.Window => this;
|
||||
|
||||
MinMaxCloseControl? ICoreWindow.SystemCaptionButtons => _systemCaptionButtons;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Rendering;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.VisualTree;
|
||||
@@ -24,6 +25,8 @@ namespace Avalonia.Controls
|
||||
|
||||
MinMaxCloseControl? SystemCaptionButtons { get; }
|
||||
|
||||
public void Resized(Size clientSize, PlatformResizeReason reason);
|
||||
|
||||
bool HitTestTitleBarRegion(APoint windowPoint)
|
||||
{
|
||||
return SystemCaptionButtons?.HitTestCustom(windowPoint) ?? false;
|
||||
|
||||
Reference in New Issue
Block a user