UI: Add opt. to enable/disable in-focus hotkey blocking

Adds an option to enable/disable blocking hotkeys when the window is in
focus which is normally used in order to prevent hotkey/shortcut
conflicts.  This does not apply to the settings window; the hotkey
behavior is unchanged with the settings window (in order to prevent
hotkeys from being used while setting hotkeys for example).

Closes obsproject/obs-studio#1267
This commit is contained in:
jp9000 committed 2018-05-06 17:14:04 -07:00
1 parent a75724d8a5
commit 051c58eeb7
5 files changed
+208 -15

No files matched your search

+15
View File
@@ -442,6 +442,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->bindToIP, COMBO_CHANGED, ADV_CHANGED);
HookWidget(ui->enableNewSocketLoop, CHECK_CHANGED, ADV_CHANGED);
HookWidget(ui->enableLowLatencyMode, CHECK_CHANGED, ADV_CHANGED);
HookWidget(ui->disableFocusHotkeys, CHECK_CHANGED, ADV_CHANGED);
#if !defined(_WIN32) && !defined(__APPLE__)
delete ui->enableAutoUpdates;
@@ -702,11 +703,17 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
SimpleRecordingQualityChanged();
UpdateAutomaticReplayBufferCheckboxes();
App()->EnableInFocusHotkeys(false);
}
OBSBasicSettings::~OBSBasicSettings()
{
bool disableHotkeysInFocus = config_get_bool(App()->GlobalConfig(),
"General", "DisableHotkeysInFocus");
main->EnableOutputs(true);
App()->EnableInFocusHotkeys(!disableHotkeysInFocus);
}
void OBSBasicSettings::SaveCombo(QComboBox *widget, const char *section,
@@ -2280,6 +2287,10 @@ void OBSBasicSettings::LoadAdvancedSettings()
ui->enableLowLatencyMode->setChecked(enableLowLatencyMode);
#endif
bool disableFocusHotkeys = config_get_bool(App()->GlobalConfig(),
"General", "DisableHotkeysInFocus");
ui->disableFocusHotkeys->setChecked(disableFocusHotkeys);
loading = false;
}
@@ -2789,6 +2800,10 @@ void OBSBasicSettings::SaveAdvancedSettings()
SaveCheckBox(ui->enableLowLatencyMode, "Output", "LowLatencyEnable");
#endif
bool disableFocusHotkeys = ui->disableFocusHotkeys->isChecked();
config_set_bool(App()->GlobalConfig(), "General",
"DisableHotkeysInFocus", disableFocusHotkeys);
#ifdef __APPLE__
if (WidgetChanged(ui->disableOSXVSync)) {
bool disable = ui->disableOSXVSync->isChecked();