InputManager: Apply 'Disable Background Input' to ImGui too

And fix the incorrect config key.
This commit is contained in:
Stenzek
2026-01-14 02:01:27 +10:00
parent 2d8b7c85bf
commit 9cc8b0e19f
5 changed files with 15 additions and 15 deletions

View File

@@ -217,7 +217,7 @@ void Settings::Load(const SettingsInterface& si, const SettingsInterface& contro
inhibit_screensaver = si.GetBoolValue("Main", "InhibitScreensaver", true);
pause_on_focus_loss = si.GetBoolValue("Main", "PauseOnFocusLoss", false);
pause_on_controller_disconnection = si.GetBoolValue("Main", "PauseOnControllerDisconnection", false);
ignore_background_input = si.GetBoolValue("Main", "IgnoreBackgroundInput", false);
disable_background_input = si.GetBoolValue("Main", "DisableBackgroundInput", false);
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
create_save_state_backups = si.GetBoolValue("Main", "CreateSaveStateBackups", DEFAULT_SAVE_STATE_BACKUPS);
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
@@ -632,7 +632,7 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const
si.SetBoolValue("Main", "EnableDiscordPresence", enable_discord_presence);
}
si.SetBoolValue("Main", "IgnoreBackgroundInput", ignore_background_input);
si.SetBoolValue("Main", "DisableBackgroundInput", disable_background_input);
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements);

View File

@@ -327,7 +327,7 @@ struct Settings : public GPUSettings
bool inhibit_screensaver : 1 = true;
bool pause_on_focus_loss : 1 = false;
bool pause_on_controller_disconnection : 1 = false;
bool ignore_background_input : 1 = false;
bool disable_background_input : 1 = false;
bool save_state_on_exit : 1 = true;
bool create_save_state_backups : 1 = DEFAULT_SAVE_STATE_BACKUPS;
bool confim_power_off : 1 = true;

View File

@@ -4856,7 +4856,7 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
}
}
if (g_settings.ignore_background_input != old_settings.ignore_background_input)
if (g_settings.disable_background_input != old_settings.disable_background_input)
InputManager::UpdateInputIgnoreState();
Achievements::UpdateSettings(old_settings);

View File

@@ -57,6 +57,13 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="disableBackgroundInput">
<property name="text">
<string>Disable Background Input</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="createSaveStateBackups">
<property name="text">
@@ -78,13 +85,6 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="disableBackgroundInput">
<property name="text">
<string>Disable Background Input</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -1175,13 +1175,13 @@ void InputManager::InvokeEvents(InputBindingKey key, float value, GenericInputBi
if (DoEventHook(key, value))
return;
// If imgui ate the event, don't fire our handlers.
const bool skip_button_handlers = PreprocessEvent(key, value, generic_key);
// Background input test
if (ShouldMaskBackgroundInput(key))
return;
// If imgui ate the event, don't fire our handlers.
const bool skip_button_handlers = PreprocessEvent(key, value, generic_key);
ProcessEvent(key, value, skip_button_handlers);
}
@@ -1648,7 +1648,7 @@ void InputManager::OnApplicationBackgroundStateChanged(bool in_background)
void InputManager::UpdateInputIgnoreState()
{
const bool prev_ignore_input_events = s_state.ignore_input_events;
s_state.ignore_input_events = s_state.application_in_background && g_settings.ignore_background_input;
s_state.ignore_input_events = s_state.application_in_background && g_settings.disable_background_input;
if (s_state.ignore_input_events != prev_ignore_input_events)
{
if (s_state.ignore_input_events)