From 07074272ca327cb3ae1c2d34c0d5bbef290e6d26 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Fri, 27 Dec 2024 15:24:57 -0600 Subject: [PATCH] Revert "UI: Directly proxy window properties on the view model back to the stored window" This reverts commit 9754d247b59a064f9888423ef6c227c6f209e784. --- src/Ryujinx/RyujinxApp.axaml.cs | 7 ++- .../UI/ViewModels/MainWindowViewModel.cs | 45 ++++++++++++++----- src/Ryujinx/UI/Windows/MainWindow.axaml | 5 +++ 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/Ryujinx/RyujinxApp.axaml.cs b/src/Ryujinx/RyujinxApp.axaml.cs index c2f92f2f7..bbef20aa0 100644 --- a/src/Ryujinx/RyujinxApp.axaml.cs +++ b/src/Ryujinx/RyujinxApp.axaml.cs @@ -33,8 +33,11 @@ namespace Ryujinx.Ava .ApplicationLifetime.Cast() .MainWindow.Cast(); - public static bool IsClipboardAvailable(out IClipboard clipboard) - => (clipboard = MainWindow.Clipboard) != null; + public static bool IsClipboardAvailable(out IClipboard clipboard) + { + clipboard = MainWindow.Clipboard; + return clipboard != null; + } public static void SetTaskbarProgress(TaskBarProgressBarState state) => MainWindow.PlatformFeatures.SetTaskBarProgressBarState(state); public static void SetTaskbarProgressValue(ulong current, ulong total) => MainWindow.PlatformFeatures.SetTaskBarProgressBarValue(current, total); diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 3b98a7aa3..39799c117 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -110,8 +110,13 @@ namespace Ryujinx.Ava.UI.ViewModels private bool _areMimeTypesRegistered = FileAssociationHelper.AreMimeTypesRegistered; private bool _canUpdate = true; + private Cursor _cursor; + private string _title; private ApplicationData _currentApplicationData; private readonly AutoResetEvent _rendererWaitEvent; + private WindowState _windowState; + private double _windowWidth; + private double _windowHeight; private int _customVSyncInterval; private int _customVSyncIntervalPercentageProxy; @@ -213,7 +218,7 @@ namespace Ryujinx.Ava.UI.ViewModels public bool CanUpdate { - get => _canUpdate && EnableNonGameRunningControls && Updater.CanUpdate(); + get => _canUpdate && EnableNonGameRunningControls && Updater.CanUpdate(false); set { _canUpdate = value; @@ -223,8 +228,12 @@ namespace Ryujinx.Ava.UI.ViewModels public Cursor Cursor { - get => Window.Cursor; - set => Window.Cursor = value; + get => _cursor; + set + { + _cursor = value; + OnPropertyChanged(); + } } public ReadOnlyObservableCollection AppsObservableList @@ -806,23 +815,35 @@ namespace Ryujinx.Ava.UI.ViewModels public WindowState WindowState { - get => Window.WindowState; + get => _windowState; internal set { - Window.WindowState = value; + _windowState = value; + + OnPropertyChanged(); } } public double WindowWidth { - get => Window.Width; - set => Window.Width = value; + get => _windowWidth; + set + { + _windowWidth = value; + + OnPropertyChanged(); + } } public double WindowHeight { - get => Window.Height; - set => Window.Height = value; + get => _windowHeight; + set + { + _windowHeight = value; + + OnPropertyChanged(); + } } public bool IsGrid => Glyph == Glyph.Grid; @@ -870,11 +891,11 @@ namespace Ryujinx.Ava.UI.ViewModels public string Title { - get => Window.Title; + get => _title; set { - Window.Title = value; - + _title = value; + OnPropertyChanged(); } } diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml b/src/Ryujinx/UI/Windows/MainWindow.axaml index e3b6cf912..cb2e5936d 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml @@ -9,6 +9,11 @@ xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers" xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls" xmlns:main="clr-namespace:Ryujinx.Ava.UI.Views.Main" + Cursor="{Binding Cursor}" + Title="{Binding Title}" + WindowState="{Binding WindowState}" + Width="{Binding WindowWidth}" + Height="{Binding WindowHeight}" MinWidth="800" MinHeight="500" d:DesignHeight="720"