UI: Add option to disable aero on windows vista/7

On windows vista/7, you cannot really use display capture efficiently
without disabling aero, so this will add an option to settings to allow
it to be disabled and cause it to be disabled on startup.
master
jp9000 2015-05-25 01:37:13 -07:00
parent 0c631db046
commit e7eaa268e5
4 changed files with 76 additions and 3 deletions

View File

@ -324,6 +324,7 @@ Basic.Settings.Video.Denominator="Denominator:"
Basic.Settings.Video.Renderer="Renderer:"
Basic.Settings.Video.InvalidResolution="Invalid resolution value. Must be [width]x[height] (i.e. 1920x1080)"
Basic.Settings.Video.CurrentlyActive="Video output is currently active. Please turn off any outputs to change video settings."
Basic.Settings.Video.DisableAero="Disable Aero"
# scale filters
Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (Fastest, but blurry if scaling)"

View File

@ -683,6 +683,15 @@ void OBSBasic::OBSInit()
if (!previewEnabled)
QMetaObject::invokeMethod(this, "TogglePreview",
Qt::QueuedConnection);
#ifdef _WIN32
uint32_t winVer = GetWindowsVersion();
if (winVer > 0 && winVer < 0x602) {
bool disableAero = config_get_bool(basicConfig, "Video",
"DisableAero");
SetAeroEnabled(!disableAero);
}
#endif
}
void OBSBasic::InitHotkeys()
@ -888,6 +897,17 @@ OBSBasic::~OBSBasic()
config_set_bool(App()->GlobalConfig(), "BasicWindow", "PreviewEnabled",
previewEnabled);
config_save(App()->GlobalConfig());
#ifdef _WIN32
uint32_t winVer = GetWindowsVersion();
if (winVer > 0 && winVer < 0x602) {
bool disableAero = config_get_bool(basicConfig, "Video",
"DisableAero");
if (disableAero) {
SetAeroEnabled(true);
}
}
#endif
}
void OBSBasic::SaveProject()

View File

@ -187,6 +187,13 @@ static CodecDesc GetDefaultCodecDesc(const ff_format_desc *formatDesc,
id);
}
#ifdef _WIN32
void OBSBasicSettings::ToggleDisableAero(bool checked)
{
SetAeroEnabled(!checked);
}
#endif
void OBSBasicSettings::HookWidget(QWidget *widget, const char *signal,
const char *slot)
{
@ -308,6 +315,22 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->colorSpace, COMBO_CHANGED, ADV_CHANGED);
HookWidget(ui->colorRange, COMBO_CHANGED, ADV_CHANGED);
#ifdef _WIN32
uint32_t winVer = GetWindowsVersion();
if (winVer > 0 && winVer < 0x602) {
toggleAero = new QCheckBox(
QTStr("Basic.Settings.Video.DisableAero"),
this);
QFormLayout *videoLayout =
reinterpret_cast<QFormLayout*>(ui->videoPage->layout());
videoLayout->addRow(nullptr, toggleAero);
HookWidget(toggleAero, CHECK_CHANGED, VIDEO_CHANGED);
connect(toggleAero, &QAbstractButton::toggled,
this, &OBSBasicSettings::ToggleDisableAero);
}
#endif
//Apply button disabled until change.
EnableApplyButton(false);
@ -871,6 +894,16 @@ void OBSBasicSettings::LoadVideoSettings()
LoadFPSData();
LoadDownscaleFilters();
#ifdef _WIN32
if (toggleAero) {
bool disableAero = config_get_bool(main->Config(), "Video",
"DisableAero");
toggleAero->setChecked(disableAero);
aeroWasDisabled = disableAero;
}
#endif
loading = false;
}
@ -1827,6 +1860,13 @@ void OBSBasicSettings::SaveVideoSettings()
SaveSpinBox(ui->fpsNumerator, "Video", "FPSNum");
SaveSpinBox(ui->fpsDenominator, "Video", "FPSDen");
SaveComboData(ui->downscaleFilter, "Video", "ScaleType");
#ifdef _WIN32
if (toggleAero) {
SaveCheckBox(toggleAero, "Video", "DisableAero");
aeroWasDisabled = toggleAero->isChecked();
}
#endif
}
void OBSBasicSettings::SaveAdvancedSettings()
@ -2098,12 +2138,17 @@ bool OBSBasicSettings::QueryChanges()
QMessageBox::Yes | QMessageBox::No |
QMessageBox::Cancel);
if (button == QMessageBox::Cancel)
if (button == QMessageBox::Cancel) {
return false;
else if (button == QMessageBox::Yes)
} else if (button == QMessageBox::Yes) {
SaveSettings();
else
} else {
LoadSettings(true);
#ifdef _WIN32
if (toggleAero)
SetAeroEnabled(!aeroWasDisabled);
#endif
}
ClearChanged();
return true;

View File

@ -30,6 +30,7 @@
class OBSBasic;
class QAbstractButton;
class QComboBox;
class QCheckBox;
class OBSPropertiesView;
class OBSHotkeyWidget;
@ -152,6 +153,12 @@ private:
EnableApplyButton(false);
}
#ifdef _WIN32
bool aeroWasDisabled = false;
QCheckBox *toggleAero = nullptr;
void ToggleDisableAero(bool checked);
#endif
void HookWidget(QWidget *widget, const char *signal, const char *slot);
bool QueryChanges();