diff --git a/src/Ryujinx.Input/HLE/NpadManager.cs b/src/Ryujinx.Input/HLE/NpadManager.cs index 4a54b7ead..21219d91b 100644 --- a/src/Ryujinx.Input/HLE/NpadManager.cs +++ b/src/Ryujinx.Input/HLE/NpadManager.cs @@ -185,6 +185,15 @@ namespace Ryujinx.Input.HLE } } + public bool InputUpdatesBlocked + { + get + { + lock (_lock) + return _blockInputUpdates; + } + } + public void BlockInputUpdates() { lock (_lock) diff --git a/src/Ryujinx/Assets/locales.json b/src/Ryujinx/Assets/locales.json index 82e2b96cc..27f2b59a5 100644 --- a/src/Ryujinx/Assets/locales.json +++ b/src/Ryujinx/Assets/locales.json @@ -3497,6 +3497,31 @@ "zh_TW": "記住視窗大小/位置" } }, + { + "ID": "SettingsTabGeneralDisableInputWhenOutOfFocus", + "Translations": { + "ar_SA": "", + "de_DE": "", + "el_GR": "", + "en_US": "Disable Input when Out of Focus", + "es_ES": "", + "fr_FR": "", + "he_IL": "", + "it_IT": "", + "ja_JP": "", + "ko_KR": "", + "no_NO": "Deaktiver inndata når vinduet er ute av fokus", + "pl_PL": "", + "pt_BR": "", + "ru_RU": "", + "sv_SE": "", + "th_TH": "", + "tr_TR": "", + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" + } + }, { "ID": "SettingsTabGeneralShowTitleBar", "Translations": { @@ -23898,4 +23923,4 @@ } } ] -} \ No newline at end of file +} diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index b3df13e7f..017d68a28 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -126,6 +126,8 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnableDockedMode { get; set; } public bool EnableKeyboard { get; set; } public bool EnableMouse { get; set; } + public bool DisableInputWhenOutOfFocus { get; set; } + public VSyncMode VSyncMode { get => _vSyncMode; @@ -498,6 +500,7 @@ namespace Ryujinx.Ava.UI.ViewModels EnableDockedMode = config.System.EnableDockedMode; EnableKeyboard = config.Hid.EnableKeyboard; EnableMouse = config.Hid.EnableMouse; + DisableInputWhenOutOfFocus = config.Hid.DisableInputWhenOutOfFocus; // Keyboard Hotkeys KeyboardHotkey = new HotkeyConfig(config.Hid.Hotkeys.Value); @@ -609,6 +612,7 @@ namespace Ryujinx.Ava.UI.ViewModels config.System.EnableDockedMode.Value = EnableDockedMode; config.Hid.EnableKeyboard.Value = EnableKeyboard; config.Hid.EnableMouse.Value = EnableMouse; + config.Hid.DisableInputWhenOutOfFocus.Value = DisableInputWhenOutOfFocus; // Keyboard Hotkeys config.Hid.Hotkeys.Value = KeyboardHotkey.GetConfig(); diff --git a/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml index d71a7d795..6aeff31f1 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml @@ -37,6 +37,9 @@ + + + diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml b/src/Ryujinx/UI/Windows/MainWindow.axaml index 9fa7bf046..7606d411b 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml @@ -21,7 +21,9 @@ x:DataType="viewModels:MainWindowViewModel" mc:Ignorable="d" WindowStartupLocation="Manual" - Focusable="True"> + Focusable="True" + GotFocus="InputElement_OnGotFocus" + LostFocus="InputElement_OnLostFocus">