Skip to content

Commit

Permalink
UI: Directly proxy window properties on the view model back to the st…
Browse files Browse the repository at this point in the history
…ored window
  • Loading branch information
GreemDev committed Dec 27, 2024
1 parent 267e9f6 commit 9754d24
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 43 deletions.
7 changes: 2 additions & 5 deletions src/Ryujinx/RyujinxApp.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ internal static string FormatTitle(LocaleKeys? windowTitleKey = null)
.ApplicationLifetime.Cast<IClassicDesktopStyleApplicationLifetime>()
.MainWindow.Cast<MainWindow>();

public static bool IsClipboardAvailable(out IClipboard clipboard)
{
clipboard = MainWindow.Clipboard;
return clipboard != null;
}
public static bool IsClipboardAvailable(out IClipboard clipboard)
=> (clipboard = MainWindow.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);
Expand Down
45 changes: 12 additions & 33 deletions src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,8 @@ public class MainWindowViewModel : BaseModel

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;

Expand Down Expand Up @@ -216,7 +211,7 @@ public string SearchText

public bool CanUpdate
{
get => _canUpdate && EnableNonGameRunningControls && Updater.CanUpdate(false);
get => _canUpdate && EnableNonGameRunningControls && Updater.CanUpdate();
set
{
_canUpdate = value;
Expand All @@ -226,12 +221,8 @@ public bool CanUpdate

public Cursor Cursor
{
get => _cursor;
set
{
_cursor = value;
OnPropertyChanged();
}
get => Window.Cursor;
set => Window.Cursor = value;
}

public ReadOnlyObservableCollection<ApplicationData> AppsObservableList
Expand Down Expand Up @@ -813,35 +804,23 @@ public bool IsAppletMenuActive

public WindowState WindowState
{
get => _windowState;
get => Window.WindowState;
internal set
{
_windowState = value;

OnPropertyChanged();
Window.WindowState = value;
}
}

public double WindowWidth
{
get => _windowWidth;
set
{
_windowWidth = value;

OnPropertyChanged();
}
get => Window.Width;
set => Window.Width = value;
}

public double WindowHeight
{
get => _windowHeight;
set
{
_windowHeight = value;

OnPropertyChanged();
}
get => Window.Height;
set => Window.Height = value;
}

public bool IsGrid => Glyph == Glyph.Grid;
Expand Down Expand Up @@ -889,11 +868,11 @@ public bool ShowConsole

public string Title
{
get => _title;
get => Window.Title;
set
{
_title = value;

Window.Title = value;
OnPropertyChanged();
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/Ryujinx/UI/Windows/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
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"
Expand Down

0 comments on commit 9754d24

Please sign in to comment.