From 6f1d9648016c9442f6dcdac257f28c1a7a19aca0 Mon Sep 17 00:00:00 2001 From: pineappleEA <67879877+pineappleEA@users.noreply.github.com> Date: Mon, 15 Feb 2021 23:48:21 +0200 Subject: Hide Cursor On Idle (#1993) * Implement "Hide Cursor On Idle" option Adds a general option to autohide the cursor after 8s have elapsed. * Fix cursor not hiding on Windows and dispose it * Don't dispose cursor, fix var names * Abide by the GNOME documentation * Fix nits * Disabled by default, make it so it doesn't utilize any timer * Remove *NIX time and extra lines * Don't calculate if option is disabled * Move if case * Fix alignment --- .../Configuration/ConfigurationFileFormat.cs | 9 +++++++-- Ryujinx.Common/Configuration/ConfigurationState.cs | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'Ryujinx.Common/Configuration') diff --git a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs index 79993d87..901c823e 100644 --- a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs +++ b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 20; + public const int CurrentVersion = 22; public int Version { get; set; } @@ -133,6 +133,11 @@ namespace Ryujinx.Configuration /// public bool ShowConfirmExit { get; set; } + /// + /// Hide Cursor on Idle + /// + public bool HideCursorOnIdle { get; set; } + /// /// Enables or disables Vertical Sync /// @@ -253,4 +258,4 @@ namespace Ryujinx.Configuration JsonHelper.Serialize(fileStream, this, true); } } -} \ No newline at end of file +} diff --git a/Ryujinx.Common/Configuration/ConfigurationState.cs b/Ryujinx.Common/Configuration/ConfigurationState.cs index 61cc8f89..d51ee9ef 100644 --- a/Ryujinx.Common/Configuration/ConfigurationState.cs +++ b/Ryujinx.Common/Configuration/ConfigurationState.cs @@ -365,6 +365,11 @@ namespace Ryujinx.Configuration /// public ReactiveObject ShowConfirmExit { get; private set; } + /// + /// Hide Cursor on Idle + /// + public ReactiveObject HideCursorOnIdle { get; private set; } + private ConfigurationState() { Ui = new UiSection(); @@ -375,6 +380,7 @@ namespace Ryujinx.Configuration EnableDiscordIntegration = new ReactiveObject(); CheckUpdatesOnStart = new ReactiveObject(); ShowConfirmExit = new ReactiveObject(); + HideCursorOnIdle = new ReactiveObject(); } public ConfigurationFileFormat ToFileFormat() @@ -420,6 +426,7 @@ namespace Ryujinx.Configuration EnableDiscordIntegration = EnableDiscordIntegration, CheckUpdatesOnStart = CheckUpdatesOnStart, ShowConfirmExit = ShowConfirmExit, + HideCursorOnIdle = HideCursorOnIdle, EnableVsync = Graphics.EnableVsync, EnableShaderCache = Graphics.EnableShaderCache, EnablePtc = System.EnablePtc, @@ -483,6 +490,7 @@ namespace Ryujinx.Configuration EnableDiscordIntegration.Value = true; CheckUpdatesOnStart.Value = true; ShowConfirmExit.Value = true; + HideCursorOnIdle.Value = false; Graphics.EnableVsync.Value = true; Graphics.EnableShaderCache.Value = true; System.EnablePtc.Value = true; @@ -787,6 +795,15 @@ namespace Ryujinx.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 22) + { + Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 22."); + + configurationFileFormat.HideCursorOnIdle = false; + + configurationFileUpdated = true; + } + List inputConfig = new List(); inputConfig.AddRange(configurationFileFormat.ControllerConfig); inputConfig.AddRange(configurationFileFormat.KeyboardConfig); @@ -814,6 +831,7 @@ namespace Ryujinx.Configuration EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration; CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart; ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit; + HideCursorOnIdle.Value = configurationFileFormat.HideCursorOnIdle; Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync; Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache; System.EnablePtc.Value = configurationFileFormat.EnablePtc; -- cgit v1.2.3