Skip to content

Commit 9cc8b0e

Browse files
committed
InputManager: Apply 'Disable Background Input' to ImGui too
And fix the incorrect config key.
1 parent 2d8b7c8 commit 9cc8b0e

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/core/settings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void Settings::Load(const SettingsInterface& si, const SettingsInterface& contro
217217
inhibit_screensaver = si.GetBoolValue("Main", "InhibitScreensaver", true);
218218
pause_on_focus_loss = si.GetBoolValue("Main", "PauseOnFocusLoss", false);
219219
pause_on_controller_disconnection = si.GetBoolValue("Main", "PauseOnControllerDisconnection", false);
220-
ignore_background_input = si.GetBoolValue("Main", "IgnoreBackgroundInput", false);
220+
disable_background_input = si.GetBoolValue("Main", "DisableBackgroundInput", false);
221221
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
222222
create_save_state_backups = si.GetBoolValue("Main", "CreateSaveStateBackups", DEFAULT_SAVE_STATE_BACKUPS);
223223
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
@@ -632,7 +632,7 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const
632632
si.SetBoolValue("Main", "EnableDiscordPresence", enable_discord_presence);
633633
}
634634

635-
si.SetBoolValue("Main", "IgnoreBackgroundInput", ignore_background_input);
635+
si.SetBoolValue("Main", "DisableBackgroundInput", disable_background_input);
636636

637637
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
638638
si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements);

src/core/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ struct Settings : public GPUSettings
327327
bool inhibit_screensaver : 1 = true;
328328
bool pause_on_focus_loss : 1 = false;
329329
bool pause_on_controller_disconnection : 1 = false;
330-
bool ignore_background_input : 1 = false;
330+
bool disable_background_input : 1 = false;
331331
bool save_state_on_exit : 1 = true;
332332
bool create_save_state_backups : 1 = DEFAULT_SAVE_STATE_BACKUPS;
333333
bool confim_power_off : 1 = true;

src/core/system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4856,7 +4856,7 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
48564856
}
48574857
}
48584858

4859-
if (g_settings.ignore_background_input != old_settings.ignore_background_input)
4859+
if (g_settings.disable_background_input != old_settings.disable_background_input)
48604860
InputManager::UpdateInputIgnoreState();
48614861

48624862
Achievements::UpdateSettings(old_settings);

src/duckstation-qt/interfacesettingswidget.ui

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@
5757
</property>
5858
</widget>
5959
</item>
60+
<item row="2" column="1">
61+
<widget class="QCheckBox" name="disableBackgroundInput">
62+
<property name="text">
63+
<string>Disable Background Input</string>
64+
</property>
65+
</widget>
66+
</item>
6067
<item row="3" column="0">
6168
<widget class="QCheckBox" name="createSaveStateBackups">
6269
<property name="text">
@@ -78,13 +85,6 @@
7885
</property>
7986
</widget>
8087
</item>
81-
<item row="2" column="1">
82-
<widget class="QCheckBox" name="disableBackgroundInput">
83-
<property name="text">
84-
<string>Disable Background Input</string>
85-
</property>
86-
</widget>
87-
</item>
8888
</layout>
8989
</widget>
9090
</item>

src/util/input_manager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,13 +1175,13 @@ void InputManager::InvokeEvents(InputBindingKey key, float value, GenericInputBi
11751175
if (DoEventHook(key, value))
11761176
return;
11771177

1178-
// If imgui ate the event, don't fire our handlers.
1179-
const bool skip_button_handlers = PreprocessEvent(key, value, generic_key);
1180-
11811178
// Background input test
11821179
if (ShouldMaskBackgroundInput(key))
11831180
return;
11841181

1182+
// If imgui ate the event, don't fire our handlers.
1183+
const bool skip_button_handlers = PreprocessEvent(key, value, generic_key);
1184+
11851185
ProcessEvent(key, value, skip_button_handlers);
11861186
}
11871187

@@ -1648,7 +1648,7 @@ void InputManager::OnApplicationBackgroundStateChanged(bool in_background)
16481648
void InputManager::UpdateInputIgnoreState()
16491649
{
16501650
const bool prev_ignore_input_events = s_state.ignore_input_events;
1651-
s_state.ignore_input_events = s_state.application_in_background && g_settings.ignore_background_input;
1651+
s_state.ignore_input_events = s_state.application_in_background && g_settings.disable_background_input;
16521652
if (s_state.ignore_input_events != prev_ignore_input_events)
16531653
{
16541654
if (s_state.ignore_input_events)

0 commit comments

Comments
 (0)