possible fix for macos
MODIFY
WalletWasabi.Fluent/Behaviors/WindowSizeBehavior.cs
WalletWasabi.Fluent/Behaviors/WindowSizeBehavior.cs
@@ -2,6 +2,7 @@ using System.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia;
using Avalonia.Controls;
+using Avalonia.Platform;
using ReactiveUI;
namespace WalletWasabi.Fluent.Behaviors;
@@ -16,11 +17,14 @@ public class WindowSizeBehavior : DisposingBehavior<Window>
}
Observable
- .FromEventPattern(AssociatedObject, nameof(AssociatedObject.Opened))
+ .Interval(TimeSpan.FromMilliseconds(50))
+ .Select(_ => AssociatedObject.Screens.ScreenFromPoint(AssociatedObject.Position))
+ .WhereNotNull()
.Take(1)
- .Subscribe(_ =>
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Subscribe(screen =>
{
- SetWindowSize(AssociatedObject);
+ SetWindowSize(AssociatedObject, screen);
AssociatedObject
.WhenAnyValue(x => x.Bounds)
@@ -32,17 +36,35 @@ public class WindowSizeBehavior : DisposingBehavior<Window>
Services.UiConfig.WindowHeight = b.Height;
})
.DisposeWith(disposables);
- })
- .DisposeWith(disposables);
+ }).DisposeWith(disposables);
+
+ // Observable
+ // .FromEventPattern(AssociatedObject, nameof(AssociatedObject.Opened))
+ // .Take(1)
+ // .Subscribe(_ =>
+ // {
+ // SetWindowSize(AssociatedObject);
+ //
+ // AssociatedObject
+ // .WhenAnyValue(x => x.Bounds)
+ // .Skip(1)
+ // .Where(b => !b.IsEmpty && AssociatedObject.WindowState == WindowState.Normal)
+ // .Subscribe(b =>
+ // {
+ // Services.UiConfig.WindowWidth = b.Width;
+ // Services.UiConfig.WindowHeight = b.Height;
+ // })
+ // .DisposeWith(disposables);
+ // })
+ // .DisposeWith(disposables);
}
- private void SetWindowSize(Window window)
+ private void SetWindowSize(Window window, Screen currentScreen)
{
var configWidth = Services.UiConfig.WindowWidth;
var configHeight = Services.UiConfig.WindowHeight;
- var currentScreen = window.Screens.ScreenFromPoint(window.Position);
- if (configWidth is null || configHeight is null || currentScreen is null)
+ if (configWidth is null || configHeight is null)
{
return;
}

possible fix for macos