Added option to set idle time before cursor is hidden (Ryujinx#4390)

In SettingsWindow.cs and SettingsWindow.glade:
Replaced Always/On Idle/Never radio buttons with a dropdown (combo box).
When selecting "On Idle", a "Seconds" label and numeric text box (spinner) appear.  The spinner is limited 1-10.

In ConfigurationFileFormat.cs and ConfigurationState.cs, and SettingsViewModel.cs:
Load the saved value, or default 5 seconds if no value exists.
Save the custom set value to the config file.

In SettingsViewModel.cs:
Catch when the idle time setting is changed while a game is running, and change the value live.
This commit is contained in:
Premo 2024-04-25 21:22:35 -04:00 committed by GitHub
parent 9a1f3370bd
commit ef513751be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -632,10 +632,15 @@ namespace Ryujinx.UI.Common.Configuration
public ReactiveObject<bool> EnableHardwareAcceleration { get; private set; }
/// <summary>
/// Hide Cursor on Idle
/// Whether to hide cursor on idle, always or never
/// </summary>
public ReactiveObject<HideCursorMode> HideCursor { get; private set; }
/// <summary>
/// How many seconds to wait before hiding the cursor when set to hide on idle
/// </summary>
public ReactiveObject<int> HideCursorIdleTime { get; private set; }
private ConfigurationState()
{
UI = new UISection();
@ -649,6 +654,7 @@ namespace Ryujinx.UI.Common.Configuration
ShowConfirmExit = new ReactiveObject<bool>();
EnableHardwareAcceleration = new ReactiveObject<bool>();
HideCursor = new ReactiveObject<HideCursorMode>();
HideCursorIdleTime = new ReactiveObject<int>();
}
public ConfigurationFileFormat ToFileFormat()
@ -686,6 +692,7 @@ namespace Ryujinx.UI.Common.Configuration
ShowConfirmExit = ShowConfirmExit,
EnableHardwareAcceleration = EnableHardwareAcceleration,
HideCursor = HideCursor,
HideCursorIdleTime = HideCursorIdleTime,
EnableVsync = Graphics.EnableVsync,
EnableShaderCache = Graphics.EnableShaderCache,
EnableTextureRecompression = Graphics.EnableTextureRecompression,
@ -794,6 +801,7 @@ namespace Ryujinx.UI.Common.Configuration
ShowConfirmExit.Value = true;
EnableHardwareAcceleration.Value = true;
HideCursor.Value = HideCursorMode.OnIdle;
HideCursorIdleTime.Value = 5;
Graphics.EnableVsync.Value = true;
Graphics.EnableShaderCache.Value = true;
Graphics.EnableTextureRecompression.Value = false;
@ -1491,6 +1499,7 @@ namespace Ryujinx.UI.Common.Configuration
ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
EnableHardwareAcceleration.Value = configurationFileFormat.EnableHardwareAcceleration;
HideCursor.Value = configurationFileFormat.HideCursor;
HideCursorIdleTime.Value = configurationFileFormat.HideCursorIdleTime;
Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache;
Graphics.EnableTextureRecompression.Value = configurationFileFormat.EnableTextureRecompression;