mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-04-24 06:47:44 +02:00
UI: More advanced customization for what happens when Ryujinx loses focus
This commit is contained in:
parent
7591b07fce
commit
17e8ae1d9a
13 changed files with 318 additions and 40 deletions
|
@ -517,7 +517,7 @@ namespace Ryujinx.Ava
|
||||||
Device?.System.ChangeDockedModeState(e.NewValue);
|
Device?.System.ChangeDockedModeState(e.NewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAudioVolumeState(object sender, ReactiveEventArgs<float> e)
|
public void UpdateAudioVolumeState(object sender, ReactiveEventArgs<float> e)
|
||||||
{
|
{
|
||||||
Device?.SetVolume(e.NewValue);
|
Device?.SetVolume(e.NewValue);
|
||||||
|
|
||||||
|
|
|
@ -3447,6 +3447,156 @@
|
||||||
"zh_TW": ""
|
"zh_TW": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ID": "SettingsTabGeneralFocusLossType",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "On Emulator Focus Lost:",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": "SettingsTabGeneralFocusLossTypeDoNothing",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Do Nothing",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": "SettingsTabGeneralFocusLossTypeBlockInput",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Block Input",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": "SettingsTabGeneralFocusLossTypeMuteAudio",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Mute Volume",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": "SettingsTabGeneralFocusLossTypeBlockInputAndMuteAudio",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Block Input & Mute Volume",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": "SettingsTabGeneralFocusLossTypePauseEmulation",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Pause Emulation",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ID": "SettingsTabGeneralShowConfirmExitDialog",
|
"ID": "SettingsTabGeneralShowConfirmExitDialog",
|
||||||
"Translations": {
|
"Translations": {
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Common
|
|
||||||
{
|
|
||||||
public static class ThemeManager
|
|
||||||
{
|
|
||||||
public static event Action ThemeChanged;
|
|
||||||
|
|
||||||
public static void OnThemeChanged()
|
|
||||||
{
|
|
||||||
ThemeChanged?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,6 +22,8 @@ namespace Ryujinx.Ava
|
||||||
{
|
{
|
||||||
public class RyujinxApp : Application
|
public class RyujinxApp : Application
|
||||||
{
|
{
|
||||||
|
public static event Action ThemeChanged;
|
||||||
|
|
||||||
internal static string FormatTitle(LocaleKeys? windowTitleKey = null, bool includeVersion = true)
|
internal static string FormatTitle(LocaleKeys? windowTitleKey = null, bool includeVersion = true)
|
||||||
=> windowTitleKey is null
|
=> windowTitleKey is null
|
||||||
? $"{FullAppName}{(includeVersion ? $" {Program.Version}" : string.Empty)}"
|
? $"{FullAppName}{(includeVersion ? $" {Program.Version}" : string.Empty)}"
|
||||||
|
@ -112,7 +114,7 @@ namespace Ryujinx.Ava
|
||||||
baseStyle = ConfigurationState.Instance.UI.BaseStyle;
|
baseStyle = ConfigurationState.Instance.UI.BaseStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeManager.OnThemeChanged();
|
ThemeChanged?.Invoke();
|
||||||
|
|
||||||
RequestedThemeVariant = baseStyle switch
|
RequestedThemeVariant = baseStyle switch
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,10 +25,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
Version = RyujinxApp.FullAppName + "\n" + Program.Version;
|
Version = RyujinxApp.FullAppName + "\n" + Program.Version;
|
||||||
UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value);
|
UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value);
|
||||||
|
|
||||||
ThemeManager.ThemeChanged += ThemeManager_ThemeChanged;
|
RyujinxApp.ThemeChanged += Ryujinx_ThemeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThemeManager_ThemeChanged()
|
private void Ryujinx_ThemeChanged()
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(() => UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value));
|
Dispatcher.UIThread.Post(() => UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value));
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
ThemeManager.ThemeChanged -= ThemeManager_ThemeChanged;
|
RyujinxApp.ThemeChanged -= Ryujinx_ThemeChanged;
|
||||||
|
|
||||||
GithubLogo.Dispose();
|
GithubLogo.Dispose();
|
||||||
DiscordLogo.Dispose();
|
DiscordLogo.Dispose();
|
||||||
|
|
|
@ -128,6 +128,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
public bool EnableMouse { get; set; }
|
public bool EnableMouse { get; set; }
|
||||||
public bool DisableInputWhenOutOfFocus { get; set; }
|
public bool DisableInputWhenOutOfFocus { get; set; }
|
||||||
|
|
||||||
|
public int FocusLostActionType { get; set; }
|
||||||
|
|
||||||
public VSyncMode VSyncMode
|
public VSyncMode VSyncMode
|
||||||
{
|
{
|
||||||
get => _vSyncMode;
|
get => _vSyncMode;
|
||||||
|
@ -481,6 +483,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
ShowTitleBar = config.ShowTitleBar;
|
ShowTitleBar = config.ShowTitleBar;
|
||||||
HideCursor = (int)config.HideCursor.Value;
|
HideCursor = (int)config.HideCursor.Value;
|
||||||
UpdateCheckerType = (int)config.UpdateCheckerType.Value;
|
UpdateCheckerType = (int)config.UpdateCheckerType.Value;
|
||||||
|
FocusLostActionType = (int)config.FocusLostActionType.Value;
|
||||||
|
|
||||||
GameDirectories.Clear();
|
GameDirectories.Clear();
|
||||||
GameDirectories.AddRange(config.UI.GameDirs.Value);
|
GameDirectories.AddRange(config.UI.GameDirs.Value);
|
||||||
|
@ -589,6 +592,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
config.ShowTitleBar.Value = ShowTitleBar;
|
config.ShowTitleBar.Value = ShowTitleBar;
|
||||||
config.HideCursor.Value = (HideCursorMode)HideCursor;
|
config.HideCursor.Value = (HideCursorMode)HideCursor;
|
||||||
config.UpdateCheckerType.Value = (UpdaterType)UpdateCheckerType;
|
config.UpdateCheckerType.Value = (UpdaterType)UpdateCheckerType;
|
||||||
|
config.FocusLostActionType.Value = (FocusLostType)FocusLostActionType;
|
||||||
|
|
||||||
if (GameDirectoryChanged)
|
if (GameDirectoryChanged)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,12 +37,33 @@
|
||||||
<CheckBox IsChecked="{Binding RememberWindowState}">
|
<CheckBox IsChecked="{Binding RememberWindowState}">
|
||||||
<TextBlock Text="{ext:Locale SettingsTabGeneralRememberWindowState}" />
|
<TextBlock Text="{ext:Locale SettingsTabGeneralRememberWindowState}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding DisableInputWhenOutOfFocus}">
|
|
||||||
<TextBlock Text="{ext:Locale SettingsTabGeneralDisableInputWhenOutOfFocus}" />
|
|
||||||
</CheckBox>
|
|
||||||
<CheckBox IsChecked="{Binding ShowTitleBar}" IsVisible="{x:Static helper:RunningPlatform.IsWindows}">
|
<CheckBox IsChecked="{Binding ShowTitleBar}" IsVisible="{x:Static helper:RunningPlatform.IsWindows}">
|
||||||
<TextBlock Text="{ext:Locale SettingsTabGeneralShowTitleBar}" />
|
<TextBlock Text="{ext:Locale SettingsTabGeneralShowTitleBar}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
|
||||||
|
<TextBlock VerticalAlignment="Center"
|
||||||
|
Text="{ext:Locale SettingsTabGeneralFocusLossType}"
|
||||||
|
Width="150" />
|
||||||
|
<ComboBox SelectedIndex="{Binding FocusLostActionType}"
|
||||||
|
HorizontalContentAlignment="Left"
|
||||||
|
MinWidth="100">
|
||||||
|
<ComboBoxItem>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypeDoNothing}" />
|
||||||
|
</ComboBoxItem>
|
||||||
|
<ComboBoxItem>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypeBlockInput}" />
|
||||||
|
</ComboBoxItem>
|
||||||
|
<ComboBoxItem>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypeMuteAudio}" />
|
||||||
|
</ComboBoxItem>
|
||||||
|
<ComboBoxItem>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypeBlockInputAndMuteAudio}" />
|
||||||
|
</ComboBoxItem>
|
||||||
|
<ComboBoxItem>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabGeneralFocusLossTypePauseEmulation}" />
|
||||||
|
</ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
|
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
|
||||||
<TextBlock VerticalAlignment="Center"
|
<TextBlock VerticalAlignment="Center"
|
||||||
Text="{ext:Locale SettingsTabGeneralCheckUpdatesOnLaunch}"
|
Text="{ext:Locale SettingsTabGeneralCheckUpdatesOnLaunch}"
|
||||||
|
|
|
@ -765,31 +765,116 @@ namespace Ryujinx.Ava.UI.Windows
|
||||||
|
|
||||||
private void InputElement_OnGotFocus(object sender, GotFocusEventArgs e)
|
private void InputElement_OnGotFocus(object sender, GotFocusEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_didDisableInputUpdates)
|
if (ViewModel.AppHost is null) return;
|
||||||
|
|
||||||
|
if (!_focusLoss.Active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!ConfigurationState.Instance.Hid.DisableInputWhenOutOfFocus)
|
switch (_focusLoss.Type)
|
||||||
return;
|
{
|
||||||
|
case FocusLostType.BlockInput:
|
||||||
|
{
|
||||||
|
if (!ViewModel.AppHost.NpadManager.InputUpdatesBlocked)
|
||||||
|
{
|
||||||
|
_focusLoss = default;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ViewModel.AppHost is not { NpadManager.InputUpdatesBlocked: true } appHost)
|
ViewModel.AppHost.NpadManager.UnblockInputUpdates();
|
||||||
return;
|
_focusLoss = default;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FocusLostType.MuteAudio:
|
||||||
|
{
|
||||||
|
if (!ViewModel.AppHost.Device.IsAudioMuted())
|
||||||
|
{
|
||||||
|
_focusLoss = default;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
appHost.NpadManager.UnblockInputUpdates();
|
ViewModel.AppHost.Device.SetVolume(ViewModel.VolumeBeforeMute);
|
||||||
_didDisableInputUpdates = appHost.NpadManager.InputUpdatesBlocked;
|
|
||||||
|
_focusLoss = default;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FocusLostType.BlockInputAndMuteAudio:
|
||||||
|
{
|
||||||
|
if (!ViewModel.AppHost.Device.IsAudioMuted())
|
||||||
|
goto case FocusLostType.BlockInput;
|
||||||
|
|
||||||
|
ViewModel.AppHost.Device.SetVolume(ViewModel.VolumeBeforeMute);
|
||||||
|
ViewModel.AppHost.NpadManager.UnblockInputUpdates();
|
||||||
|
|
||||||
|
_focusLoss = default;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FocusLostType.PauseEmulation:
|
||||||
|
{
|
||||||
|
if (!ViewModel.AppHost.Device.System.IsPaused)
|
||||||
|
{
|
||||||
|
_focusLoss = default;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewModel.AppHost.Resume();
|
||||||
|
|
||||||
|
_focusLoss = default;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _didDisableInputUpdates;
|
private (FocusLostType Type, bool Active) _focusLoss;
|
||||||
|
|
||||||
private void InputElement_OnLostFocus(object sender, RoutedEventArgs e)
|
private void InputElement_OnLostFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!ConfigurationState.Instance.Hid.DisableInputWhenOutOfFocus)
|
if (ConfigurationState.Instance.FocusLostActionType.Value is FocusLostType.DoNothing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ViewModel.AppHost is not { NpadManager.InputUpdatesBlocked: false } appHost)
|
if (ViewModel.AppHost is null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
appHost.NpadManager.BlockInputUpdates();
|
switch (ConfigurationState.Instance.FocusLostActionType.Value)
|
||||||
_didDisableInputUpdates = appHost.NpadManager.InputUpdatesBlocked;
|
{
|
||||||
|
case FocusLostType.BlockInput:
|
||||||
|
{
|
||||||
|
if (ViewModel.AppHost.NpadManager.InputUpdatesBlocked)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ViewModel.AppHost.NpadManager.BlockInputUpdates();
|
||||||
|
_focusLoss = (FocusLostType.BlockInput, ViewModel.AppHost.NpadManager.InputUpdatesBlocked);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FocusLostType.MuteAudio:
|
||||||
|
{
|
||||||
|
if (ViewModel.AppHost.Device.GetVolume() is 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ViewModel.VolumeBeforeMute = ViewModel.AppHost.Device.GetVolume();
|
||||||
|
ViewModel.AppHost.Device.SetVolume(0);
|
||||||
|
_focusLoss = (FocusLostType.MuteAudio, ViewModel.AppHost.Device.GetVolume() is 0f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FocusLostType.BlockInputAndMuteAudio:
|
||||||
|
{
|
||||||
|
if (ViewModel.AppHost.Device.GetVolume() is 0)
|
||||||
|
goto case FocusLostType.BlockInput;
|
||||||
|
|
||||||
|
ViewModel.VolumeBeforeMute = ViewModel.AppHost.Device.GetVolume();
|
||||||
|
ViewModel.AppHost.Device.SetVolume(0);
|
||||||
|
ViewModel.AppHost.NpadManager.BlockInputUpdates();
|
||||||
|
_focusLoss = (FocusLostType.BlockInputAndMuteAudio, ViewModel.AppHost.Device.GetVolume() is 0f && ViewModel.AppHost.NpadManager.InputUpdatesBlocked);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FocusLostType.PauseEmulation:
|
||||||
|
{
|
||||||
|
if (ViewModel.AppHost.Device.System.IsPaused)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ViewModel.AppHost.Pause();
|
||||||
|
_focusLoss = (FocusLostType.PauseEmulation, ViewModel.AppHost.Device.System.IsPaused);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current version of the file format
|
/// The current version of the file format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int CurrentVersion = 66;
|
public const int CurrentVersion = 67;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the configuration file format
|
/// Version of the configuration file format
|
||||||
|
@ -172,6 +172,11 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UpdaterType UpdateCheckerType { get; set; }
|
public UpdaterType UpdateCheckerType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How the emulator should behave when you click off/on the window.
|
||||||
|
/// </summary>
|
||||||
|
public FocusLostType FocusLostActionType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show "Confirm Exit" Dialog
|
/// Show "Confirm Exit" Dialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
EnableDiscordIntegration.Value = cff.EnableDiscordIntegration;
|
EnableDiscordIntegration.Value = cff.EnableDiscordIntegration;
|
||||||
CheckUpdatesOnStart.Value = cff.CheckUpdatesOnStart;
|
CheckUpdatesOnStart.Value = cff.CheckUpdatesOnStart;
|
||||||
UpdateCheckerType.Value = cff.UpdateCheckerType;
|
UpdateCheckerType.Value = cff.UpdateCheckerType;
|
||||||
|
FocusLostActionType.Value = cff.FocusLostActionType;
|
||||||
ShowConfirmExit.Value = cff.ShowConfirmExit;
|
ShowConfirmExit.Value = cff.ShowConfirmExit;
|
||||||
RememberWindowState.Value = cff.RememberWindowState;
|
RememberWindowState.Value = cff.RememberWindowState;
|
||||||
ShowTitleBar.Value = cff.ShowTitleBar;
|
ShowTitleBar.Value = cff.ShowTitleBar;
|
||||||
|
@ -435,7 +436,8 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
(63, static cff => cff.MatchSystemTime = false),
|
(63, static cff => cff.MatchSystemTime = false),
|
||||||
(64, static cff => cff.LoggingEnableAvalonia = false),
|
(64, static cff => cff.LoggingEnableAvalonia = false),
|
||||||
(65, static cff => cff.UpdateCheckerType = cff.CheckUpdatesOnStart ? UpdaterType.PromptAtStartup : UpdaterType.Off),
|
(65, static cff => cff.UpdateCheckerType = cff.CheckUpdatesOnStart ? UpdaterType.PromptAtStartup : UpdaterType.Off),
|
||||||
(66, static cff => cff.DisableInputWhenOutOfFocus = false)
|
(66, static cff => cff.DisableInputWhenOutOfFocus = false),
|
||||||
|
(67, static cff => cff.FocusLostActionType = cff.DisableInputWhenOutOfFocus ? FocusLostType.BlockInput : FocusLostType.DoNothing)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -780,6 +780,11 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ReactiveObject<UpdaterType> UpdateCheckerType { get; private set; }
|
public ReactiveObject<UpdaterType> UpdateCheckerType { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How the emulator should behave when you click off/on the window.
|
||||||
|
/// </summary>
|
||||||
|
public ReactiveObject<FocusLostType> FocusLostActionType { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show "Confirm Exit" Dialog
|
/// Show "Confirm Exit" Dialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -817,6 +822,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
EnableDiscordIntegration = new ReactiveObject<bool>();
|
EnableDiscordIntegration = new ReactiveObject<bool>();
|
||||||
CheckUpdatesOnStart = new ReactiveObject<bool>();
|
CheckUpdatesOnStart = new ReactiveObject<bool>();
|
||||||
UpdateCheckerType = new ReactiveObject<UpdaterType>();
|
UpdateCheckerType = new ReactiveObject<UpdaterType>();
|
||||||
|
FocusLostActionType = new ReactiveObject<FocusLostType>();
|
||||||
ShowConfirmExit = new ReactiveObject<bool>();
|
ShowConfirmExit = new ReactiveObject<bool>();
|
||||||
RememberWindowState = new ReactiveObject<bool>();
|
RememberWindowState = new ReactiveObject<bool>();
|
||||||
ShowTitleBar = new ReactiveObject<bool>();
|
ShowTitleBar = new ReactiveObject<bool>();
|
||||||
|
|
|
@ -57,6 +57,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
EnableDiscordIntegration = EnableDiscordIntegration,
|
EnableDiscordIntegration = EnableDiscordIntegration,
|
||||||
CheckUpdatesOnStart = CheckUpdatesOnStart,
|
CheckUpdatesOnStart = CheckUpdatesOnStart,
|
||||||
UpdateCheckerType = UpdateCheckerType,
|
UpdateCheckerType = UpdateCheckerType,
|
||||||
|
FocusLostActionType = FocusLostActionType,
|
||||||
ShowConfirmExit = ShowConfirmExit,
|
ShowConfirmExit = ShowConfirmExit,
|
||||||
RememberWindowState = RememberWindowState,
|
RememberWindowState = RememberWindowState,
|
||||||
ShowTitleBar = ShowTitleBar,
|
ShowTitleBar = ShowTitleBar,
|
||||||
|
@ -178,6 +179,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
System.EnableDockedMode.Value = true;
|
System.EnableDockedMode.Value = true;
|
||||||
EnableDiscordIntegration.Value = true;
|
EnableDiscordIntegration.Value = true;
|
||||||
UpdateCheckerType.Value = UpdaterType.PromptAtStartup;
|
UpdateCheckerType.Value = UpdaterType.PromptAtStartup;
|
||||||
|
FocusLostActionType.Value = FocusLostType.DoNothing;
|
||||||
ShowConfirmExit.Value = true;
|
ShowConfirmExit.Value = true;
|
||||||
RememberWindowState.Value = true;
|
RememberWindowState.Value = true;
|
||||||
ShowTitleBar.Value = !OperatingSystem.IsWindows();
|
ShowTitleBar.Value = !OperatingSystem.IsWindows();
|
||||||
|
|
15
src/Ryujinx/Utilities/Configuration/UI/FocusLostType.cs
Normal file
15
src/Ryujinx/Utilities/Configuration/UI/FocusLostType.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
using Ryujinx.Common.Utilities;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.Utilities.Configuration.UI
|
||||||
|
{
|
||||||
|
[JsonConverter(typeof(TypedStringEnumConverter<FocusLostType>))]
|
||||||
|
public enum FocusLostType
|
||||||
|
{
|
||||||
|
DoNothing,
|
||||||
|
BlockInput,
|
||||||
|
MuteAudio,
|
||||||
|
BlockInputAndMuteAudio,
|
||||||
|
PauseEmulation
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue