From 13e0b1a67e01884a58e89466b50c420578dd460d Mon Sep 17 00:00:00 2001 From: tytan652 Date: Wed, 11 Sep 2024 14:01:36 +0200 Subject: [PATCH] UI: Enable browser hw accel toggle under Linux --- UI/obs-app.cpp | 6 ++++-- UI/window-basic-settings.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 883bee21a0774d..ccdd0e4a0d17e7 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -440,11 +440,13 @@ bool OBSApp::InitGlobalConfigDefaults() #ifdef _WIN32 config_set_default_bool(appConfig, "Audio", "DisableAudioDucking", true); +#endif + +#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) config_set_default_bool(appConfig, "General", "BrowserHWAccel", true); #endif #ifdef __APPLE__ - config_set_default_bool(appConfig, "General", "BrowserHWAccel", true); config_set_default_bool(appConfig, "Video", "DisableOSXVSync", true); config_set_default_bool(appConfig, "Video", "ResetOSXVSyncOnExit", true); #endif @@ -1265,7 +1267,7 @@ bool OBSApp::OBSInit() obs_set_ui_task_handler(ui_task_handler); -#if defined(_WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) bool browserHWAccel = config_get_bool(appConfig, "General", "BrowserHWAccel"); OBSDataAutoRelease settings = obs_data_create(); diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp index d8a35501b79ceb..a061f55cd85337 100644 --- a/UI/window-basic-settings.cpp +++ b/UI/window-basic-settings.cpp @@ -551,7 +551,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent) #ifdef _WIN32 HookWidget(ui->disableAudioDucking, CHECK_CHANGED, ADV_CHANGED); #endif -#if defined(_WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) HookWidget(ui->browserHWAccel, CHECK_CHANGED, ADV_RESTART); #endif HookWidget(ui->filenameFormatting, EDIT_CHANGED, ADV_CHANGED); @@ -639,7 +639,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent) delete ui->enableNewSocketLoop; delete ui->enableLowLatencyMode; delete ui->hideOBSFromCapture; -#ifdef __linux__ +#if !defined(__APPLE__) && !defined(__linux__) delete ui->browserHWAccel; delete ui->sourcesGroup; #endif @@ -654,7 +654,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent) ui->enableNewSocketLoop = nullptr; ui->enableLowLatencyMode = nullptr; ui->hideOBSFromCapture = nullptr; -#ifdef __linux__ +#if !defined(__APPLE__) && !defined(__linux__) ui->browserHWAccel = nullptr; ui->sourcesGroup = nullptr; #endif @@ -2614,7 +2614,7 @@ void OBSBasicSettings::LoadAdvancedSettings() ui->enableLowLatencyMode->setChecked(enableLowLatencyMode); ui->enableLowLatencyMode->setToolTip(QTStr("Basic.Settings.Advanced.Network.TCPPacing.Tooltip")); #endif -#if defined(_WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) bool browserHWAccel = config_get_bool(App()->GetAppConfig(), "General", "BrowserHWAccel"); ui->browserHWAccel->setChecked(browserHWAccel); prevBrowserAccel = ui->browserHWAccel->isChecked(); @@ -3161,7 +3161,7 @@ void OBSBasicSettings::SaveAdvancedSettings() SaveCheckBox(ui->enableNewSocketLoop, "Output", "NewSocketLoopEnable"); SaveCheckBox(ui->enableLowLatencyMode, "Output", "LowLatencyEnable"); #endif -#if defined(_WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) bool browserHWAccel = ui->browserHWAccel->isChecked(); config_set_bool(App()->GetAppConfig(), "General", "BrowserHWAccel", browserHWAccel); #endif